[arkdep] On layer lock root if required

This commit is contained in:
Dennis ten Hoove 2025-01-21 01:20:16 +01:00
parent f5819bcf95
commit 839cf12126
No known key found for this signature in database
GPG key ID: 2BA91DC2563B83D1

15
arkdep
View file

@ -1323,14 +1323,27 @@ layer () {
fi
fi
# Unlock the partition
# Check if root should be locked again after running
if btrfs property get / 2> /dev/null | grep -q 'ro=true'; then
declare -r lock_when_done=1
fi
# Unlock root
if [[ $lock_when_done -eq 1 ]]; then
btrfs property set -f -ts / ro false ||
cleanup_and_quit 'Failed to unlock root partition'
fi
# Install the packages
$package_layer_command ${progs_clean[@]} ||
cleanup_and_quit 'Failed to install requested packages'
# Lock root if it was previously locked
if [[ $lock_when_done -eq 1 ]]; then
btrfs property set -f -ts / ro true ||
cleanup_and_quit 'Failed to unlock root partition'
fi
# If installation was successful add to layer tracker file
printf "%s\n" "${progs_clean[@]}" >> $arkdep_dir/layer