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:
parent
30a45e2551
commit
c35959da65
1 changed files with 47 additions and 33 deletions
|
@ -1,14 +1,21 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
#=================================================
|
||||
# Retrieve Sources
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
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
|
||||
#=================================================
|
||||
|
@ -19,19 +26,20 @@ is_public=$YNH_APP_ARG_IS_PUBLIC
|
|||
|
||||
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"
|
||||
CHECK_VAR "$script_dir" "script_dir not set"
|
||||
final_path=/var/www/$app
|
||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
||||
|
||||
CHECK_PATH # Vérifie et corrige la syntaxe du path.
|
||||
CHECK_DOMAINPATH # Vérifie la disponibilité du path et du domaine.
|
||||
# Normalize the url path syntax
|
||||
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
|
||||
|
@ -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
|
||||
#=================================================
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get -yy -qq install php5-sqlite
|
||||
ynh_install_app_dependencies php5-sqlite
|
||||
|
||||
#=================================================
|
||||
# Copy files to the right place
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
|
||||
final_path=/var/www/$app
|
||||
sudo mkdir -p $final_path
|
||||
extract_source $final_path
|
||||
# Create a system user
|
||||
ynh_system_user_create $app
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
|
||||
#=================================================
|
||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
sed -i "s@YNH_WWW_PATH@$path@g" ../conf/nginx.conf
|
||||
sed -i "s@YNH_WWW_ALIAS@$final_path/@g" ../conf/nginx.conf
|
||||
nginxconf=/etc/nginx/conf.d/$domain.d/$app.conf
|
||||
sudo cp ../conf/nginx.conf $nginxconf
|
||||
sudo chown root: $nginxconf
|
||||
sudo chmod 600 $nginxconf
|
||||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# Set Public or private settings
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
|
||||
ynh_app_setting_set "$app" is_public "$is_public"
|
||||
if [ "$is_public" = "Yes" ];
|
||||
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 ]
|
||||
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
|
||||
|
||||
#=================================================
|
||||
# Reload Services
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
|
||||
sudo service nginx reload
|
||||
sudo yunohost app ssowatconf
|
||||
systemctl reload nginx
|
||||
|
|
Loading…
Add table
Reference in a new issue