File: install

package info (click to toggle)
natlog 3.01.00-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,912 kB
  • sloc: cpp: 3,691; fortran: 201; sh: 133; ansic: 123; makefile: 110
file content (75 lines) | stat: -rw-r--r-- 1,658 bytes parent folder | download | duplicates (6)
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

void install(string request, string dest)
{
    string target;
    int components = 0;
    list pathsplit;
    string base;
    base = "tmp/install/";

    md(base);

    if (request == "x")
        components = 63;
    else 
    {
        if (strfind(request, "b") != -1)
            components |= 2;
        if (strfind(request, "d") != -1)
            components |= 4;
        if (strfind(request, "m") != -1)
            components |= 8;                
    }

    if (components & 2)
    {
        target = base + BINARY;
        pathsplit = path_file(target);

        printf("  installing the executable `", target, "'\n");
        logFile("tmp/bin", "binary", pathsplit[0], pathsplit[1]);
    }


    if (components & (4 | 8))
    {
        target = base + DOC "/";
        if (components & 4)
        {
            printf("  installing the changelog at `", target, "\n");
            logZip("", "changelog", target );
        }

        if (components & 8)
        {
            printf("  installing the html-manual page at `", target, "\n");
            logInstall("tmp/manhtml", "", target);
        }
    }


    if (components & 8)
    {
        target = base + MAN "/";
        printf("  installing the manual page below `", target, "'\n");
    
        logZip("tmp/man", "natlog.1", target);
    }

    chdir(g_cwd);
    if (dest == "")
        dest = "/";
    else
        md(dest);

    dest = cutEoln(backtick("realpath " + dest)[0]);

    if (g_logPath != "")
        backtick("icmake/log " + dest + " " + g_logPath);

    run("tar cf - -Ctmp/install . | tar xf - -C" + dest);

    printf("\n  Installation completed\n");

    exit(0);
}