From 6626fd4c393477c4686a7823c03660a983c3accf Mon Sep 17 00:00:00 2001 From: Eugeni Dodonov Date: Fri, 14 Aug 2009 15:31:28 +0000 Subject: Updated for new netprofile. --- lib/network/network.pm | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) (limited to 'lib/network/network.pm') diff --git a/lib/network/network.pm b/lib/network/network.pm index 79c63b0..8170d4a 100644 --- a/lib/network/network.pm +++ b/lib/network/network.pm @@ -399,43 +399,26 @@ sub gateway { sub netprofile_set { my ($net, $profile) = @_; $net->{PROFILE} = $profile; - system('/sbin/set-netprofile', $net->{PROFILE}); + system('/sbin/netprofile', 'switch', $net->{PROFILE}); log::explanations(qq(Switching to "$net->{PROFILE}" profile)); } -sub netprofile_save { - my ($net) = @_; - system('/sbin/save-netprofile', $net->{PROFILE}); - log::explanations(qq(Saving "$net->{PROFILE}" profile)); -} - sub netprofile_delete { my ($profile) = @_; - return if !$profile || $profile eq "default"; - rm_rf("$::prefix/etc/netprofile/profiles/$profile"); + return if !$profile; + system('/sbin/netprofile', 'delete', $profile); log::explanations(qq(Deleting "$profile" profile)); } -sub netprofile_clone { - my ($source_profile, $dest_profile) = @_; - return if !$dest_profile || $dest_profile eq "default" || member($dest_profile, netprofile_list()); - system('/sbin/clone-netprofile', $source_profile, $dest_profile); - log::explanations(qq("Creating "$dest_profile" profile)); -} - -sub netprofile_add { - my ($net, $profile) = @_; - netprofile_clone($net->{PROFILE}, $profile); -} - sub netprofile_list() { map { if_(m!([^/]*)/$!, $1) } glob("$::prefix/etc/netprofile/profiles/*/"); } sub netprofile_read { my ($net) = @_; - my $config = { getVarsFromSh("$::prefix/etc/netprofile/current") }; - $net->{PROFILE} = $config->{PROFILE} || 'default'; + my $profile = cat_("$::prefix/etc/netprofile/current"); + chomp $profile if $profile; + $net->{PROFILE} = $profile || 'default'; } sub advanced_settings_read { -- cgit v1.2.1