12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- #!/bin/bash
- ynh_setting() {
- app=${1}
- setting=${2}
- sudo grep "^${setting}:" "/etc/yunohost/apps/${app}/settings.yml" | sed s/^[^:]\\+:\\s*[\"\']\\?// | sed s/\\s*[\"\']\$//
- }
- #=================================================
- # LOAD SETTINGS
- #=================================================
- app=$YNH_APP_INSTANCE_NAME
- domain=$(ynh_app_setting_get $app domain)
- path_url=$(ynh_app_setting_get $app path)
- is_public=$(ynh_app_setting_get $app is_public)
- final_path=$(ynh_app_setting_get $app final_path)
- server_name=$(ynh_app_setting_get $app server_name)
- #=================================================
- # SPECIAL UPGRADE FOR VERSIONS < 1.2.0
- #=================================================
- # Apply renaming that occured in v1.2.0 ("vpnadmin" -> "${app}")
- if [ -f /etc/nginx/conf.d/${domain}.d/vpnadmin.conf ]; then
- sudo sed "s|/var/www/vpnadmin/|/var/www/${app}/|g" -i "/etc/nginx/conf.d/${domain}.d/vpnadmin.conf"
- sudo sed "s|vpnadmin.sock|${app}.sock|g" -i "/etc/nginx/conf.d/${domain}.d/vpnadmin.conf"
- mv /etc/nginx/conf.d/${domain}.d/vpnadmin.conf /etc/nginx/conf.d/${domain}.d/${app}.conf
- fi
- if [ -f /etc/php5/fpm/pool.d/vpnadmin.conf ]; then
- sudo sed "s|/var/www/vpnadmin/|/var/www/${app}/|g" -i /etc/php5/fpm/pool.d/vpnadmin.conf
- sudo sed "s|vpnadmin.sock|${app}.sock|g" -i /etc/php5/fpm/pool.d/vpnadmin.conf
- mv /etc/php5/fpm/pool.d/vpnadmin.conf /etc/php5/fpm/pool.d/${app}.conf
- fi
- test -d /var/www/vpnadmin && mv /var/www/vpnadmin /var/www/${app}
- # Versions known to have a buggy backup script
- buggy_versions="1.0.0 1.0.1 1.1.0"
- curr_version=$(read_manifest version)
- if echo $buggy_versions | grep -w $curr_version > /dev/null; then
- echo "Your current version of ${app} is very old: ${curr_version}. Please ignore the next warning." >&2
- fi
- #=================================================
- # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
- #=================================================
- ynh_backup_before_upgrade
- ynh_clean_setup () {
- ynh_restore_upgradebackup
- }
- # Exit if an error occurs during the execution of the script
- ynh_abort_if_errors
- #=================================================
- # RELOAD RELEVANT SERVICES
- #=================================================
- ynh_systemctl reload php5-fpm
- ynh_systemctl reload nginx
- exit 0
|