Mercurial > pkg
diff 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 |
line wrap: on
line diff
1.1 --- a/src/system-init.pl Wed Jan 09 11:42:25 2013 +0000 1.2 +++ b/src/system-init.pl Wed Jan 09 12:32:58 2013 +0000 1.3 @@ -1,9 +1,6 @@ 1.4 #!/usr/bin/env perl 1.5 1.6 -@create_install_cmd = 1.7 - ("groupadd", "--force", "install"); 1.8 -print "@create_install_cmd\n"; 1.9 -system(@create_install_cmd) and die $!; 1.10 +use Cwd; 1.11 1.12 sub create_install_dir{ 1.13 @install_cmd = 1.14 @@ -101,9 +98,36 @@ 1.15 /bin 1.16 /lib); 1.17 1.18 + 1.19 +sub execute{ 1.20 + print "\t$_[0]\n"; 1.21 + `$_[0]`; 1.22 + if ($?){die $!;} 1.23 +} 1.24 + 1.25 +execute("groupadd --force install"); 1.26 + 1.27 foreach $install_dir(@install_dirs){ 1.28 create_install_dir($install_dir);} 1.29 1.30 -`mkdir -pv /pkg/defaults` 1.31 -`ln -sfv $(pwd)/profile /pkg/defaults/.profile` 1.32 -`ln -sfv $(pwd)/hg-wrapper /pkg/defaults/.hg-wrapper` 1.33 + 1.34 +execute("find /.hg -type d -print0 | xargs -0 -L 1 -t chmod 770"); 1.35 +execute("find /.hg -type f -print0 | xargs -0 -L 1 -t chmod 660"); 1.36 + 1.37 + 1.38 +execute("groupadd --force hg-committer"); 1.39 +execute("groupadd --force hg-wheel"); 1.40 + 1.41 +if (!`id hg-committer`){ 1.42 + execute("useradd -c hg-committer -d /pkg/hg-committer -g hg-committer -s /bin/bash hg-committer"); 1.43 +} 1.44 + 1.45 +execute("chown -Rv hg-committer:hg-wheel /.hg"); 1.46 + 1.47 +$pwd = getcwd; 1.48 +execute("gpasswd --add hg-committer hg-wheel"); 1.49 +execute("ln -sfv $pwd/profile /pkg/hg-committer/.profile"); 1.50 +execute("ln -sfv $pwd/hg-wrapper /pkg/hg-committer/.hg-wrapper"); 1.51 + 1.52 + 1.53 +