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 # detect pxe env
if [ -d /run/live/medium ]; then if [ -d /run/live/medium ]; then
config_path='/run/live/medium/settings.ini' 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 else
config_path='/mnt/settings.ini' config_path='/mnt/settings.ini'
fi fi

View File

@ -23,9 +23,20 @@ backup_file() {
install_nfs() { install_nfs() {
backup_file /etc/exports 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 cat > /etc/exports <<END
${nfs_path} ${nfs_allowed_lan}(rw,sync,no_subtree_check,no_root_squash) ${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 END
# reload nfs exports
exportfs -vra
# append live directory, which is expected by the debian live env # append live directory, which is expected by the debian live env
mkdir -p "${nfs_path}/live" mkdir -p "${nfs_path}/live"
mkdir -p "${nfs_path}/snapshots" mkdir -p "${nfs_path}/snapshots"