summaryrefslogtreecommitdiff
path: root/src/opt/vyatta/sbin/vyos-persistpath
blob: d7199b09adf39402b8a5de5b1b0a0f7dbe2b4b61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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