Mercurial > pkg
changeset 4:fe56b4698cf8
add install-init, and refine pkg.pl.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 08 Jan 2013 15:41:29 +0000 |
parents | 9ff0fcf34920 |
children | 0cad381d72d5 |
files | src/create-install-dirs.pl src/pkg.pl |
diffstat | 2 files changed, 110 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/create-install-dirs.pl Tue Jan 08 15:41:29 2013 +0000 1.3 @@ -0,0 +1,106 @@ 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 + 1.11 +sub create_install_dir{ 1.12 + @install_cmd = 1.13 + ("install", "-d", "-m", 1.14 + "775", "-o", "root", "-g", 1.15 + "install", $_[0]); 1.16 + print "@install_cmd\n"; 1.17 + system(@install_cmd) and die $!;} 1.18 + 1.19 +@install_dirs = qw( 1.20 +/usr/bin 1.21 +/usr/sbin 1.22 +/usr/include 1.23 +/usr/lib 1.24 +/usr/man/man1 1.25 +/usr/man/man2 1.26 +/usr/man/man3 1.27 +/usr/man/man4 1.28 +/usr/man/man5 1.29 +/usr/man/man6 1.30 +/usr/man/man7 1.31 +/usr/man/man8 1.32 +/usr/doc 1.33 +/usr/info 1.34 +/usr/local/man/man1 1.35 +/usr/local/man/man2 1.36 +/usr/local/man/man3 1.37 +/usr/local/man/man4 1.38 +/usr/local/man/man5 1.39 +/usr/local/man/man6 1.40 +/usr/local/man/man7 1.41 +/usr/local/man/man8 1.42 +/usr/local/doc 1.43 +/usr/local/info 1.44 +/usr/share 1.45 +/usr/share/dict 1.46 +/usr/share/doc 1.47 +/usr/share/info 1.48 +/usr/share/locale 1.49 +/usr/share/man/man1 1.50 +/usr/share/man/man2 1.51 +/usr/share/man/man3 1.52 +/usr/share/man/man4 1.53 +/usr/share/man/man5 1.54 +/usr/share/man/man6 1.55 +/usr/share/man/man7 1.56 +/usr/share/man/man8 1.57 +/usr/share/nls 1.58 +/usr/share/misc 1.59 +/usr/share/terminfo 1.60 +/usr/share/zoneinfo 1.61 +/usr/share/i18n 1.62 +/usr/share/aclocal 1.63 +/usr/local/bin 1.64 +/usr/local/etc 1.65 +/usr/local/include 1.66 +/usr/local/lib 1.67 +/usr/local/sbin 1.68 +/usr/local/share 1.69 +/usr/local/share/dict 1.70 +/usr/local/share/doc 1.71 +/usr/local/share/info 1.72 +/usr/local/share/locale 1.73 +/usr/local/share/man/man1 1.74 +/usr/local/share/man/man2 1.75 +/usr/local/share/man/man3 1.76 +/usr/local/share/man/man4 1.77 +/usr/local/share/man/man5 1.78 +/usr/local/share/man/man6 1.79 +/usr/local/share/man/man7 1.80 +/usr/local/share/man/man8 1.81 +/usr/local/share/nls 1.82 +/usr/local/share/misc 1.83 +/usr/local/share/terminfo 1.84 +/usr/local/share/zoneinfo 1.85 +/opt 1.86 +/opt/doc 1.87 +/opt/info 1.88 +/opt/bin 1.89 +/opt/include 1.90 +/opt/lib 1.91 +/opt/man/man1 1.92 +/opt/man/man2 1.93 +/opt/man/man3 1.94 +/opt/man/man4 1.95 +/opt/man/man5 1.96 +/opt/man/man6 1.97 +/opt/man/man7 1.98 +/opt/man/man8 1.99 +/var/lib 1.100 +/var/opt 1.101 +/etc 1.102 +/etc/opt 1.103 +/sbin 1.104 +/bin 1.105 +/lib); 1.106 + 1.107 +foreach $install_dir(@install_dirs){ 1.108 + create_install_dir($install_dir);} 1.109 +
2.1 --- a/src/pkg.pl Tue Jan 08 14:42:09 2013 +0000 2.2 +++ b/src/pkg.pl Tue Jan 08 15:41:29 2013 +0000 2.3 @@ -70,11 +70,13 @@ 2.4 @pkg_create_home_cmd = 2.5 ("install", "-d", "-g", $pkg_name, "-o", $pkg_name, "-m", "700", $pkg_home); 2.6 2.7 -sub execute{print "@_\n"; system(@_) and die $!;} 2.8 +sub execute{print "\t@_\n"; system(@_) and die $!;} 2.9 2.10 #determine if the user already exists: 2.11 `id $pkg_name 2>/dev/null`; 2.12 -if (!$?){execute(@pkg_switch_cmd); exit 0;} 2.13 +if (!$?){ 2.14 + print "Change user.\n"; 2.15 + execute(@pkg_switch_cmd); exit 0;} 2.16 2.17 print "Creating package group.\n"; 2.18 execute(@pkg_create_group_cmd);