File: install

package info (click to toggle)
stealth 4.04.00-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,540 kB
  • sloc: cpp: 2,759; sh: 151; makefile: 111; ansic: 52
file content (137 lines) | stat: -rw-r--r-- 4,164 bytes parent folder | download | duplicates (2)
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137

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, "a") != -1)    // additional docs
            components |= 1;
        if (strfind(request, "b") != -1)    // binary program
            components |= 2;
        if (strfind(request, "d") != -1)    // std. documentation
            components |= 4;
        if (strfind(request, "m") != -1)    // man-pages
            components |= 8;                
        if (strfind(request, "u") != -1)    // user-guide
            components |= 32;
    }

    chdir(g_cwd);                       // determine the destination path
    if (dest == "")
        dest = "/";
    else
        md(dest);

    dest = cutEoln(backtick("readlink -f " + dest)[0]);

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


    if (components & 1)                     // additional docs
    {
        target = base + "a/" ADD "/";

        printf("\n  installing additional documentation\n");

        printf("  installing README files and ACKNOWLEDGEMENTS at `", 
                                                            target, "\n");
        logZip("", "README", target);
        logZip("", "README.3.00.00", target);
        logZip("", "ACKNOWLEDGEMENTS", target);

        printf("  installing cross-reference at `", target, "'\n");
        logZip("", "stealth.xref", target);
 

        target += "examples/";
        printf("  installing examples at `", target, "'\n");
        logZip("documentation/example-policies/", "demo.pol", target);
        logZip("documentation/example-policies/", "localhost.pol", target);
        logZip("documentation/example-policies/", "simple.pol", target);

        destInstall(dest, base + "a");
    }

    if (components & 2)                     // binary program
    {
        target = base + "b/" BINARY;
        pathsplit = path_file(target);

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

        destInstall(dest, base + "b");
    }


    if (components & (4 | 8))           // 4: std docs, 8: man-pages
    {
        target = base + "d/" DOC "/";

        if (components & 4)
        {
            printf("  installing the changelog at `", target, "\n");
            logZip("", "changelog", target );

            printf("  installing the logrotate mold  as `", 
                    target, "/scripts/logrotate.gz'\n");
            logZip("share/", "logrotate", target + "scripts/");

            printf("  installing the cleanup script as `", 
                            target, "/scripts/cleanup.rc.gz'\n");
            logZip("share/", "cleanup.rc", target + "scripts/");

            printf("  installing additional scripts at `", 
                            target, "/scripts/additional\n");

            logZip("share/additional/", "", target + "scripts/");

            destInstall(dest, base + "d");
        }

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

            printf("  installing ", dest, " at `", base, "d'\n");
            destInstall(dest, base + "d");
        }
    }


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

        destInstall(dest, base + "m");
    }

    if (components & 32)                // user-guide
    {
        target = base + "u/" UGUIDE "/";
        printf("  installing the user-guide at `", target, "'\n");
        logZip("tmp/manual/LaTeX", "", target + "LaTeX/");
        logZip("tmp/manual/pdf", "", target + "pdf/");
        logInstall("tmp/manual/html", "", target + "html/");

        destInstall(dest, base + "u");
    }

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

    exit(0);
}