Mercurial > pkg
comparison src/system-init.pl @ 19:4fbe69d24a9c
major consolidation.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Wed, 09 Jan 2013 12:32:58 +0000 |
parents | cb1a44d080db |
children | c75924bd38e3 |
comparison
equal
deleted
inserted
replaced
18:b38744722d75 | 19:4fbe69d24a9c |
---|---|
1 #!/usr/bin/env perl | 1 #!/usr/bin/env perl |
2 | 2 |
3 @create_install_cmd = | 3 use Cwd; |
4 ("groupadd", "--force", "install"); | |
5 print "@create_install_cmd\n"; | |
6 system(@create_install_cmd) and die $!; | |
7 | 4 |
8 sub create_install_dir{ | 5 sub create_install_dir{ |
9 @install_cmd = | 6 @install_cmd = |
10 ("install", "-d", "-m", | 7 ("install", "-d", "-m", |
11 "775", "-o", "root", "-g", | 8 "775", "-o", "root", "-g", |
99 /etc/opt | 96 /etc/opt |
100 /sbin | 97 /sbin |
101 /bin | 98 /bin |
102 /lib); | 99 /lib); |
103 | 100 |
101 | |
102 sub execute{ | |
103 print "\t$_[0]\n"; | |
104 `$_[0]`; | |
105 if ($?){die $!;} | |
106 } | |
107 | |
108 execute("groupadd --force install"); | |
109 | |
104 foreach $install_dir(@install_dirs){ | 110 foreach $install_dir(@install_dirs){ |
105 create_install_dir($install_dir);} | 111 create_install_dir($install_dir);} |
106 | 112 |
107 `mkdir -pv /pkg/defaults` | 113 |
108 `ln -sfv $(pwd)/profile /pkg/defaults/.profile` | 114 execute("find /.hg -type d -print0 | xargs -0 -L 1 -t chmod 770"); |
109 `ln -sfv $(pwd)/hg-wrapper /pkg/defaults/.hg-wrapper` | 115 execute("find /.hg -type f -print0 | xargs -0 -L 1 -t chmod 660"); |
116 | |
117 | |
118 execute("groupadd --force hg-committer"); | |
119 execute("groupadd --force hg-wheel"); | |
120 | |
121 if (!`id hg-committer`){ | |
122 execute("useradd -c hg-committer -d /pkg/hg-committer -g hg-committer -s /bin/bash hg-committer"); | |
123 } | |
124 | |
125 execute("chown -Rv hg-committer:hg-wheel /.hg"); | |
126 | |
127 $pwd = getcwd; | |
128 execute("gpasswd --add hg-committer hg-wheel"); | |
129 execute("ln -sfv $pwd/profile /pkg/hg-committer/.profile"); | |
130 execute("ln -sfv $pwd/hg-wrapper /pkg/hg-committer/.hg-wrapper"); | |
131 | |
132 | |
133 |