As a spinoff of https://vyos.dev/T5690 this feature request adds variable vyos_persistence_dir:
if test -z "$vyos_persistence_dir" ; then UNION_NAME=$(cat /proc/cmdline | sed -e s+^.*vyos-union=++ | sed -e 's/ .*$//') declare -x -r vyos_persistence_dir="/usr/lib/live/mount/persistence/${UNION_NAME}" fi
And improves the original definition of variable vyos_rootfs_dir by only selecting loop0 in case there are multiple squashfs mounts available:
if test -z "$vyos_rootfs_dir" ; then ROOTFS=$(mount -t squashfs | grep loop0 | cut -d' ' -f3) declare -x -r vyos_rootfs_dir="${ROOTFS}" fi
The above changes goes into https://github.com/vyos/vyatta-op/blob/current/etc/default/vyatta.in