diff --git a/arkdep b/arkdep index a8e9b02..2268a97 100755 --- a/arkdep +++ b/arkdep @@ -82,6 +82,7 @@ if [[ ! $1 == 'init' ]]; then [[ -z ${minimum_available_root_storage+x} ]] && minimum_available_root_storage=12582912 && printf '\e[1;33m\e[0m\e[1m minimum_available_root_storage not defined in config, using default\e[0m\n' [[ -z ${update_cpu_microcode+x} ]] && update_cpu_microcode=1 && printf '\e[1;33m\e[0m\e[1m update_cpu_microcode not defined in config, using default\e[0m\n' [[ -z ${backup_user_accounts+x} ]] && backup_user_accounts=0 && printf '\e[1;33m\e[0m\e[1m backup_user_accounts not defined in config, using default\e[0m\n' + [[ -z ${latest_deployment_always_default+x} ]] && latest_deployment_always_default=0 && printf '\e[1;33m\e[0m\e[1m latest_deployment_always_default not defined in config, using default\e[0m\n' fi ## Common functions @@ -297,6 +298,9 @@ init () { # Automatically make a copy of passwd, shadow and group files if they differ from overlay backup_user_accounts=0 + + # Ensure latest deployment is always the default systemd-boot boot entry + latest_deployment_always_default=0 END # Add default bootloader config file @@ -537,6 +541,13 @@ deploy () { # Lets ensure the requested image is not already deployed if [[ -e $arkdep_dir/deployments/${data[0]} ]]; then + + # Lets ensure the latest deployment is active, even if it is already deployed + if [[ latest_deployment_always_default -eq 1 ]] && [[ ! $ARKDEP_NO_BOOTCTL -eq 1 ]]; then + # Allow it to error, it is no big deal if it does + bootctl set-default ${data[0]}.conf || printf '\e[1;33m\e[0m\e[1m Failed to set default bootloader entry on latest_deployment_always_default\e[0m\n' + fi + printf "\e[1;33m\e[0m\e[1m ${data[0]} is already deployed, canceling deployment\e[0m\n" exit 0 fi