From 893a0a70abc449d8dad2212923b4eed33d7c169d Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Wed, 26 Apr 2000 13:01:45 +0000 Subject: *** empty log message *** --- perl-install/ChangeLog | 5 +++ perl-install/install_steps.pm | 94 +++++++++++++++++++++++++++++++++++-------- 2 files changed, 82 insertions(+), 17 deletions(-) (limited to 'perl-install') diff --git a/perl-install/ChangeLog b/perl-install/ChangeLog index 157cb6605..70828981f 100644 --- a/perl-install/ChangeLog +++ b/perl-install/ChangeLog @@ -1,3 +1,8 @@ +2000-04-26 François Pons + + * install_steps.pm (pppConfig): modified a lot, removed template + file for ifcfg and chat file. + 2000-04-26 Pixel * install_any.pm (relGetFile): added auto_inst to files to get diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index 44acc1958..6e244322f 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -451,7 +451,7 @@ sub pppConfig { $o->{modem} or return; symlinkf($o->{modem}{device}, "$o->{prefix}/dev/modem") or log::l("creation of $o->{prefix}/dev/modem failed"); - $o->pkg_install("ppp"); + $o->pkg_install("ppp") unless $::testing; my %toreplace; $toreplace{$_} = $o->{modem}{$_} foreach qw(connection phone login passwd auth domain dns1 dns2); @@ -466,30 +466,90 @@ sub pppConfig { $toreplace{connection} ||= 'DialupConnection'; $toreplace{domain} ||= 'localdomain'; $toreplace{intf} ||= 'ppp0'; - - if ($o->{modem}{auth} eq 'PAP') { - template2file($toreplace{dnsserver} ? "/usr/share/ifcfg-ppp.pap.dns.in" : "/usr/share/ifcfg-ppp.pap.in", - "$o->{prefix}/etc/sysconfig/network-scripts/ifcfg-ppp0", %toreplace); - template2file("/usr/share/chat-ppp.pap.in", "$o->{prefix}/etc/sysconfig/network-scripts/chat-ppp0", %toreplace); - - my @l = cat_("$o->{prefix}/etc/ppp/pap-secrets"); + $toreplace{papname} = $o->{modem}{auth} eq 'PAP' && $toreplace{connection}; + + #- build ifcfg-ppp0. + my $ifcfg = "$o->{prefix}/etc/sysconfig/network-scripts/ifcfg-ppp0"; + local *IFCFG; open IFCFG, ">$ifcfg" or die "Can't open $ifcfg"; + print IFCFG <$chat" or die "Can't open $chat"; + print CHAT <{modem}{auth} eq 'Terminal-based' || $o->{modem}{auth} eq 'Script-based') { + print CHAT <{modem}{auth} eq 'PAP' || $o->{modem}{auth} eq 'CHAP') { + #- need to create a secrets file for the connection. + my $secrets = "$o->{prefix}/etc/ppp/" . lc($o->{modem}{auth}) . "-secrets"; + my @l = cat_($secrets); my $replaced = 0; do { $replaced ||= 1 - if s/^\s*$toreplace{login}\s+ppp0\s+(\S+)/$toreplace{login} ppp0 $toreplace{passwd}/; } foreach @l; + if s/^\s*$toreplace{login}\s+ppp0\s+(\S+)/$toreplace{login} ppp0 "$toreplace{passwd}"/; } foreach @l; if ($replaced) { local *F; - open F, ">$o->{prefix}/etc/ppp/pap-secrets" or die "Can't open $o->{prefix}/etc/ppp/pap-secrets $!"; + open F, ">$secrets" or die "Can't open $secrets: $!"; print F @l; } else { local *F; - open F, ">>$o->{prefix}/etc/ppp/pap-secrets" or die "Can't open $o->{prefix}/etc/ppp/pap-secrets $!"; - print F "$toreplace{login} ppp0 $toreplace{passwd}\n"; + open F, ">>$secrets" or die "Can't open $secrets: $!"; + print F "$toreplace{login} ppp0 \"$toreplace{passwd}\"\n"; } - } elsif ($o->{modem}{auth} eq 'Terminal-based' || $o->{modem}{auth} eq 'Script-based') { - template2file($toreplace{dnsserver} ? "/usr/share/ifcfg-ppp.script.dns.in" : "/usr/share/ifcfg-ppp.script.in", - "$o->{prefix}/etc/sysconfig/network-scripts/ifcfg-ppp0", %toreplace); - template2file("/usr/share/chat-ppp.script.in", "$o->{prefix}/etc/sysconfig/network-scripts/chat-ppp0", %toreplace); - } #- no CHAP currently. + #- restore access right to secrets file, just in case. + chmod 0600, $secrets; + } install_any::template2userfile($o->{prefix}, "$ENV{SHARE_PATH}/kppprc.in", ".kde/share/config/kppprc", 1, %toreplace); -- cgit v1.2.1