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

118 lines
3.3 KiB
Text
Raw Normal View History

2017-01-28 23:41:18 +01:00
#!/bin/bash
2018-03-24 01:39:26 +01:00
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
2017-02-11 19:54:05 +01:00
source /usr/share/yunohost/helpers
2018-03-24 01:39:26 +01:00
#=================================================
2020-04-02 16:34:46 +02:00
# MANAGE SCRIPT FAILURE
2018-03-24 01:39:26 +01:00
#=================================================
2017-02-11 23:18:15 +01:00
2020-04-02 16:34:46 +02:00
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
2017-01-28 23:41:18 +01:00
2020-04-02 16:34:46 +02:00
#=================================================
# Retrieve arguments
#=================================================
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC
app=$YNH_APP_INSTANCE_NAME
2017-01-28 23:41:18 +01:00
2018-03-24 01:39:26 +01:00
#=================================================
2020-04-02 16:34:46 +02:00
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
2018-03-24 01:39:26 +01:00
#=================================================
2020-04-02 16:34:46 +02:00
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die "This path already contains a folder"
2017-01-28 23:41:18 +01:00
2020-04-02 16:34:46 +02:00
# Normalize the url path syntax
path_url=$(ynh_normalize_url_path $path_url)
# Check web path availability
ynh_webpath_available $domain $path_url
# Register (book) web path
ynh_webpath_register $app $domain $path_url
2018-03-24 01:39:26 +01:00
#=================================================
2020-04-02 16:34:46 +02:00
# STORE SETTINGS FROM MANIFEST
2018-03-24 01:39:26 +01:00
#=================================================
2020-04-02 16:34:46 +02:00
ynh_app_setting_set $app path_url $path_url
ynh_app_setting_set $app domain $domain
ynh_app_setting_set $app is_public $is_public
2018-03-24 01:39:26 +01:00
2019-02-24 12:05:20 +01:00
#=================================================
# Install dependency to convert tracks to a readable format for the browser
#=================================================
2020-03-31 02:03:44 +02:00
if [ "$(lsb_release --codename --short)" != "jessie" ]
2019-02-24 12:05:20 +01:00
then
2020-04-02 17:28:53 +02:00
ynh_install_app_dependencies php-sqlite3
2019-02-24 12:05:20 +01:00
else
ynh_install_app_dependencies php5-sqlite
fi
2018-03-24 01:39:26 +01:00
#=================================================
2020-04-02 16:34:46 +02:00
# CREATE DEDICATED USER
2018-03-24 01:39:26 +01:00
#=================================================
2020-04-02 16:34:46 +02:00
# Create a system user
ynh_system_user_create $app
2018-03-24 01:39:26 +01:00
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
2020-04-02 16:34:46 +02:00
ynh_app_setting_set $app final_path $final_path
2018-03-24 01:39:26 +01:00
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source "$final_path"
#=================================================
2020-04-02 16:34:46 +02:00
# Files owned by user app
2018-03-24 01:39:26 +01:00
#=================================================
2020-04-02 16:34:46 +02:00
sudo chown $app:$app $final_path -R
sudo chmod 755 $final_path -R
2018-03-24 01:39:26 +01:00
#=================================================
2020-04-02 16:34:46 +02:00
# NGINX CONFIGURATION
2018-03-24 01:39:26 +01:00
#=================================================
2020-04-02 16:34:46 +02:00
# Create a dedicated nginx config
ynh_add_nginx_config
2018-03-24 01:39:26 +01:00
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
# Create a dedicated php-fpm config
ynh_add_fpm_config
#=================================================
# SETUP SSOWAT
#=================================================
if [ $is_public -eq 0 ]
then # Remove the public access
ynh_app_setting_delete $app skipped_uris
fi
# Make app public if necessary
if [ $is_public -eq 1 ]
2017-01-28 23:41:18 +01:00
then
2020-04-02 16:34:46 +02:00
# unprotected_uris allows SSO credentials to be passed anyway.
2018-03-24 01:39:26 +01:00
ynh_app_setting_set $app unprotected_uris "/"
2017-01-28 23:41:18 +01:00
fi
2018-03-24 01:39:26 +01:00
#=================================================
# RELOAD NGINX
#=================================================
2017-02-11 19:54:05 +01:00
2020-04-02 16:34:46 +02:00
systemctl reload nginx