summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authordamien <damien@mandriva.com>2000-08-29 17:06:05 +0000
committerdamien <damien@mandriva.com>2000-08-29 17:06:05 +0000
commit3161708c83a46d247c81b7681fd6a64f3c4a1310 (patch)
tree7240b96b265f51d3c93ca60fbe4d94214d13d162 /perl-install
parentf2ef37015a716cf8feeb66f6e7505915ce30a27a (diff)
downloaddrakx-backup-do-not-use-3161708c83a46d247c81b7681fd6a64f3c4a1310.tar
drakx-backup-do-not-use-3161708c83a46d247c81b7681fd6a64f3c4a1310.tar.gz
drakx-backup-do-not-use-3161708c83a46d247c81b7681fd6a64f3c4a1310.tar.bz2
drakx-backup-do-not-use-3161708c83a46d247c81b7681fd6a64f3c4a1310.tar.xz
drakx-backup-do-not-use-3161708c83a46d247c81b7681fd6a64f3c4a1310.zip
see changelog.
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/ChangeLog6
-rw-r--r--perl-install/any.pm119
-rw-r--r--perl-install/install_steps.pm120
-rw-r--r--perl-install/install_steps_interactive.pm35
4 files changed, 128 insertions, 152 deletions
diff --git a/perl-install/ChangeLog b/perl-install/ChangeLog
index c585fac31..7b728cf6c 100644
--- a/perl-install/ChangeLog
+++ b/perl-install/ChangeLog
@@ -1,3 +1,9 @@
+2000-08-29 dam's <damien@mandrakesoft.com>
+
+ * moved pppConfig in netconnect.pm and any.pm
+ * moved miscellaneousNetwork in any
+ * modem configuration is now useable in standalone mode.
+
2000-08-29 David BAUDENS <baudens@mandrakesoft.com>
* install_steps_interactive.pm: change Small/Normal/Full ->
diff --git a/perl-install/any.pm b/perl-install/any.pm
index 7be45a54b..60bec7159 100644
--- a/perl-install/any.pm
+++ b/perl-install/any.pm
@@ -281,5 +281,124 @@ sub inspect {
$h;
}
+#-----modem conf
+sub pppConfig {
+ my ($o) = @_;
+ $o->{modem} or return;
+
+ symlinkf($o->{modem}{device}, "$o->{prefix}/dev/modem") or log::l("creation of $o->{prefix}/dev/modem failed");
+ $::isStandalone ? `urpmi --auto ppp` : $o->pkg_install("ppp") unless $::testing;
+
+ my %toreplace;
+ $toreplace{$_} = $o->{modem}{$_} foreach qw(connection phone login passwd auth domain dns1 dns2);
+ $toreplace{kpppauth} = ${{ 'Script-based' => 0, 'PAP' => 1, 'Terminal-based' => 2, 'CHAP' => 3, }}{$o->{modem}{auth}};
+ $toreplace{phone} =~ s/\D//g;
+ $toreplace{dnsserver} = join ',', map { $o->{modem}{$_} } "dns1", "dns2";
+ $toreplace{dnsserver} .= $toreplace{dnsserver} && ',';
+
+ #- using peerdns or dns1,dns2 avoid writing a /etc/resolv.conf file.
+ $toreplace{peerdns} = "yes";
+
+ $toreplace{connection} ||= 'DialupConnection';
+ $toreplace{domain} ||= 'localdomain';
+ $toreplace{intf} ||= 'ppp0';
+ $toreplace{papname} = $o->{modem}{auth} eq 'PAP' && $toreplace{login};
+
+ #- 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') {
+ #- 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 ($replaced) {
+ local *F;
+ open F, ">$secrets" or die "Can't open $secrets: $!";
+ print F @l;
+ } else {
+ local *F;
+ open F, ">>$secrets" or die "Can't open $secrets: $!";
+ print F "$toreplace{login} ppp0 \"$toreplace{passwd}\"\n";
+ }
+ #- restore access right to secrets file, just in case.
+ chmod 0600, $secrets;
+ } #- CHAP is not supported by initscripts, need patching before doing more on that here!
+
+ #-install_any::template2userfile($o->{prefix}, "$ENV{SHARE_PATH}/kppprc.in", ".kde/share/config/kppprc", 1, %toreplace);
+ commands::mkdir_("-p", "$o->{prefix}/usr/share/config");
+ template2file("$ENV{SHARE_PATH}/kppprc.in", "$o->{prefix}/usr/share/config/kppprc", %toreplace);
+
+ miscellaneousNetwork($o);
+}
+
+sub miscellaneousNetwork {
+ my ($o) = @_;
+ setVarsInSh ("$o->{prefix}/etc/profile.d/proxy.sh", $o->{miscellaneous}, qw(http_proxy ftp_proxy));
+ setVarsInCsh("$o->{prefix}/etc/profile.d/proxy.csh", $o->{miscellaneous}, qw(http_proxy ftp_proxy));
+}
+
1;
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index b8e4d07c6..36e80e7f1 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -491,121 +491,10 @@ sub configureNetwork($) {
$o->pkg_install("pump") if grep { $_->{BOOTPROTO} =~ /^(pump|bootp)$/ } @{$o->{intf}};
#-res_init(); #- reinit the resolver so DNS changes take affect
- miscellaneousNetwork($o);
+ any::miscellaneousNetwork($o);
}
#------------------------------------------------------------------------------
-sub pppConfig {
- my ($o) = @_;
- $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") unless $::testing;
-
- my %toreplace;
- $toreplace{$_} = $o->{modem}{$_} foreach qw(connection phone login passwd auth domain dns1 dns2);
- $toreplace{kpppauth} = ${{ 'Script-based' => 0, 'PAP' => 1, 'Terminal-based' => 2, 'CHAP' => 3, }}{$o->{modem}{auth}};
- $toreplace{phone} =~ s/\D//g;
- $toreplace{dnsserver} = join ',', map { $o->{modem}{$_} } "dns1", "dns2";
- $toreplace{dnsserver} .= $toreplace{dnsserver} && ',';
-
- #- using peerdns or dns1,dns2 avoid writing a /etc/resolv.conf file.
- $toreplace{peerdns} = "yes";
-
- $toreplace{connection} ||= 'DialupConnection';
- $toreplace{domain} ||= 'localdomain';
- $toreplace{intf} ||= 'ppp0';
- $toreplace{papname} = $o->{modem}{auth} eq 'PAP' && $toreplace{login};
-
- #- 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') {
- #- 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 ($replaced) {
- local *F;
- open F, ">$secrets" or die "Can't open $secrets: $!";
- print F @l;
- } else {
- local *F;
- open F, ">>$secrets" or die "Can't open $secrets: $!";
- print F "$toreplace{login} ppp0 \"$toreplace{passwd}\"\n";
- }
- #- restore access right to secrets file, just in case.
- chmod 0600, $secrets;
- } #- CHAP is not supported by initscripts, need patching before doing more on that here!
-
- #-install_any::template2userfile($o->{prefix}, "$ENV{SHARE_PATH}/kppprc.in", ".kde/share/config/kppprc", 1, %toreplace);
- commands::mkdir_("-p", "$o->{prefix}/usr/share/config");
- template2file("$ENV{SHARE_PATH}/kppprc.in", "$o->{prefix}/usr/share/config/kppprc", %toreplace);
-
- miscellaneousNetwork($o);
-}
#------------------------------------------------------------------------------
sub installCrypto {
@@ -885,12 +774,7 @@ sub configureXAfter {
}
#------------------------------------------------------------------------------
-sub miscellaneousNetwork {
- my ($o) = @_;
- setVarsInSh ("$o->{prefix}/etc/profile.d/proxy.sh", $o->{miscellaneous}, qw(http_proxy ftp_proxy));
- setVarsInCsh("$o->{prefix}/etc/profile.d/proxy.csh", $o->{miscellaneous}, qw(http_proxy ftp_proxy));
-}
-
+# miscellaneousNetwork moved to any
#------------------------------------------------------------------------------
sub miscellaneous {
my ($o) = @_;
diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm
index a5c22274e..2a0593834 100644
--- a/perl-install/install_steps_interactive.pm
+++ b/perl-install/install_steps_interactive.pm
@@ -564,40 +564,7 @@ You may also enter the IP address of the gateway if you have one"),
}
#------------------------------------------------------------------------------
-sub pppConfig {
- my ($o) = @_;
- my $m = $o->{modem} ||= {};
-
- unless ($m->{device} || $::expert && !$o->ask_yesorno('', _("Try to find a modem?"), 1)) {
- eval { modules::load("serial"); };
- detect_devices::probeSerialDevices();
- foreach (0..3) {
- next if $o->{mouse}{device} =~ /ttyS$_/;
- detect_devices::hasModem("/dev/ttyS$_") and $m->{device} = "ttyS$_", last;
- }
- }
-
- $m->{device} ||= $o->set_help('selectSerialPort') &&
- $o->ask_from_listf('', _("Please choose which serial port your modem is connected to."),
- \&mouse::serial_port2text,
- [ grep { $_ ne $o->{mouse}{device} } mouse::serial_ports ]);
-
- $o->set_help('configureNetworkISP');
- install_steps::pppConfig($o) if $o->ask_from_entries_refH('',
- _("Dialup options"), [
-_("Connection name") => \$m->{connection},
-_("Phone number") => \$m->{phone},
-_("Login ID") => \$m->{login},
-_("Password") => { val => \$m->{passwd}, hidden => 1 },
-_("Authentication") => { val => \$m->{auth}, list => [ __("PAP"), __("CHAP"), __("Terminal-based"), __("Script-based") ] },
-_("Domain name") => \$m->{domain},
-#-$::expert ? ( #- It is not apropriate to remove DNS as kppp need them! only available for "ifup ppp0"
-_("First DNS Server") => \$m->{dns1},
-_("Second DNS Server") => \$m->{dns2},
-#-) : (),
- ]);
-}
-
+#-pppConfig moved to any.pm
#------------------------------------------------------------------------------
sub installCrypto {
my ($o) = @_;