diff options
-rw-r--r-- | Makefile.am | 1 | ||||
-rwxr-xr-x | scripts/install/install-image-existing | 6 | ||||
-rwxr-xr-x | scripts/vyatta-update-grub.pl | 2 | ||||
-rwxr-xr-x | scripts/vyos-persistpath | 19 |
4 files changed, 23 insertions, 5 deletions
diff --git a/Makefile.am b/Makefile.am index 5445f9cd..169df296 100644 --- a/Makefile.am +++ b/Makefile.am @@ -87,6 +87,7 @@ sbin_SCRIPTS += scripts/vyatta-update-grub.pl sbin_SCRIPTS += scripts/vyos-intfwatchd sbin_SCRIPTS += scripts/ec2-check.pl sbin_SCRIPTS += scripts/is_port_available.pl +sbin_SCRIPTS += scripts/vyos-persistpath sbin_PROGRAMS = src/valid_address sbin_PROGRAMS += src/local_ip diff --git a/scripts/install/install-image-existing b/scripts/install/install-image-existing index 1c90df83..4c6b601b 100755 --- a/scripts/install/install-image-existing +++ b/scripts/install/install-image-existing @@ -110,13 +110,11 @@ fi echo "OK. This image will be named: $NEWNAME" # this is the default if current install is union -BOOT_DIR=/live/image/boot + if [ "$CUR_INSTALL" == 'old' ]; then BOOT_DIR=/boot elif [ "$CUR_INSTALL" == 'union' ]; then - # I'm not proud of this... - BOOT_DEVICE=`grep -o 'upperdir=/live/persistence/[^/]*/boot' /proc/mounts | cut -d / -f 4` - BOOT_DIR="/lib/live/mount/persistence/$BOOT_DEVICE/boot" + BOOT_DIR=`/opt/vyatta/sbin/vyos-persistpath`/boot else echo 'Invalid current install type. Exiting...' exit 1 diff --git a/scripts/vyatta-update-grub.pl b/scripts/vyatta-update-grub.pl index a9e646ed..e4110ee0 100755 --- a/scripts/vyatta-update-grub.pl +++ b/scripts/vyatta-update-grub.pl @@ -25,7 +25,7 @@ use warnings; use Getopt::Long; use File::Temp qw/ :mktemp /; -my $UNION_BOOT_DIR = '/live/image/boot'; +my $UNION_BOOT_DIR = `/opt/vyatta/sbin/vyos-persistpath` . '/boot'; my $UNION_GRUB_CFG_DIR = "$UNION_BOOT_DIR/grub"; my $DISK_BOOT_DIR = '/boot'; my $DISK_GRUB_CFG_DIR= '/boot/grub'; diff --git a/scripts/vyos-persistpath b/scripts/vyos-persistpath new file mode 100755 index 00000000..d7199b09 --- /dev/null +++ b/scripts/vyos-persistpath @@ -0,0 +1,19 @@ +#!/bin/bash + +if grep -q -e '^overlay.*/filesystem.squashfs' /proc/mounts; then + # Live CD boot + exit 2 + +elif grep -q 'upperdir=/live/persistence/' /proc/mounts && egrep -q 'overlay / overlay ' /proc/mounts; then + # union boot + + boot_device=`grep -o 'upperdir=/live/persistence/[^/]*/boot' /proc/mounts | cut -d / -f 4` + persist_path="/lib/live/mount/persistence/$boot_device" + + echo $persist_path + exit 0 +else + # old style boot + + exit 1 +fi
\ No newline at end of file |