summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorThomas Jepp <tom@tomjepp.co.uk>2016-02-03 20:08:16 +0000
committerThomas Jepp <tom@tomjepp.co.uk>2016-02-03 20:08:16 +0000
commitf54bad96cef6ed52547151bc3a7ef64377f16c3e (patch)
treea9234409c2eb66af7cc9429a110531712fa569c0 /scripts
parentac29f8f49a1ee620d07c3c6bdaec97afaeb1ad27 (diff)
downloadvyatta-cfg-system-f54bad96cef6ed52547151bc3a7ef64377f16c3e.tar.gz
vyatta-cfg-system-f54bad96cef6ed52547151bc3a7ef64377f16c3e.zip
Add vyos-persistpath and update install-image-existing and vyatta-update-grub.pl to use it.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/install/install-image-existing6
-rwxr-xr-xscripts/vyatta-update-grub.pl2
-rwxr-xr-xscripts/vyos-persistpath19
3 files changed, 22 insertions, 5 deletions
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