1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/vore_ynh.git synced 2024-09-03 20:36:07 +02:00
vore_ynh/scripts/upgrade

60 lines
2.1 KiB
Bash
Executable file

#!/bin/bash
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression "Stopping $app's systemd service..."
ynh_systemctl --service=$app --action="stop"
#=================================================
# BUILD APP
#=================================================
ynh_script_progression "Building app..."
# FIXME: this is still supported but the recommendation is now to *always* re-setup the app sources wether or not the upstream sources changed
if ynh_app_upstream_version_changed
then
ynh_go_install
pushd $install_dir
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
git config --system --add safe.directory $install_dir
ynh_hide_warnings git pull https://git.j3s.sh/vore --quiet
ynh_config_add --template="index.tmpl.html" --destination="$install_dir/files/index.tmpl.html"
ynh_hide_warnings ynh_exec_as_app CGO_ENABLED=0 go build -o $install_dir/
popd
ynh_go_remove
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
chmod +x "$install_dir/vore"
fi
#=================================================
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression "Upgrading system configurations related to $app..."
ynh_config_add_nginx
ynh_config_add_systemd
yunohost service add $app --description="Multi-tenant feed reader" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression "Starting $app's systemd service..."
ynh_systemctl --service=$app --action="start"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Upgrade of $app completed"