summaryrefslogtreecommitdiff
path: root/components/9990-vyos.sh
blob: 4306443fab4b1fce8127219fd7c54f4681fa713e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh

#set -e

Vyos ()
{
	# live-initramfs header
	. /scripts/functions
	. /lib/live/boot/9990-initramfs-tools.sh

	log_begin_msg "Configuring VyOS config path"

	# bind the vyatta config directory with the following precedence
	#	1) backing store if present
	#	2) create live/"overlay" which may or maynot be on a non-volatile device
	#	   but is certainly read-write

	VYOS_MOUNT_DIR="$(echo ${VYOS_MOUNT} | sed 's/live/mount/')"
	unioncfgpath="$(trim_path /root/lib/live/${VYOS_MOUNT_DIR}/${PERSISTENCE_PATH}/rw)"

	if [ -d /root/opt/vyatta/etc/config ]
	then
		if [ -d ${unioncfgpath}/config
		then
			mount -o bind ${unioncfgpath}/config /root/opt/vyatta/etc/config
		else
			cp -a /root/opt/vyatta/etc/config ${unioncfgpath} >/dev/null 2>&1
			mount -o bind ${unioncfgpath}/config /root/opt/vyatta/etc/config
		fi
	fi
	log_end_msg
}