Changeset 67 for devel


Ignore:
Timestamp:
08/05/08 17:40:48 (4 years ago)
Author:
bruno
Message:

For dhcp:

  • Use of PBTMP
  • Use of PBPROJ only once at begining, then a var. Avoids expansions which are not wanted.
  • Use pb 0.9.3 syntx
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/dploy-dhcp/bin/dploy-dhcp-post

    r63 r67  
    2626=back 
    2727 
    28 No option nor parameter upported 
     28No option nor parameter supported 
    2929 
    3030=head1 WEB SITES 
     
    4747=cut 
    4848 
     49my $proj = "PBPROJ"; 
     50 
     51pb_conf_init($proj); 
    4952pb_syntax_init("dploy-dhcp-post\n"); 
    5053 
     
    5255 
    5356# Get dploy account info 
    54 my $user = "PBPROJ"; 
     57my $user = $proj; 
    5558my ($login,$pass,$uid,$gid,$gecos,$dir,$shell) = getpwnam($user) or die "$user not in passwd file"; 
    5659 
    57 pb_conf_add("PBCONF/dploy.conf"); 
     60pb_conf_add("PBCONF/$proj.conf"); 
    5861my ($pathdhcp) = pb_conf_get("pathdhcp"); 
    5962 
    60 chown 0,$gid,$pathdhcp->{$ENV{'PBPROJ'}}; 
    61 chmod 0644,$pathdhcp->{$ENV{'PBPROJ'}}; 
     63chown 0,$gid,"$pathdhcp->{$proj}"; 
     64chmod 0644,"$pathdhcp->{$proj}"; 
    6265 
    6366# Include dploy in sudoers 
     
    6568open(SUDO,"/etc/sudoers") || die "Unable to read /etc/sudoers"; 
    6669while (<SUDO>) { 
    67     $found = 1 if ((/^PBPROJ/) && (/\/init.d\/dhcpd/)); 
     70    $found = 1 if ((/^$proj/) && (/\/init.d\/dhcpd/)); 
    6871} 
    6972close(SUDO); 
     
    7174if ($found == 0) { 
    7275    open(SUDO,">> /etc/sudoers") || die "Unable to write /etc/sudoers"; 
    73     print SUDO "PBPROJ ALL=NOPASSWD: /etc/init.d/dhcpd ?*\n"; 
     76    print SUDO "$proj ALL=NOPASSWD: /etc/init.d/dhcpd ?*\n"; 
    7477    close(SUDO); 
    7578} 
Note: See TracChangeset for help on using the changeset viewer.