1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/owncloud_ynh.git synced 2024-09-03 19:56:25 +02:00
owncloud_ynh/scripts/upgrade
Éric Gaspar d6784e378c cleaning
2024-07-19 10:16:01 +02:00

65 lines
2 KiB
Bash

#!/bin/bash
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression "Stopping $app's systemd service..."
ynh_systemctl --action="stop" --log_path="systemd"
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression "Ensuring downward compatibility..."
if [[ -f "$install_dir/ocis.yaml" ]]; then
mv "$install_dir/ocis.yaml" "$data_dir/config/ocis.yaml"
fi
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression "Upgrading source files..."
ynh_setup_source --dest_dir="$install_dir" --full_replace
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
chmod +x $install_dir/ocis
#=================================================
# 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="File sharing platform" --log="/var/log/$app/$app.log"
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression "Adding $app's configuration..."
ynh_config_add --template=".env" --destination="$install_dir/ocis.env"
chmod 400 "$install_dir/ocis.env"
chown $app:$app "$install_dir/ocis.env"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression "Starting $app's systemd service..."
ynh_systemctl --action="start" --log_path="systemd"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Upgrade of $app completed"