Implement update script support

This commit is contained in:
Dennis ten Hoove 2024-06-21 06:29:25 +02:00
parent 1210a3828a
commit e9c4cb4d7b
No known key found for this signature in database
GPG key ID: 2BA91DC2563B83D1
2 changed files with 14 additions and 0 deletions

7
arkdep
View file

@ -862,6 +862,13 @@ deploy () {
# Image deployment finished, allow for interupts again
trap 'echo "User interupt received, canceling cleanup step"; exit 4' INT TERM
# Check if there is an update script available
if tar -xf $arkdep_dir/cache/${data[0]}.tar.${data[1]} -C $arkdep_dir/cache/ ./${data[0]}-update.sh 2> /dev/null; then
printf '\e[1;34m-->\e[0m\e[1m Running update script\e[0m\n'
# Run the migration script if provided
(source $arkdep_dir/cache/${data[0]}-update.sh)
fi
# Remove tarball if configured to remove
if [[ $remove_tar_after_deployment -eq 1 ]]; then
printf '\e[1;34m-->\e[0m\e[1m Removing tarball from cache\e[0m\n'

View file

@ -314,6 +314,13 @@ if [[ $type == 'archlinux' ]]; then
# Create dir for storing the images
mkdir -p $output_target/$image_name
# Add update script, utilized to perform minor system changes and updates
if [[ -f $variantdir/update.sh ]]; then
printf '\e[1;34m-->\e[0m\e[1m Including update script\e[0m\n'
cp -v $variantdir/update.sh $output_target/$image_name/$image_name-update.sh ||
cleanup_and_quit 'Failed copying update script to image'
fi
# Generate package list
pacman -Q --root=$workdir > $output_target/$image_name.pkgs