diff options
author | Kim Hagen <kim.sidney@gmail.com> | 2016-02-08 07:45:00 -0500 |
---|---|---|
committer | Kim Hagen <kim.sidney@gmail.com> | 2016-02-08 07:45:00 -0500 |
commit | 75caf5c06cd8841db4aedd1ef6673f6dbcf74bb2 (patch) | |
tree | 29c2819bb23a4b82be2de8d071e42225878a3fc0 /scripts | |
parent | 3a92c96ba66b256db30b5325267cb123cbe9b7b6 (diff) | |
download | vyatta-op-75caf5c06cd8841db4aedd1ef6673f6dbcf74bb2.tar.gz vyatta-op-75caf5c06cd8841db4aedd1ef6673f6dbcf74bb2.zip |
Fix "show system image version" command.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/vyatta-boot-image.pl | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/scripts/vyatta-boot-image.pl b/scripts/vyatta-boot-image.pl index 52d5198..a4c0169 100755 --- a/scripts/vyatta-boot-image.pl +++ b/scripts/vyatta-boot-image.pl @@ -31,7 +31,7 @@ use File::Copy; # # Constants # -my $UNION_BOOT = '/live/image/boot'; +my $UNION_BOOT = '/lib/live/mount/persistence/boot'; my $UNION_GRUB_CFG = "$UNION_BOOT/grub/grub.cfg"; my $VER_FILE = '/opt/vyatta/etc/version'; my $OLD_IMG_VER_STR = 'Old-non-image-installation'; @@ -226,32 +226,31 @@ sub image_vyatta_version { my ($image_name) = @_; my $vers; - my $dpkg_path = "var/lib/dpkg"; my $image_path; if ($image_name eq $OLD_IMG_VER_STR) { $image_path = ""; } else { - $image_path = "/live/image/boot/$image_name/live-rw"; + $image_path = "/lib/live/mount/persistence/boot/$image_name/rw"; } - $image_path .= "/var/lib/dpkg"; + $image_path .= "/opt/vyatta/etc/version"; if ( -e $image_path ) { - $vers = `dpkg-query --admindir=$image_path --showformat='\${Version}' --show vyatta-version`; + $vers = `cat $image_path | awk '{print \$2}'`; return $vers; } else { if ($image_name eq $OLD_IMG_VER_STR) { return "unknown"; } - my @squash_files = glob("/live/image/boot/$image_name/*.squashfs"); + my @squash_files = glob("/lib/live/mount/persistence/boot/$image_name/*.squashfs"); foreach my $squash_file (@squash_files) { if (-e $squash_file) { system("sudo mkdir /tmp/squash_mount"); system("sudo mount -o loop,ro -t squashfs $squash_file /tmp/squash_mount"); - $image_path = "/tmp/squash_mount/var/lib/dpkg"; - my $vers = `dpkg-query --admindir=$image_path --showformat='\${Version}' --show vyatta-version`; + $image_path = "/tmp/squash_mount/opt/vyatta/etc/version"; + my $vers = `cat $image_path | awk '{print \$2}'`; system("sudo umount /tmp/squash_mount"); system("sudo rmdir /tmp/squash_mount"); return $vers; |