mirror of
https://github.com/YunoHost-Apps/jappix_ynh.git
synced 2024-09-03 19:26:19 +02:00
Fix
This commit is contained in:
parent
91fd1aecf7
commit
e67aa92055
7 changed files with 73 additions and 27 deletions
|
@ -1,7 +1,7 @@
|
||||||
;; Test complet
|
;; Test complet
|
||||||
; Manifest
|
; Manifest
|
||||||
domain="domain.tld" (DOMAIN)
|
domain="domain.tld"
|
||||||
path="/path" (PATH)
|
path="/path"
|
||||||
name="YunoJappix"
|
name="YunoJappix"
|
||||||
language="en"
|
language="en"
|
||||||
; Checks
|
; Checks
|
||||||
|
|
|
@ -4,4 +4,3 @@ SOURCE_SUM_PRG=sha256sum
|
||||||
SOURCE_FORMAT=zip
|
SOURCE_FORMAT=zip
|
||||||
SOURCE_IN_SUBDIR=true
|
SOURCE_IN_SUBDIR=true
|
||||||
SOURCE_FILENAME=
|
SOURCE_FILENAME=
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
"email": "titoko@titoko.fr"
|
"email": "titoko@titoko.fr"
|
||||||
},
|
},
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">> 4.1.7"
|
"yunohost": ">> 4.2.4"
|
||||||
},
|
},
|
||||||
"multi_instance": false,
|
"multi_instance": false,
|
||||||
"services": [
|
"services": [
|
||||||
|
|
|
@ -47,6 +47,14 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url
|
||||||
ynh_app_setting_set --app=$app --key=name --value=$name
|
ynh_app_setting_set --app=$app --key=name --value=$name
|
||||||
ynh_app_setting_set --app=$app --key=language --value=$language
|
ynh_app_setting_set --app=$app --key=language --value=$language
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CREATE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring system user..." --weight=1
|
||||||
|
|
||||||
|
# Create a system user
|
||||||
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -56,14 +64,9 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source --dest_dir="$final_path"
|
ynh_setup_source --dest_dir="$final_path"
|
||||||
|
|
||||||
mkdir -p "$final_path/store/conf"
|
chmod 750 "$final_path"
|
||||||
cp ../conf/*.xml "$final_path/store/conf/"
|
chmod -R o-rwx "$final_path"
|
||||||
|
chown -R $app:www-data "$final_path"
|
||||||
#=================================================
|
|
||||||
# Set permissions to jappix directory
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
chown -R www-data: $final_path
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
|
@ -77,8 +80,11 @@ ynh_add_nginx_config
|
||||||
# Set Jappix configuration
|
# Set Jappix configuration
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
mkdir -p "$final_path/store/conf"
|
||||||
|
|
||||||
ynh_add_config --template="../conf/hosts.xml" --destination="$final_path/store/conf/hosts.xml"
|
ynh_add_config --template="../conf/hosts.xml" --destination="$final_path/store/conf/hosts.xml"
|
||||||
ynh_add_config --template="../conf/main.xml" --destination="$final_path/store/conf/main.xml"
|
ynh_add_config --template="../conf/main.xml" --destination="$final_path/store/conf/main.xml"
|
||||||
|
ynh_add_config --template="../conf/installed.xml" --destination="$final_path/store/conf/installed.xml"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
|
|
|
@ -35,6 +35,14 @@ ynh_script_progression --message="Removing NGINX web server configuration..." --
|
||||||
# Remove the dedicated nginx config
|
# Remove the dedicated nginx config
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
||||||
|
|
||||||
|
# Delete a system user
|
||||||
|
ynh_system_user_delete --username=$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -44,6 +44,14 @@ test ! -d $final_path \
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RECREATE THE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
||||||
|
|
||||||
|
# Create the dedicated user (if not existing)
|
||||||
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -51,6 +59,10 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
|
||||||
|
|
||||||
ynh_restore_file --origin_path=$final_path
|
ynh_restore_file --origin_path=$final_path
|
||||||
|
|
||||||
|
chmod 750 "$final_path"
|
||||||
|
chmod -R o-rwx "$final_path"
|
||||||
|
chown -R $app:www-data "$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -25,6 +25,12 @@ name=$(ynh_app_setting_get "$app" name)
|
||||||
language=$(ynh_app_setting_get "$app" language)
|
language=$(ynh_app_setting_get "$app" language)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CHECK VERSION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
upgrade_type=$(ynh_check_app_version_changed)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -41,6 +47,26 @@ if [ -z "$name" ]; then
|
||||||
ynh_app_setting_set --app=$app --key=name --value=$name
|
ynh_app_setting_set --app=$app --key=name --value=$name
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# If db_name doesn't exist, create it
|
||||||
|
if [ -z "$final_path/store/conf" ]; then
|
||||||
|
mkdir -p "$final_path/store/conf"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Cleaning legacy permissions
|
||||||
|
if ynh_legacy_permissions_exists; then
|
||||||
|
ynh_legacy_permissions_delete_all
|
||||||
|
|
||||||
|
ynh_app_setting_delete --app=$app --key=is_public
|
||||||
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CREATE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
||||||
|
|
||||||
|
# Create a dedicated user (if not existing)
|
||||||
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -55,28 +81,22 @@ ynh_clean_setup () {
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# Copy files to the right place
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up source files..." --weight=6
|
ynh_script_progression --message="Setting up source files..." --weight=6
|
||||||
|
|
||||||
ynh_setup_source --dest_dir=$final_path
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
|
then
|
||||||
|
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||||
|
|
||||||
mkdir -p "${final_path}/store/conf"
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
cp ../conf/*.xml "${final_path}/store/conf/"
|
ynh_setup_source --dest_dir="$final_path"
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
chmod 750 "$final_path"
|
||||||
# GENERIC FINALIZATION
|
chmod -R o-rwx "$final_path"
|
||||||
#=================================================
|
chown -R $app:www-data "$final_path"
|
||||||
# SECURE FILES AND DIRECTORIES
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Set permissions to jappix directory
|
|
||||||
chown -R www-data: $final_path
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
|
@ -92,6 +112,7 @@ ynh_add_nginx_config
|
||||||
|
|
||||||
ynh_add_config --template="../conf/hosts.xml" --destination="$final_path/store/conf/hosts.xml"
|
ynh_add_config --template="../conf/hosts.xml" --destination="$final_path/store/conf/hosts.xml"
|
||||||
ynh_add_config --template="../conf/main.xml" --destination="$final_path/store/conf/main.xml"
|
ynh_add_config --template="../conf/main.xml" --destination="$final_path/store/conf/main.xml"
|
||||||
|
ynh_add_config --template="../conf/installed.xml" --destination="$final_path/store/conf/installed.xml"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
|
|
Loading…
Reference in a new issue