view src/system-init.pl @ 21:d46aeb3166d0

going to work on file permissions/ownership since mercurial doesn't track them.
author Robert McIntyre <rlm@mit.edu>
date Thu, 10 Jan 2013 07:02:49 +0000
parents c75924bd38e3
children 43cfd1a2c523
line wrap: on
line source
1 #!/usr/bin/env perl
3 use Cwd;
5 sub create_install_dir{
6 @install_cmd =
7 ("install", "-d", "-m",
8 "775", "-o", "root", "-g",
9 "install", $_[0]);
10 print "@install_cmd\n";
11 system(@install_cmd) and die $!;}
13 @install_dirs = qw(
14 /usr/bin
15 /usr/sbin
16 /usr/include
17 /usr/lib
18 /usr/man/man1
19 /usr/man/man2
20 /usr/man/man3
21 /usr/man/man4
22 /usr/man/man5
23 /usr/man/man6
24 /usr/man/man7
25 /usr/man/man8
26 /usr/doc
27 /usr/info
28 /usr/local/man/man1
29 /usr/local/man/man2
30 /usr/local/man/man3
31 /usr/local/man/man4
32 /usr/local/man/man5
33 /usr/local/man/man6
34 /usr/local/man/man7
35 /usr/local/man/man8
36 /usr/local/doc
37 /usr/local/info
38 /usr/share
39 /usr/share/dict
40 /usr/share/doc
41 /usr/share/info
42 /usr/share/locale
43 /usr/share/man/man1
44 /usr/share/man/man2
45 /usr/share/man/man3
46 /usr/share/man/man4
47 /usr/share/man/man5
48 /usr/share/man/man6
49 /usr/share/man/man7
50 /usr/share/man/man8
51 /usr/share/nls
52 /usr/share/misc
53 /usr/share/terminfo
54 /usr/share/zoneinfo
55 /usr/share/i18n
56 /usr/share/aclocal
57 /usr/local/bin
58 /usr/local/etc
59 /usr/local/include
60 /usr/local/lib
61 /usr/local/sbin
62 /usr/local/share
63 /usr/local/share/dict
64 /usr/local/share/doc
65 /usr/local/share/info
66 /usr/local/share/locale
67 /usr/local/share/man/man1
68 /usr/local/share/man/man2
69 /usr/local/share/man/man3
70 /usr/local/share/man/man4
71 /usr/local/share/man/man5
72 /usr/local/share/man/man6
73 /usr/local/share/man/man7
74 /usr/local/share/man/man8
75 /usr/local/share/nls
76 /usr/local/share/misc
77 /usr/local/share/terminfo
78 /usr/local/share/zoneinfo
79 /opt
80 /opt/doc
81 /opt/info
82 /opt/bin
83 /opt/include
84 /opt/lib
85 /opt/man/man1
86 /opt/man/man2
87 /opt/man/man3
88 /opt/man/man4
89 /opt/man/man5
90 /opt/man/man6
91 /opt/man/man7
92 /opt/man/man8
93 /var/lib
94 /var/opt
95 /etc
96 /etc/opt
97 /sbin
98 /bin
99 /lib);
102 sub execute{
103 print "\t$_[0]\n";
104 `$_[0]`;
105 if ($?){die $!;}
106 }
108 execute("groupadd --force install");
110 foreach $install_dir(@install_dirs){
111 create_install_dir($install_dir);}
114 execute("find /.hg -type d -print0 | xargs -0 -L 1 -t chmod 2770");
115 execute("find /.hg -type f -print0 | xargs -0 -L 1 -t chmod 660");
117 execute("groupadd --force hg-committer");
118 execute("groupadd --force hg-wheel");
120 if (!`id hg-committer`){
121 execute("useradd -c hg-committer -d /pkg/hg-committer -g hg-committer -s /bin/bash hg-committer");
122 }
124 execute("chown -Rv hg-committer:hg-wheel /.hg");
126 $pwd = getcwd;
127 execute("gpasswd --add hg-committer hg-wheel");
128 execute("gpasswd --add hg-committer users");
129 execute("ln -sf $pwd/profile /pkg/hg-committer/.profile");
130 execute("ln -sf $pwd/hgrc /pkg/hg-committer/.hgrc");
131 execute("ln -sf $pwd/hg-wrapper /pkg/hg-committer/");
132 execute("ln -sf `which hg` /pkg/hg-committer/");
133 execute("install -o hg-committer -g hg-wheel -m 660 $pwd/hgignore /.hgignore");