Mercurial > pkg
comparison src/pkg.pl @ 7:ab4011ea1463
using C wrapper instead of perl wrapper.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 08 Jan 2013 18:10:15 +0000 |
parents | fe56b4698cf8 |
children | 7b9d471fc1d3 |
comparison
equal
deleted
inserted
replaced
6:941970bc92e3 | 7:ab4011ea1463 |
---|---|
66 | 66 |
67 @pkg_create_group_cmd = | 67 @pkg_create_group_cmd = |
68 ("groupadd", "--force", $pkg_name); | 68 ("groupadd", "--force", $pkg_name); |
69 | 69 |
70 @pkg_create_home_cmd = | 70 @pkg_create_home_cmd = |
71 ("install", "-d", "-g", $pkg_name, "-o", $pkg_name, "-m", "700", $pkg_home); | 71 ("install", "-d", "-g", $pkg_name, "-o", $pkg_name, |
72 "-m", "700", $pkg_home); | |
73 | |
74 @pkg_add_install_cmd = | |
75 ("gpasswd", "--add", $pkg_name, "install"); | |
72 | 76 |
73 sub execute{print "\t@_\n"; system(@_) and die $!;} | 77 sub execute{print "\t@_\n"; system(@_) and die $!;} |
78 | |
79 | |
80 @pkg_link_bashrc_cmd = | |
81 ("install", "-g", $pkg_name, "-o", $pkg_name, | |
82 "/pkg/defaults/.bashrc", "$pkg_home/.profile"); | |
83 | |
84 @pkg_copy_hg_wrapper_cmd = | |
85 (install, "-g", "root", "-o", "root", | |
86 "-m", "4777", "/pkg/defaults/.hg-wrapper", $pkg_home); | |
74 | 87 |
75 #determine if the user already exists: | 88 #determine if the user already exists: |
76 `id $pkg_name 2>/dev/null`; | 89 `id $pkg_name 2>/dev/null`; |
77 if (!$?){ | 90 if (!$?){ |
78 print "Change user.\n"; | 91 print "Change user.\n"; |
85 execute(@pkg_create_cmd); | 98 execute(@pkg_create_cmd); |
86 | 99 |
87 print "Create home directory for $pkg_name.\n"; | 100 print "Create home directory for $pkg_name.\n"; |
88 execute(@pkg_create_home_cmd); | 101 execute(@pkg_create_home_cmd); |
89 | 102 |
103 print "Add $pkg_name to install group.\n"; | |
104 execute(@pkg_add_install_cmd); | |
105 | |
106 print "Copy Default Files.\n"; | |
107 execute(@pkg_link_bashrc_cmd); | |
108 execute(@pkg_copy_hg_wrapper_cmd); | |
109 | |
90 print "Change user.\n"; | 110 print "Change user.\n"; |
91 execute(@pkg_switch_cmd); | 111 execute(@pkg_switch_cmd); |
92 | 112 |
93 | 113 |
94 | 114 |
95 | 115 |
96 | 116 |
97 | 117 |
98 | 118 |
119 |