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

[Fix] Some breacking changes

This commit is contained in:
frju365 2018-03-24 01:16:50 +01:00 committed by GitHub
parent 30a45e2551
commit c35959da65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,14 +1,21 @@
#!/bin/bash #!/bin/bash
set -eu
#================================================= #=================================================
# Retrieve Sources # GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#================================================= #=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#================================================= #=================================================
# Retrieve arguments # Retrieve arguments
#================================================= #=================================================
@ -19,19 +26,20 @@ is_public=$YNH_APP_ARG_IS_PUBLIC
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
script_dir=$PWD
#================================================= #=================================================
# Vérifie que les variables ne sont pas vides. # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#================================================= #=================================================
CHECK_VAR "$app" "app name not set" final_path=/var/www/$app
CHECK_VAR "$script_dir" "script_dir not set" test ! -e "$final_path" || ynh_die "This path already contains a folder"
CHECK_PATH # Vérifie et corrige la syntaxe du path. # Normalize the url path syntax
CHECK_DOMAINPATH # Vérifie la disponibilité du path et du domaine. path_url=$(ynh_normalize_url_path $path_url)
CHECK_FINALPATH # Vérifie que le dossier de destination n'est pas déjà utilisé. # Check web path availability
ynh_webpath_available $domain $path_url
# Register (book) web path
ynh_webpath_register $app $domain $path_url
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
@ -45,48 +53,54 @@ ynh_app_setting_set $app is_public $is_public
# Install dependency to convert tracks to a readable format for the browser # Install dependency to convert tracks to a readable format for the browser
#================================================= #=================================================
sudo apt-get update ynh_install_app_dependencies php5-sqlite
sudo apt-get -yy -qq install php5-sqlite
#================================================= #=================================================
# Copy files to the right place # CREATE DEDICATED USER
#================================================= #=================================================
final_path=/var/www/$app # Create a system user
sudo mkdir -p $final_path ynh_system_user_create $app
extract_source $final_path
#================================================= #=================================================
# Files owned by root, www-data can just read # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
sudo chown www-data:www-data $final_path -R ynh_app_setting_set $app final_path $final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source "$final_path"
#=================================================
# Files owned by user app
#=================================================
sudo chown $app:$app $final_path -R
sudo chmod 755 $final_path -R sudo chmod 755 $final_path -R
#================================================= #=================================================
# Modify Nginx configuration file and copy it to Nginx conf directory # NGINX CONFIGURATION
#================================================= #=================================================
sed -i "s@YNH_WWW_PATH@$path@g" ../conf/nginx.conf # Create a dedicated nginx config
sed -i "s@YNH_WWW_ALIAS@$final_path/@g" ../conf/nginx.conf ynh_add_nginx_config
nginxconf=/etc/nginx/conf.d/$domain.d/$app.conf
sudo cp ../conf/nginx.conf $nginxconf
sudo chown root: $nginxconf
sudo chmod 600 $nginxconf
#================================================= #=================================================
# Set Public or private settings # SETUP SSOWAT
#================================================= #=================================================
ynh_app_setting_set "$app" is_public "$is_public" if [ $is_public -eq 0 ]
if [ "$is_public" = "Yes" ]; then # Remove the public access
ynh_app_setting_delete $app skipped_uris
fi
# Make app public if necessary
if [ $is_public -eq 1 ]
then then
ynh_app_setting_set "$app" unprotected_uris "/" # unprotected_uris allows SSO credentials to be passed anyway.
ynh_app_setting_set $app unprotected_uris "/"
fi fi
#================================================= #=================================================
# Reload Services # RELOAD NGINX
#================================================= #=================================================
sudo service nginx reload systemctl reload nginx
sudo yunohost app ssowatconf