1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/jappix_ynh.git synced 2024-09-03 19:26:19 +02:00
This commit is contained in:
ericgaspar 2020-11-22 22:56:21 +01:00
parent d087e75944
commit 4944504589
No known key found for this signature in database
GPG key ID: 574F281483054D44
4 changed files with 37 additions and 23 deletions

View file

@ -1,5 +1,4 @@
;; Test complet ;; Test complet
auto_remove=1
; Manifest ; Manifest
domain="domain.tld" (DOMAIN) domain="domain.tld" (DOMAIN)
path="/path" (PATH) path="/path" (PATH)
@ -15,12 +14,11 @@
upgrade=1 upgrade=1
backup_restore=1 backup_restore=1
multi_instance=0 multi_instance=0
wrong_user=0 incorrect_path=0
wrong_path=1
incorrect_path=1
corrupt_source=0
fail_download_source=0
port_already_use=0 port_already_use=0
final_path_already_use=0 change_url=0
;;; Levels ;;; Levels
Level 5=auto Level 5=auto
;;; Options
Email=
Notification=none

View file

@ -8,7 +8,7 @@
}, },
"version": "1.2~ynh1", "version": "1.2~ynh1",
"url": "https://jappix.org/", "url": "https://jappix.org/",
"license": "AGPL-3", "license": "AGPL-3.0-only",
"maintainer": { "maintainer": {
"name": "titoko", "name": "titoko",
"email": "titoko@titoko.fr" "email": "titoko@titoko.fr"

View file

@ -6,7 +6,6 @@
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -19,7 +18,7 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --time --weight=1 ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -30,7 +29,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
#================================================= #=================================================
ynh_script_progression --message="Validating restoration parameters..." --time --weight=2 ynh_script_progression --message="Validating restoration parameters..." --weight=2
ynh_webpath_available --domain=$domain --path_url=$path_url \ ynh_webpath_available --domain=$domain --path_url=$path_url \
|| ynh_die --message="Path not available: ${domain}${path_url}" || ynh_die --message="Path not available: ${domain}${path_url}"

View file

@ -23,6 +23,7 @@ domain=$(ynh_app_setting_get $app domain)
path=$(ynh_app_setting_get $app path) path=$(ynh_app_setting_get $app path)
name=$(ynh_app_setting_get "$app" name) 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)
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
@ -43,7 +44,7 @@ fi
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --time --weight=1 ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
@ -58,30 +59,46 @@ ynh_abort_if_errors
# Copy files to the right place # Copy files to the right place
#================================================= #=================================================
final_path="/var/www/${app}" #=================================================
ynh_app_setting_set $app final_path $final_path # DOWNLOAD, CHECK AND UNPACK SOURCE
SETUP_SOURCE # Télécharge la source, décompresse et copie dans $final_path #=================================================
ynh_script_progression --message="Setting up source files..." --weight=6
ynh_setup_source --dest_dir=$final_path
mkdir -p "${final_path}/store/conf" mkdir -p "${final_path}/store/conf"
cp ../conf/*.xml "${final_path}/store/conf/" cp ../conf/*.xml "${final_path}/store/conf/"
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Set permissions to jappix directory # Set permissions to jappix directory
sudo chown -R www-data: "$final_path" chown -R www-data: $final_path
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Upgrading nginx web server configuration..." --time --weight=1 ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=1
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config
#=================================================
# Set Jappix configuration # Set Jappix configuration
sed -i "s@PATHTOCHANGE@${path}@g" "${final_path}/store/conf/hosts.xml" #=================================================
sed -i "s@CHANGELANG@${language}@g" "${final_path}/store/conf/main.xml"
sed -i "s@CHANGENAME@${name}@g" "${final_path}/store/conf/main.xml" cp ../conf/hosts.xml $final_path/store/conf/hosts.xml
sed -i "s@DOMAINTOCHANGE@${domain}@g" "${final_path}/store/conf/hosts.xml"
ynh_replace_string --match_string="__DOMAIN__" --replace_string=$domain --target_file="$final_path/store/conf/hosts.xml"
ynh_replace_string --match_string="__FINALPATH__" --replace_string=$final_path --target_file="$final_path/store/conf/hosts.xml"
cp ../conf/main.xml $final_path/store/conf/main.xml
ynh_replace_string --match_string="__LANGUAGE__" --replace_string=$language --target_file="$final_path/store/conf/main.xml"
ynh_replace_string --match_string="__NAME__" --replace_string=$name --target_file="$final_path/store/conf/main.xml"
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX