Mercurial > pkg
changeset 19:4fbe69d24a9c
major consolidation.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Wed, 09 Jan 2013 12:32:58 +0000 |
parents | b38744722d75 |
children | c75924bd38e3 |
files | src/pkg-history.pl src/pkg-report.pl src/pkg.pl src/set-repository-perms.sh src/system-init.pl |
diffstat | 3 files changed, 33 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
1.1 --- a/src/pkg.pl Wed Jan 09 11:42:25 2013 +0000 1.2 +++ b/src/pkg.pl Wed Jan 09 12:32:58 2013 +0000 1.3 @@ -75,11 +75,11 @@ 1.4 1.5 @pkg_link_bashrc_cmd = 1.6 ("install", "-g", $pkg_name, "-o", $pkg_name, 1.7 - "/pkg/defaults/.profile", "$pkg_home/.profile"); 1.8 + "/pkg/hg-committer/.profile", "$pkg_home/.profile"); 1.9 1.10 @pkg_copy_hg_wrapper_cmd = 1.11 (install, "-g", "hg-wheel", "-o", "hg-committer", 1.12 - "-m", "6111", "/pkg/defaults/.hg-wrapper", $pkg_home); 1.13 + "-m", "6111", "/pkg/hg-committer/.hg-wrapper", $pkg_home); 1.14 1.15 sub execute{print "\t@_\n"; system(@_) and die $!;} 1.16
2.1 --- a/src/set-repository-perms.sh Wed Jan 09 11:42:25 2013 +0000 2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 2.3 @@ -1,5 +0,0 @@ 2.4 -groupadd --force hg-wheel 2.5 -gpasswd --add hg-committer hg-wheel 2.6 -gpasswd --add r hg-wheel 2.7 -chown -Rv hg-committer:hg-wheel /.hg 2.8 -chmod -Rv g+wrx /.hg
3.1 --- a/src/system-init.pl Wed Jan 09 11:42:25 2013 +0000 3.2 +++ b/src/system-init.pl Wed Jan 09 12:32:58 2013 +0000 3.3 @@ -1,9 +1,6 @@ 3.4 #!/usr/bin/env perl 3.5 3.6 -@create_install_cmd = 3.7 - ("groupadd", "--force", "install"); 3.8 -print "@create_install_cmd\n"; 3.9 -system(@create_install_cmd) and die $!; 3.10 +use Cwd; 3.11 3.12 sub create_install_dir{ 3.13 @install_cmd = 3.14 @@ -101,9 +98,36 @@ 3.15 /bin 3.16 /lib); 3.17 3.18 + 3.19 +sub execute{ 3.20 + print "\t$_[0]\n"; 3.21 + `$_[0]`; 3.22 + if ($?){die $!;} 3.23 +} 3.24 + 3.25 +execute("groupadd --force install"); 3.26 + 3.27 foreach $install_dir(@install_dirs){ 3.28 create_install_dir($install_dir);} 3.29 3.30 -`mkdir -pv /pkg/defaults` 3.31 -`ln -sfv $(pwd)/profile /pkg/defaults/.profile` 3.32 -`ln -sfv $(pwd)/hg-wrapper /pkg/defaults/.hg-wrapper` 3.33 + 3.34 +execute("find /.hg -type d -print0 | xargs -0 -L 1 -t chmod 770"); 3.35 +execute("find /.hg -type f -print0 | xargs -0 -L 1 -t chmod 660"); 3.36 + 3.37 + 3.38 +execute("groupadd --force hg-committer"); 3.39 +execute("groupadd --force hg-wheel"); 3.40 + 3.41 +if (!`id hg-committer`){ 3.42 + execute("useradd -c hg-committer -d /pkg/hg-committer -g hg-committer -s /bin/bash hg-committer"); 3.43 +} 3.44 + 3.45 +execute("chown -Rv hg-committer:hg-wheel /.hg"); 3.46 + 3.47 +$pwd = getcwd; 3.48 +execute("gpasswd --add hg-committer hg-wheel"); 3.49 +execute("ln -sfv $pwd/profile /pkg/hg-committer/.profile"); 3.50 +execute("ln -sfv $pwd/hg-wrapper /pkg/hg-committer/.hg-wrapper"); 3.51 + 3.52 + 3.53 +