From 71885547f0cb6d76c00e3e1c81477335cd3d5484 Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Mon, 9 Apr 2001 11:39:40 +0000 Subject: fix for when there is an already existing rc.firewall complies with old format of drakgw so that upgrades will work --- perl-install/standalone/drakgw | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'perl-install') diff --git a/perl-install/standalone/drakgw b/perl-install/standalone/drakgw index dff50ebf9..85d0cb84e 100755 --- a/perl-install/standalone/drakgw +++ b/perl-install/standalone/drakgw @@ -41,6 +41,7 @@ $::direct = /-direct/; my $sysconf_network = "/etc/sysconfig/network"; my $conf_linuxconf = "/etc/conf.linuxconf"; my $rc_firewall_generic = "/etc/rc.d/rc.firewall"; +my $rc_firewall_drakgw = "/etc/rc.d/rc.firewall.inet_sharing"; my $rc_firewall_22 = "/etc/rc.d/rc.firewall.inet_sharing-2.2"; my $rc_firewall_24 = "/etc/rc.d/rc.firewall.inet_sharing-2.4"; my $dhcpd_conf = "/etc/dhcpd.conf"; @@ -59,6 +60,8 @@ pur_gtk_mode() if $::isEmbedded && ref($in) =~ /gtk/; sub sys { system(@_) == 0 or die "sys: $_[0]" } +sub outpend { my $f = shift; local *F; open F, ">>$f" or die "outpend in file $f failed: $!\n"; print F foreach @_; } + sub start_daemons () { my $cups_used = 0; @@ -321,11 +324,24 @@ $in->standalone::pkgs_install(grep { !-e $rpm2file{$_} } keys %rpm2file); #- setup the masquerading configuration -if (!-f $rc_firewall_generic || !grep(/drakgw/, cat_($rc_firewall_generic))) { - output($rc_firewall_generic, q(#!/bin/sh +if (!-f $rc_firewall_generic) { + output($rc_firewall_generic, "#!/bin/sh # # Automatically generated by drakgw +[ -x $rc_firewall_drakgw ] && $rc_firewall_drakgw +"); + chmod 0700, $rc_firewall_generic; +} +elsif (!grep(/drakgw/, cat_($rc_firewall_generic))) { + outpend($rc_firewall_generic, "# +# Automatically added by drakgw + +[ -x $rc_firewall_drakgw ] && $rc_firewall_drakgw +"); +} + +output($rc_firewall_drakgw, q(#!/bin/sh KERNELMAJ=`uname -r | sed -e 's,\..*,,'` KERNELMIN=`uname -r | sed -e 's,[^\.]*\.,,' -e 's,\..*,,'` @@ -336,9 +352,8 @@ if [ "$KERNELMAJ" -eq 2 -a "$KERNELMIN" -eq 4 ]; then [ -x ) . $rc_firewall_24 . ' ] && ' . $rc_firewall_24 . q( fi )); -} -chmod 0700, $rc_firewall_generic; +chmod 0700, $rc_firewall_drakgw; output($rc_firewall_22, @@ -641,6 +656,10 @@ Click on Configure to launch the setup wizard.", $setup_state)); #------------------------------------------------- #- $Log$ +#- Revision 1.36 2001/04/09 11:39:40 gc +#- fix for when there is an already existing rc.firewall +#- complies with old format of drakgw so that upgrades will work +#- #- Revision 1.35 2001/04/08 05:33:14 damien #- updated #- -- cgit v1.2.1