summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorKim Hagen <kim.sidney@gmail.com>2016-02-01 13:14:42 -0500
committerKim Hagen <kim.sidney@gmail.com>2016-02-01 13:14:42 -0500
commitd35d8d1f937cbf764c67c2fc23b8dbaf18707984 (patch)
tree53a4c5c1ec43ee2cc1913683eb232f970178d7e3 /components
parent940b1bfa23055819e02857187c51827b9a0657ba (diff)
downloadlive-boot-d35d8d1f937cbf764c67c2fc23b8dbaf18707984.tar.gz
live-boot-d35d8d1f937cbf764c67c2fc23b8dbaf18707984.zip
Add vyos config mounting script.
Diffstat (limited to 'components')
-rwxr-xr-xcomponents/9990-main.sh1
-rwxr-xr-xcomponents/9990-vyos.sh52
2 files changed, 53 insertions, 0 deletions
diff --git a/components/9990-main.sh b/components/9990-main.sh
index 512c624..b324fde 100755
--- a/components/9990-main.sh
+++ b/components/9990-main.sh
@@ -191,6 +191,7 @@ Live ()
Netbase
Swap
+ Vyos
exec 1>&6 6>&-
exec 2>&7 7>&-
diff --git a/components/9990-vyos.sh b/components/9990-vyos.sh
new file mode 100755
index 0000000..b0afcb5
--- /dev/null
+++ b/components/9990-vyos.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+#set -e
+
+Vyos ()
+{
+
+# live-initramfs header
+
+ . /scripts/functions
+ . /lib/live/boot/9990-initramfs-tools.sh
+
+# live-initramfs script
+
+# try floppy
+# if we do not discover an fd device, try loading the floppy module
+grep -q fd /proc/devices || modprobe -q floppy 2>/dev/null
+if grep -q fd /proc/devices
+then
+ mkdir -p /root/media/floppy
+ mount /dev/fd0 /root/media/floppy -o sync,noatime,noexec,nosuid,nodev
+fi 2>/dev/null
+
+# bind the vyatta config directory with the following precedence
+# 1) backing store if present
+# 2) floppy if present
+# 3) create live/"overlay" which may or maynot be on a non-volatile device
+# but is certainly read-write
+
+
+unioncfgpath="$(trim_path /root/lib/live/mount/medium/${PERSISTENCE_PATH}/rw)"
+
+if [ -d /root/opt/vyatta/etc/config ]
+then
+ if [ -d ${unioncfgpath}/config ]
+ then
+ log_begin_msg "Using ${unioncfgpath}/config..."
+ mount -o bind ${unioncfgpath}/config /root/opt/vyatta/etc/config
+ log_end_msg
+ elif [ -d /root/media/floppy/config ]
+ then
+ log_begin_msg "Using /root/media/floppy/config..."
+ mount -o bind /root/media/floppy/config /root/opt/vyatta/etc/config
+ log_end_msg
+ else
+ log_begin_msg "Creating ${unioncfgpath}/config..."
+ cp -a /root/opt/vyatta/etc/config ${unioncfgpath} >/dev/null 2>&1
+ mount -o bind ${unioncfgpath}/config /root/opt/vyatta/etc/config
+ log_end_msg
+ fi
+fi
+}