Add load_extensions

This commit is contained in:
Dennis ten Hoove 2024-04-03 21:16:07 +02:00
parent 0a9c2d7398
commit 402d80d66b

15
arkdep
View file

@ -85,6 +85,7 @@ if [[ ! $1 == 'init' ]]; then
[[ -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_image_always_default+x} ]] && latest_image_always_default=0 && printf '\e[1;33m<!>\e[0m\e[1m latest_image_always_default not defined in config, using default\e[0m\n'
[[ -z ${var_migrate_files+x} ]] && var_migrate_files=('/usrlocal' '/usrliblocale' '/opt' '/srv' '/nm-system-connections' '/lib/AccountsService' '/lib/bluetooth' '/lib/NetworkManager' '/lib/arkane') && printf '\e[1;33m<!>\e[0m\e[1m var_migrate_files not defined in config, using default\e[0m\n'
[[ -z ${load_extensions+x} ]] && load_extensions=0 && printf '\e[1;33m<!>\e[0m\e[1m load_extensions not defined in config, using default\e[0m\n'
fi
## Common functions
@ -299,6 +300,7 @@ init () {
$arkdep_dir/templates \
$arkdep_dir/overlay \
$arkdep_dir/keys \
$arkdep_dir/extensions \
$arkdep_dir/shared ||
cleanup_and_quit "Failed to create $arkdep_dir and related directories"
@ -359,6 +361,9 @@ init () {
# List of files and folders to be recursively copied over from var to new var, path should start with /
var_migrate_files=('/usrlocal' '/usrliblocale' '/opt' '/srv' '/nm-system-connections' '/lib/AccountsService' '/lib/bluetooth' '/lib/NetworkManager' '/lib/arkane')
# Load script extensions from /arkdep/extensions
load_extensions=0
END
# Add default bootloader config file
@ -855,6 +860,16 @@ deploy () {
--force \
$arkdep_boot/arkdep/${data[0]}/initramfs-linux.img || cleanup_and_quit 'Failed to generate initramfs'
if [[ $load_extensions -eq 1 ]]; then
printf '\e[1;34m-->\e[0m\e[1m Running extensions\e[0m\n'
extensions=($(ls $arkdep_dir/extensions/))
for extension in ${extensions[@]}; do
(source $arkdep_dir/extensions/$extension)
done
fi
# Add to database
printf '\e[1;34m-->\e[0m\e[1m Updating database\e[0m\n'
printf "${data[0]}\n$(cat $(readlink -m $arkdep_dir/tracker))" |