1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
void rungzip9(string src, string dest)
{
int idx;
string file;
list man;
chdir(src);
man = makelist("*");
chdir(g_cwd);
for (idx = sizeof(man); idx--; )
{
file = element(idx, man);
run("gzip -9 < " + src + file + " > " + dest + file + ".gz");
}
}
void reqzip(string dest, string srcPath, string src)
{
list files;
int idx;
string file;
files = strtok(src, " ");
for (idx = sizeof(files); idx--; )
{
file = element(idx, files);
run("gzip -9 < " + srcPath + file + " > " + dest + file + ".gz");
}
}
void install(string what, string where)
{
string docdoc;
docdoc = DOC + "-doc";
if (what == "program")
{
printf(" installing the executable\n");
md(where + BIN);
run("cp tmp/bin/* " + where + BIN);
printf(" installing the information directly in and under $DOC\n");
reqzip(where + DOC + "/", "./", "changelog");
run("cp README ACKNOWLEDGEMENTS " + where + DOC);
}
if (what == "man")
{
printf(" installing the manual page stealth.1\n");
md(where + MAN);
reqzip(where + MAN + "/", "tmp/man/", "stealth.1");
printf(" installing the manual page stealthman.html\n");
md(where + DOC + "/man");
reqzip(where + DOC + "/man/", "tmp/manhtml/", "stealthman.html");
printf(" installing scripts\n");
md(where + DOC + "/scripts/etc/logrotate.d");
reqzip(where + DOC + "/scripts/etc/logrotate.d/",
"share/etc/logrotate.d/", "target");
md(where + DOC + "/scripts/etc/stealth");
reqzip(where + DOC + "/scripts/etc/stealth/", "share/etc/stealth/",
"cleanup.rc");
md(where + DOC + "/scripts/usr/bin");
rungzip9("share/usr/bin/", where + DOC + "/scripts/usr/bin/");
}
if (what == "manual")
{
printf(" installing examples\n");
md(where + docdoc + "/examples");
rungzip9("example-policies/", where + docdoc + "/examples/");
printf(" installing manual\n");
run("cp -r tmp/manual " + where + docdoc);
}
printf(" " + what + " installation completed\n");
exit(0);
}
|