| 1 |
|
| 2 |
void install(string request, string dest) |
| 3 |
{ |
| 4 |
string target; |
| 5 |
int components = 0; |
| 6 |
list pathsplit; |
| 7 |
string base; |
| 8 |
base = "tmp/install/"; |
| 9 |
|
| 10 |
md(base); |
| 11 |
|
| 12 |
if (request == "x") |
| 13 |
components = 63; |
| 14 |
else |
| 15 |
{ |
| 16 |
if (strfind(request, "b") != -1) |
| 17 |
components |= 2; |
| 18 |
if (strfind(request, "d") != -1) |
| 19 |
components |= 4; |
| 20 |
if (strfind(request, "m") != -1) |
| 21 |
components |= 8; |
| 22 |
if (strfind(request, "s") != -1) |
| 23 |
components |= 16; |
| 24 |
if (strfind(request, "u") != -1) |
| 25 |
components |= 32; |
| 26 |
} |
| 27 |
|
| 28 |
if (components & 2) |
| 29 |
{ |
| 30 |
target = base + BINARY; |
| 31 |
pathsplit = path_file(target); |
| 32 |
|
| 33 |
printf(" installing the executable `", target, "'\n"); |
| 34 |
logFile("tmp/bin", "binary", pathsplit[0], pathsplit[1]); |
| 35 |
} |
| 36 |
|
| 37 |
|
| 38 |
if (components & (4 | 8)) |
| 39 |
{ |
| 40 |
target = base + DOC "/"; |
| 41 |
if (components & 4) |
| 42 |
{ |
| 43 |
printf(" installing the changelog at `", target, "\n"); |
| 44 |
logZip("", "changelog", target); |
| 45 |
} |
| 46 |
|
| 47 |
if (components & 8) |
| 48 |
{ |
| 49 |
printf(" installing the html-manual pages at `", target, "\n"); |
| 50 |
logInstall("tmp/manhtml", "", target); |
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
|
| 55 |
if (components & 8) |
| 56 |
{ |
| 57 |
target = base + MAN; |
| 58 |
printf(" installing the man pages below `", target, "'\n"); |
| 59 |
|
| 60 |
logZip("tmp/man", "flexc++.1", target + "/man1/"); |
| 61 |
logZip("tmp/man", "flexc++api.3", target + "/man3/"); |
| 62 |
logZip("tmp/man", "flexc++input.7", target + "/man7/"); |
| 63 |
} |
| 64 |
|
| 65 |
if (components & 16) |
| 66 |
{ |
| 67 |
target = base + SKEL "/"; |
| 68 |
printf(" installing skeleton files at `", target + "'\n"); |
| 69 |
logInstall("skeletons", "", target); |
| 70 |
} |
| 71 |
|
| 72 |
|
| 73 |
if (components & 32) |
| 74 |
{ |
| 75 |
target = base + UGUIDE "/"; |
| 76 |
printf(" installing the user-guide at `", target, "'\n"); |
| 77 |
logInstall("tmp/manual", "", target); |
| 78 |
target += "images"; |
| 79 |
logInstall("tmp/manual/images", "", target); |
| 80 |
} |
| 81 |
|
| 82 |
|
| 83 |
chdir(g_cwd); |
| 84 |
if (dest == "") |
| 85 |
dest = "/"; |
| 86 |
else |
| 87 |
md(dest); |
| 88 |
|
| 89 |
dest = cutEoln(backtick("readlink -f " + dest)[0]); |
| 90 |
|
| 91 |
if (g_logPath != "") |
| 92 |
backtick("icmake/log " + dest + " " + g_logPath); |
| 93 |
|
| 94 |
chdir(base); |
| 95 |
run("../../icmake/installer " + dest + "/"); |
| 96 |
|
| 97 |
printf("\n Installation completed\n"); |
| 98 |
|
| 99 |
exit(0); |
| 100 |
} |