diff options
-rwxr-xr-x | lib/Vyatta/Misc.pm | 12 | ||||
-rwxr-xr-x | scripts/vyatta-load-config.pl | 7 | ||||
-rwxr-xr-x | scripts/vyatta-save-config.pl | 5 |
3 files changed, 21 insertions, 3 deletions
diff --git a/lib/Vyatta/Misc.pm b/lib/Vyatta/Misc.pm index e184523..4818e65 100755 --- a/lib/Vyatta/Misc.pm +++ b/lib/Vyatta/Misc.pm @@ -30,7 +30,8 @@ our @EXPORT = qw(getInterfaces getIP getNetAddIP get_sysfs_value is_local_address is_primary_address get_ipnet_intf_hash); our @EXPORT_OK = qw(generate_dhclient_intf_files getInterfacesIPadresses - getPortRuleString); + getPortRuleString + get_short_config_path); use Vyatta::Config; use Vyatta::Interface; @@ -105,6 +106,15 @@ sub is_primary_address { return; } +# remove '/opt/vyatta/etc' from begining of config directory path +sub get_short_config_path { + my $cfg_path = shift; + my $shortened_cfg_path = ""; + $shortened_cfg_path = $cfg_path if defined $cfg_path; + $shortened_cfg_path =~ s/^\/opt\/vyatta\/etc//; + return $shortened_cfg_path; +} + sub get_sysfs_value { my ( $intf, $name ) = @_; diff --git a/scripts/vyatta-load-config.pl b/scripts/vyatta-load-config.pl index 116e506..7bf7779 100755 --- a/scripts/vyatta-load-config.pl +++ b/scripts/vyatta-load-config.pl @@ -29,6 +29,7 @@ use Getopt::Long; use Sys::Syslog qw(:standard :macros); use Vyatta::Config; use Vyatta::ConfigLoad; +use Vyatta::Misc qw(get_short_config_path); $SIG{'INT'} = 'IGNORE'; @@ -174,7 +175,11 @@ system("$sbindir/vyatta_config_migrate.pl $load_file"); # note: "load" is now handled in the backend so only "merge" is actually # handled in this script. "merge" hasn't been moved into the backend since # the command itself needs to be revisited after mendocino time frame. -print "Loading configuration from '$load_file'...\n"; + +# when presenting to users, show shortened /config path +my $shortened_load_file = get_short_config_path($load_file); +print "Loading configuration from '$shortened_load_file'...\n"; + my $cobj = new Vyatta::Config; if (!defined($merge)) { # "load" => use backend through API diff --git a/scripts/vyatta-save-config.pl b/scripts/vyatta-save-config.pl index 4af5d97..178eff7 100755 --- a/scripts/vyatta-save-config.pl +++ b/scripts/vyatta-save-config.pl @@ -23,6 +23,7 @@ use strict; use lib "/opt/vyatta/share/perl5"; use Vyatta::ConfigOutput; use File::Sync qw(fsync); +use Vyatta::Misc qw(get_short_config_path); my $etcdir = "/opt/vyatta/etc"; my $bootpath = $etcdir . "/config"; @@ -76,7 +77,9 @@ if ($mode eq 'local' and !($save_file =~ /^\//)) { } my $version_str = `/opt/vyatta/sbin/vyatta_current_conf_ver.pl`; -print "Saving configuration to '$save_file'...\n"; +# when presenting to users, show shortened /config path +my $shortened_save_file = get_short_config_path($save_file); +print "Saving configuration to '$shortened_save_file'...\n"; my $save; if ($mode eq 'local') { |