mirror of
https://github.com/YunoHost-Apps/gitlab-runner_ynh.git
synced 2024-09-03 19:15:58 +02:00
89 lines
3.1 KiB
Bash
Executable file
89 lines
3.1 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# LOAD SETTINGS
|
|
#=================================================
|
|
ynh_script_progression --message="Loading installation settings..."
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
architecture=$(ynh_app_setting_get --app=$app --key=architecture)
|
|
|
|
#=================================================
|
|
# ENSURE DOWNWARD COMPATIBILITY
|
|
#=================================================
|
|
ynh_script_progression --message="Ensuring downward compatibility..."
|
|
|
|
# NOTING TO DO HERE YET
|
|
|
|
#=================================================
|
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
|
#=================================================
|
|
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
|
|
|
|
# Backup the current version of the app
|
|
ynh_backup_before_upgrade
|
|
ynh_clean_setup () {
|
|
# restore it if the upgrade fails
|
|
ynh_restore_upgradebackup
|
|
}
|
|
# Exit if an error occurs during the execution of the script
|
|
ynh_abort_if_errors
|
|
|
|
#=================================================
|
|
# STANDARD UPGRADE STEPS
|
|
#=================================================
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
#=================================================
|
|
ynh_script_progression --message="Upgrading source files..."
|
|
|
|
update_src_version() {
|
|
source ./upgrade.d/upgrade.last.sh
|
|
cp ../conf/$architecture.src.default ../conf/$architecture.src
|
|
ynh_replace_string --match_string="__VERSION__" --replace_string="$gitlab_runner_version" --target_file="../conf/$architecture.src"
|
|
ynh_replace_string --match_string="__SOURCE_FILENAME__" --replace_string="$gitlab_runner_filename" --target_file="../conf/$architecture.src"
|
|
|
|
if [ $architecture = "x86-64" ]; then
|
|
ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_runner_x86_64_source_sha256" --target_file="../conf/$architecture.src"
|
|
elif [ $architecture = "i386" ]; then
|
|
ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_runner_i386_source_sha256" --target_file="../conf/$architecture.src"
|
|
elif [ $architecture = "arm" ]; then
|
|
ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_runner_arm_source_sha256" --target_file="../conf/$architecture.src"
|
|
fi
|
|
}
|
|
|
|
update_src_version
|
|
|
|
tempdir="$(mktemp -d)"
|
|
|
|
ynh_setup_source --dest_dir=$tempdir --source_id=$architecture
|
|
|
|
dpkg -i $tempdir/$gitlab_runner_filename
|
|
|
|
#=================================================
|
|
# UPGRADE DEPENDENCIES
|
|
#=================================================
|
|
ynh_script_progression --message="Upgrading dependencies..."
|
|
|
|
ynh_install_app_dependencies $pkg_dependencies
|
|
|
|
#=================================================
|
|
# ADVERTISE SERVICE IN ADMIN PANEL
|
|
#=================================================
|
|
|
|
yunohost service add $app
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Upgrade of $app completed" --last
|