pxe: do the trick for rw snapshots dir

This commit is contained in:
pedro 2024-09-25 20:16:03 -03:00
parent 52e99064c6
commit ecb9b1649b
2 changed files with 15 additions and 0 deletions

View File

@ -272,6 +272,10 @@ cd /mnt
# detect pxe env
if [ -d /run/live/medium ]; then
config_path='/run/live/medium/settings.ini'
# debian live nfs path is readonly, do a trick
# to make snapshots subdir readwrite
nfs_host="\$(df -hT | grep nfs | cut -f1 -d: | head -n1)"
mount \${nfs_host}:/snapshots /run/live/medium/snapshots
else
config_path='/mnt/settings.ini'
fi

View File

@ -23,9 +23,20 @@ backup_file() {
install_nfs() {
backup_file /etc/exports
# debian live nfs path is readonly, do a trick
# to make snapshots subdir readwrite
if grep -q "/snapshots" /proc/mounts; then
mount --bind "${nfs_path}/snapshots" "/snapshots"
fi
cat > /etc/exports <<END
${nfs_path} ${nfs_allowed_lan}(rw,sync,no_subtree_check,no_root_squash)
/snapshots ${nfs_allowed_lan}(rw,sync,no_subtree_check,no_root_squash)
END
# reload nfs exports
exportfs -vra
# append live directory, which is expected by the debian live env
mkdir -p "${nfs_path}/live"
mkdir -p "${nfs_path}/snapshots"