Changeset 65
- Timestamp:
- 08/05/08 17:37:18 (2 years ago)
- Files:
-
- devel/dploy-pxe/bin/dploy-pxe-post (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
devel/dploy-pxe/bin/dploy-pxe-post
r63 r65 49 49 =cut 50 50 51 my $proj = "PBPROJ"; 52 53 pb_conf_init($proj); 54 pb_temp_init(); 51 55 pb_syntax_init("dploy-pxe-post\n"); 52 56 … … 54 58 55 59 # Get dploy account info 56 my $user = "PBPROJ";60 my $user = $proj; 57 61 my ($login,$pass,$uid,$gid,$gecos,$dir,$shell) = getpwnam($user) or die "$user not in passwd file"; 58 62 … … 61 65 open(SUDO,"/etc/sudoers") || die "Unable to read /etc/sudoers"; 62 66 while (<SUDO>) { 63 $found = 1 if ((/^ PBPROJ/) && (/\/bin\/umount/));67 $found = 1 if ((/^$proj/) && (/\/bin\/umount/)); 64 68 } 65 69 close(SUDO); … … 67 71 if ($found == 0) { 68 72 open(SUDO,">> /etc/sudoers") || die "Unable to write /etc/sudoers"; 69 print SUDO " PBPROJALL=NOPASSWD: /bin/mount -o loop ?*\n";70 print SUDO " PBPROJALL=NOPASSWD: /bin/umount ?*\n";73 print SUDO "$proj ALL=NOPASSWD: /bin/mount -o loop ?*\n"; 74 print SUDO "$proj ALL=NOPASSWD: /bin/umount ?*\n"; 71 75 close(SUDO); 72 76 } … … 76 80 77 81 # Create dir structure 78 foreach $d ("$pathpxe->{$ENV{'PBPROJ'}}", "$pathpxe->{$ENV{'PBPROJ'}}/../linuxcoe", "$pathpxe->{$ENV{'PBPROJ'}}/../mondorescue") {82 foreach my $d ("$pathpxe->{$proj}", "$pathpxe->{$proj}/../linuxcoe", "$pathpxe->{$proj}/../mondorescue") { 79 83 pb_mkdir_p($d) if ( not -d $d); 80 84 chown $uid,$gid,$d; … … 88 92 89 93 open(XIN,$xin) || die "Unable to read $xin: $!"; 90 open(OUT," $xin.tmp") || die "Unable to write $xin.tmp: $!";94 open(OUT,"> $ENV{'PBTMP'}/tftpd") || die "Unable to write $ENV{'PBTMP'}/tftpd: $!"; 91 95 while (<XIN>) { 92 96 s/disable(\s*)=(\s*)yes/disable$1=$2no/; 93 s/server_args(\s*)=(\s*)(.*)/change_parms($1,$2,$3)/ ;97 s/server_args(\s*)=(\s*)(.*)/change_parms($1,$2,$3)/e; 94 98 print OUT; 95 99 } 96 100 close(XIN); 97 101 close(OUT); 98 move("$ xin.tmp",$xin);102 move("$ENV{'PBTMP'}/tftpd",$xin); 99 103 100 104 # Restart xinetd … … 112 116 print "# Modified by dploy.org\n"; 113 117 print "# server_args$s1=$s2$params\n"; 114 my $dir = dirname($pathpxe->{$ ENV{'PBPROJ'}});118 my $dir = dirname($pathpxe->{$proj}); 115 119 $params =~ s/-s\s+\S+\s+/-s $dir/; 116 120 print "server_args$s1=$s2$params\n"; 117 $xin)}121 }
