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

71 lines
2.1 KiB
Text
Raw Normal View History

#!/bin/bash
2017-02-06 23:40:55 +01:00
source /usr/share/yunohost/helpers
source _common.sh
2017-02-06 23:40:55 +01:00
ynh_trap_on
2017-02-06 23:40:55 +01:00
export app=$YNH_APP_INSTANCE_NAME
user=$app
2017-02-06 23:50:47 +01:00
export domain=$(ynh_app_setting_get $app domain)
export path=$(ynh_app_setting_get $app path)
export admin=$(ynh_app_setting_get $app admin)
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
export local_path=$(ynh_app_setting_get $app local_path)
2017-02-10 00:50:37 +01:00
export is_public=$(ynh_app_setting_get $app is_public)
is_public=${is_public:-0}
export prefix=$(ynh_app_setting_get $app prefix)
prefix=${prefix:-prefix_}
2017-02-06 23:40:55 +01:00
version=$(ynh_read_json "/etc/yunohost/apps/$app/manifest.json" 'version' 2> /dev/null || echo '2.0.5')
last_version=$(ynh_read_manifest 'version')
2017-02-06 23:40:55 +01:00
ynh_exit_if_up_to_date
ynh_check_var "$app" "app name not set"
ynh_user_exists "$admin" || err "User does not exist: $admin"
ynh_normalize_url_path "$path"
2017-02-06 23:40:55 +01:00
if [ "${version}" = "2.0.5" ]; then
2017-02-06 23:40:55 +01:00
ynh_save_args path is_public prefix
2017-02-06 23:40:55 +01:00
ynh_app_dependencies php5-imap
ynh_system_user_create "$user" "$local_path"
# Move the upload dir to local_path if needed
# The upload dir can't be symlinked in home (not supported by LS)
upload_path=/home/yunohost.app/$app/upload
if [ -h $local_path/upload ]; then
sudo rm $local_path/upload
sudo mv $upload_path $local_path/
fi
2017-02-06 23:40:55 +01:00
ynh_app_setting_delete $app skipped_uris
2017-02-06 23:40:55 +01:00
ynh_sso_access "/index.php?r=admin,/index.php?r=plugins,/scripts"
ynh_configure_php_fpm
ynh_configure_nginx
ynh_configure migrations/2.0.5.sql ./2.0.5.sql
mysql -u $app -p$db_pwd $app < ./2.0.5.sql
fi
# Backup config, plugins and themes and delete previous files
ynh_save_persistent modules themes plugins
ynh_save_persistent data application/config/config.php upload
# Copie new files and restore config, plugins, upload and themes
sudo rm -Rf $local_path
ynh_setup_source "$local_path" "$user"
# Set permissions
2017-02-06 23:40:55 +01:00
ynh_set_default_perm $local_path
sudo chmod -R u+w $local_path/tmp
sudo chmod -R u+w $local_path/upload
sudo chmod -R u+w $local_path/application/config/
2017-02-06 23:40:55 +01:00
# Migrate DB
cd $local_path/application/commands
ynh_exec_as "$app" php console.php update