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-10-20 23:28:09 +02:00
parent a141bc7363
commit a77dd21b9a
No known key found for this signature in database
GPG key ID: 574F281483054D44
7 changed files with 125 additions and 48 deletions

View file

@ -8,18 +8,17 @@
},
"url": "https://jappix.org/",
"license": "AGPL-3",
"version": "1.1.7",
"version": "1.1.7~ynh1",
"maintainer": {
"name": "titoko",
"email": "titoko@titoko.fr"
},
"multi_instance": false,
"requirements": {
"yunohost": ">> 2.3.15"
"yunohost": ">> 3.8.1"
},
"services": [
"nginx",
"php5-fpm",
"nginx"
"metronome"
],
"arguments": {

View file

@ -1,18 +1,49 @@
#!/bin/bash
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
set -eu
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Source YNH helpers
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
# Retrieve app settings
domain=$(ynh_app_setting_get $app domain)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
# Save sources & data
ynh_backup "/var/www/${app}" "sources"
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
# Copy NGINX configuration
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf"
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup --src_path="$final_path"
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -1,19 +1,19 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source .fonctions
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE FAILURE OF THE SCRIPT
#=================================================
ynh_check_error # Active trap pour arrêter le script si une erreur est détectée.
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
@ -24,8 +24,8 @@ path=$YNH_APP_ARG_PATH
name=$YNH_APP_ARG_NAME
language=$YNH_APP_ARG_LANGUAGE
app=$YNH_APP_INSTANCE_NAME
#=================================================
# Check domain/path availability
#=================================================
@ -49,22 +49,22 @@ ynh_app_setting_set $app final_path $final_path
SETUP_SOURCE # Télécharge la source, décompresse et copie dans $final_path
sudo mkdir -p "${final_path}/store/conf"
sudo cp ../conf/*.xml "${final_path}/store/conf/"
mkdir -p "${final_path}/store/conf"
cp ../conf/*.xml "${final_path}/store/conf/"
#=================================================
# Set permissions to jappix directory
#=================================================
sudo chown -R www-data: "$final_path"
chown -R www-data: "$final_path"
#=================================================
# Set and copy NGINX configuraion
#=================================================
sudo sed -i "s@PATHTOCHANGE@${path}@g" ../conf/nginx.conf
sudo sed -i "s@ALIASTOCHANGE@${final_path}/@g" ../conf/nginx.conf
sudo cp ../conf/nginx.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf"
sed -i "s@PATHTOCHANGE@${path}@g" ../conf/nginx.conf
sed -i "s@ALIASTOCHANGE@${final_path}/@g" ../conf/nginx.conf
cp ../conf/nginx.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf"
#=================================================
# Validate language
@ -77,12 +77,21 @@ sudo cp ../conf/nginx.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf"
# Set Jappix configuration
#=================================================
sudo sed -i "s@PATHTOCHANGE@${path}@g" "${final_path}/store/conf/hosts.xml"
sudo sed -i "s@CHANGELANG@${language}@g" "${final_path}/store/conf/main.xml"
sudo sed -i "s@CHANGENAME@${name}@g" "${final_path}/store/conf/main.xml"
sudo sed -i "s@DOMAINTOCHANGE@${domain}@g" "${final_path}/store/conf/hosts.xml"
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"
sed -i "s@DOMAINTOCHANGE@${domain}@g" "${final_path}/store/conf/hosts.xml"
#=================================================
# Reload services
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading nginx web server..." -weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
sudo service nginx reload
ynh_script_progression --message="Installation of $app completed" --last

View file

@ -3,6 +3,8 @@
set -u
source /usr/share/yunohost/helpers
ynh_abort_if_errors
app=$YNH_APP_INSTANCE_NAME
# Retrieve arguments

View file

@ -1,19 +1,34 @@
#!/bin/bash
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
set -eu
#=================================================
# GENERIC START
#=================================================
# 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 /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
# Retrieve old app settings
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain)
# Restore sources & data
sudo cp -a ./sources "/var/www/${app}"
cp -a ./sources "/var/www/${app}"
# Restore Nginx and YunoHost parameters
sudo cp -a ./nginx.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf"
cp -a ./nginx.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf"
# Reload services
sudo service nginx reload
service nginx reload

View file

@ -1,9 +1,19 @@
#!/bin/bash
set -eu
source .fonctions
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --time --weight=1
app=$YNH_APP_INSTANCE_NAME
# Récupère les infos de l'application.
@ -26,22 +36,33 @@ CHECK_PATH
final_path="/var/www/${app}"
ynh_app_setting_set $app final_path $final_path
SETUP_SOURCE # Télécharge la source, décompresse et copie dans $final_path
sudo mkdir -p "${final_path}/store/conf"
sudo cp ../conf/*.xml "${final_path}/store/conf/"
mkdir -p "${final_path}/store/conf"
cp ../conf/*.xml "${final_path}/store/conf/"
# Set permissions to jappix directory
sudo chown -R www-data: "$final_path"
# Set and copy NGINX configuraion
sudo sed -i "s@PATHTOCHANGE@${path}@g" ../conf/nginx.conf
sudo sed -i "s@ALIASTOCHANGE@${final_path}/@g" ../conf/nginx.conf
sudo cp ../conf/nginx.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf"
sed -i "s@PATHTOCHANGE@${path}@g" ../conf/nginx.conf
sed -i "s@ALIASTOCHANGE@${final_path}/@g" ../conf/nginx.conf
cp ../conf/nginx.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf"
# Set Jappix configuration
sudo sed -i "s@PATHTOCHANGE@${path}@g" "${final_path}/store/conf/hosts.xml"
sudo sed -i "s@CHANGELANG@${language}@g" "${final_path}/store/conf/main.xml"
sudo sed -i "s@CHANGENAME@${name}@g" "${final_path}/store/conf/main.xml"
sudo sed -i "s@DOMAINTOCHANGE@${domain}@g" "${final_path}/store/conf/hosts.xml"
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"
sed -i "s@DOMAINTOCHANGE@${domain}@g" "${final_path}/store/conf/hosts.xml"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading nginx web server..." --time --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --time --last
# Reload services
sudo service nginx reload