feat(install): Add optional install script execution for packages
This commit introduces the ability for packages to define an optional install script within the `packages.conf` file. The `install.sh` script will now parse this new field and execute the provided script after all associated package files have been downloaded. The `packages.conf` documentation has been updated to reflect the new format, including the optional fifth field for the install script.
This commit is contained in:
16
install.sh
16
install.sh
@@ -47,7 +47,8 @@ process_package() {
|
||||
display_name=$(echo "${config_value}" | cut -d'|' -f1)
|
||||
remote_version=$(echo "${config_value}" | cut -d'|' -f2)
|
||||
description=$(echo "${config_value}" | cut -d'|' -f3)
|
||||
urls_to_download=$(echo "${config_value}" | cut -d'|' -f4-)
|
||||
urls_to_download=$(echo "${config_value}" | cut -d'|' -f4)
|
||||
install_script=$(echo "${config_value}" | cut -d'|' -f5) # Optional install script
|
||||
|
||||
read -r -a urls_to_download_array <<< "$urls_to_download"
|
||||
|
||||
@@ -101,6 +102,16 @@ process_package() {
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ -n "${install_script}" ]]; then
|
||||
echo "[⚙️] Running install script for '${choice_key}'..."
|
||||
eval "${install_script}"
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "[✅] Install script completed successfully."
|
||||
else
|
||||
echo "[❌] Install script failed with exit code $?."
|
||||
fi
|
||||
fi
|
||||
echo "[📦] Package processing complete for '${choice_key}'."
|
||||
}
|
||||
|
||||
@@ -173,7 +184,8 @@ for i in "${!ordered_keys[@]}"; do
|
||||
display_name=$(echo "${config_value}" | cut -d'|' -f1)
|
||||
remote_version=$(echo "${config_value}" | cut -d'|' -f2)
|
||||
description=$(echo "${config_value}" | cut -d'|' -f3)
|
||||
urls=$(echo "${config_value}" | cut -d'|' -f4-)
|
||||
urls=$(echo "${config_value}" | cut -d'|' -f4)
|
||||
# install_script=$(echo "${config_value}" | cut -d'|' -f5) # Not used for display in menu
|
||||
read -r -a url_array <<< "$urls"
|
||||
main_script_filename=$(basename "${url_array[0]}")
|
||||
local_version=$(get_local_version "${main_script_filename}")
|
||||
|
||||
Reference in New Issue
Block a user