summaryrefslogtreecommitdiffstats
path: root/bin/drakconnect
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-03-14 12:09:45 +0000
committerOlivier Blin <oblin@mandriva.com>2008-03-14 12:09:45 +0000
commit23766c96f3a441a868e0d20fdd0b00f0a79d083f (patch)
treeacf857dd3601cf6ec139db81daab0c20e6115691 /bin/drakconnect
parent1fa34a312c4f561564d0ac9b659afebefb14ae96 (diff)
downloaddrakx-net-23766c96f3a441a868e0d20fdd0b00f0a79d083f.tar
drakx-net-23766c96f3a441a868e0d20fdd0b00f0a79d083f.tar.gz
drakx-net-23766c96f3a441a868e0d20fdd0b00f0a79d083f.tar.bz2
drakx-net-23766c96f3a441a868e0d20fdd0b00f0a79d083f.tar.xz
drakx-net-23766c96f3a441a868e0d20fdd0b00f0a79d083f.zip
move --del part in new network::drakconnect::delete
Diffstat (limited to 'bin/drakconnect')
-rwxr-xr-xbin/drakconnect63
1 files changed, 4 insertions, 59 deletions
diff --git a/bin/drakconnect b/bin/drakconnect
index 8ce0420..749421f 100755
--- a/bin/drakconnect
+++ b/bin/drakconnect
@@ -64,7 +64,10 @@ $::Wizard_pix_up = "drakconnect";
local $_ = join '', @ARGV;
/--skip-wizard/ and manage();
/--add/ and add_intf();
-/--del/ and del_intf();
+if (/--del/) {
+ require network::drakconnect::delete;
+ network::drakconnect::delete::del_intf($in, $net, $modules_conf);
+}
if (/--internet/) {
require network::drakconnect::global;
network::drakconnect::global::configure_net($in, $net);
@@ -590,64 +593,6 @@ sub add_intf() {
$in->exit(0);
}
-sub del_intf() {
- my ($intf2delete, $failure);
- if (!keys %{$net->{ifcfg}}) {
- $in->ask_warn(N("Error"), N("No ethernet network adapter has been detected on your system. Please run the hardware configuration tool."));
- $in->exit(0);
- }
- require wizards;
- my $wiz = wizards->new(
- {
- defaultimage => "drakconnect",
- name => N("Remove a network interface"),
- pages => {
- welcome => {
- no_back => 1,
- name => N("Select the network interface to remove:"),
- data => [ { label => N("Net Device"), val => \$intf2delete, allow_empty_list => 1,
- list => [ keys %{$net->{ifcfg}} ],
- format => sub {
- my $type = network::tools::get_interface_type($net->{ifcfg}{$_[0]});
- $names{$_[0]} || ($type ? "$type ($_[0])" : $_[0]);
- }
- }
- ],
- post => sub {
- !$::testing and eval {
- if (member($intf2delete, qw(adsl modem))) {
- eval { rm_rf("/etc/ppp/peers/ppp0") };
- eval { rm_rf("/etc/sysconfig/network-scripts/ifcfg-ppp0") };
- }
- if ($intf2delete eq 'adsl') {
- eval { rm_rf("/etc/sysconfig/network-scripts/ifcfg-sagem") };
- } elsif ($intf2delete eq 'isdn') {
- eval { rm_rf("/etc/sysconfig/network-scripts/ifcfg-ippp0") };
- } else {
- system("ifdown $intf2delete");
- eval { rm_rf("/etc/sysconfig/network-scripts/$intf2delete") };
- eval { rm_rf("/etc/sysconfig/network-scripts/ifcfg-$intf2delete") };
- }
- };
- $failure = $@;
- network::network::reload_net_applet();
- return "end";
- },
- },
- end => {
- name => sub {
- $failure ?
- N("An error occurred while deleting the \"%s\" network interface:\n\n%s", $intf2delete, $failure)
- : N("Congratulations, the \"%s\" network interface has been successfully deleted", $intf2delete);
- },
- end => 1,
- },
- },
- });
- $wiz->safe_process($in);
- $in->exit(0);
-}
-
sub get_intf_ip {
my ($interface) = @_;
my ($ip, $state, $mask);