diff options
author | Francois Pons <fpons@mandriva.com> | 2000-04-26 13:01:45 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 2000-04-26 13:01:45 +0000 |
commit | 893a0a70abc449d8dad2212923b4eed33d7c169d (patch) | |
tree | f0af1875e3f937c7123c28af6965253669619241 | |
parent | 6978068fa870e190f2f6cfa7ce1dab55499884c3 (diff) | |
download | drakx-893a0a70abc449d8dad2212923b4eed33d7c169d.tar drakx-893a0a70abc449d8dad2212923b4eed33d7c169d.tar.gz drakx-893a0a70abc449d8dad2212923b4eed33d7c169d.tar.bz2 drakx-893a0a70abc449d8dad2212923b4eed33d7c169d.tar.xz drakx-893a0a70abc449d8dad2212923b4eed33d7c169d.zip |
*** empty log message ***
-rw-r--r-- | perl-install/ChangeLog | 5 | ||||
-rw-r--r-- | perl-install/install_steps.pm | 94 |
2 files changed, 82 insertions, 17 deletions
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 <fpons@mandrakesoft.com> + + * install_steps.pm (pppConfig): modified a lot, removed template + file for ifcfg and chat file. + 2000-04-26 Pixel <pixel@mandrakesoft.com> * 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 <<END; +DEVICE="$toreplace{intf}" +ONBOOT="no" +USERCTL="no" +MODEMPORT="/dev/modem" +LINESPEED="115200" +PERSIST="yes" +DEFABORT="yes" +DEBUG="yes" +INITSTRING="ATZ" +DEFROUTE="yes" +HARDFLOWCTL="yes" +ESCAPECHARS="no" +PPPOPTIONS="" +PAPNAME="$toreplace{papname}" +REMIP="" +NETMASK="" +IPADDR="" +MRU="" +MTU="" +DISCONNECTTIMEOUT="5" +RETRYTIMEOUT="60" +BOOTPROTO="none" +PEERDNS="$toreplace{peerdns}" +END + foreach (1..2) { + if ($toreplace{"dns$_"}) { + print IFCFG <<END; +DNS$_=$toreplace{"dns$_"} +END + } + } + close IFCFG; + + #- build chat-ppp0. + my $chat = "$o->{prefix}/etc/sysconfig/network-scripts/chat-ppp0"; + local *CHAT; open CHAT, ">$chat" or die "Can't open $chat"; + print CHAT <<END; +'ABORT' 'BUSY' +'ABORT' 'ERROR' +'ABORT' 'NO CARRIER' +'ABORT' 'NO DIALTONE' +'ABORT' 'Invalid Login' +'ABORT' 'Login incorrect' +'' 'ATZ' +'OK' 'ATDT$toreplace{phone}' +'CONNECT' '' +END + if ($o->{modem}{auth} eq 'Terminal-based' || $o->{modem}{auth} eq 'Script-based') { + print CHAT <<END; +'ogin:' '$toreplace{login}' +'ord:' '$toreplace{passwd}' +END + } + print CHAT <<END; +'TIMEOUT' '5' +'~--' '' +END + close CHAT; + + if ($o->{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); |