mirror of
https://github.com/YunoHost-Apps/jappix_ynh.git
synced 2024-09-03 19:26:19 +02:00
commit
a9a3c95347
4 changed files with 67 additions and 28 deletions
|
@ -4,7 +4,7 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Source YNH helpers
|
# Source YNH helpers
|
||||||
. /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
app="jappix"
|
app="jappix"
|
||||||
|
|
||||||
|
|
|
@ -1,25 +1,51 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
#=================================================
|
||||||
|
# GENERIC STARTING
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
source .fonctions
|
source .fonctions
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
ynh_check_error # Active trap pour arrêter le script si une erreur est détectée.
|
#=================================================
|
||||||
|
# MANAGE FAILURE OF THE SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
app="jappix"
|
ynh_check_error # Active trap pour arrêter le script si une erreur est détectée.
|
||||||
|
|
||||||
# Retrieve arguments
|
#=================================================
|
||||||
domain=$1
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
path=$2
|
#=================================================
|
||||||
name=$3
|
|
||||||
language=$4
|
|
||||||
|
|
||||||
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
|
path=$YNH_APP_ARG_PATH
|
||||||
|
name=$YNH_APP_ARG_NAME
|
||||||
|
language=$YNH_APP_ARG_LANGUAGE
|
||||||
|
|
||||||
|
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
#=================================================
|
||||||
# Check domain/path availability
|
# Check domain/path availability
|
||||||
|
#=================================================
|
||||||
|
|
||||||
CHECK_DOMAINPATH
|
CHECK_DOMAINPATH
|
||||||
path=$(ynh_normalize_url_path $path) # Vérifie et corrige la syntaxe du path.
|
path=$(ynh_normalize_url_path $path) # Vérifie et corrige la syntaxe du path.
|
||||||
CHECK_FINALPATH # Vérifie que le dossier de destination n'est pas déjà utilisé.
|
CHECK_FINALPATH # Vérifie que le dossier de destination n'est pas déjà utilisé.
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# STORE SETTINGS FROM MANIFEST
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_app_setting_set $app name $name
|
||||||
|
ynh_app_setting_set $app language $language
|
||||||
|
ynh_app_setting_set $app domain $domain
|
||||||
|
|
||||||
|
#=================================================
|
||||||
# Copy files to the right place
|
# Copy files to the right place
|
||||||
|
#=================================================
|
||||||
|
|
||||||
final_path="/var/www/${app}"
|
final_path="/var/www/${app}"
|
||||||
ynh_app_setting_set $app final_path $final_path
|
ynh_app_setting_set $app final_path $final_path
|
||||||
SETUP_SOURCE # Télécharge la source, décompresse et copie dans $final_path
|
SETUP_SOURCE # Télécharge la source, décompresse et copie dans $final_path
|
||||||
|
@ -27,31 +53,41 @@ SETUP_SOURCE # Télécharge la source, décompresse et copie dans $final_path
|
||||||
sudo mkdir -p "${final_path}/store/conf"
|
sudo mkdir -p "${final_path}/store/conf"
|
||||||
sudo cp ../conf/*.xml "${final_path}/store/conf/"
|
sudo cp ../conf/*.xml "${final_path}/store/conf/"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
# Set permissions to jappix directory
|
# Set permissions to jappix directory
|
||||||
|
#=================================================
|
||||||
|
|
||||||
sudo chown -R www-data: "$final_path"
|
sudo chown -R www-data: "$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
# Set and copy NGINX configuraion
|
# Set and copy NGINX configuraion
|
||||||
|
#=================================================
|
||||||
|
|
||||||
sudo sed -i "s@PATHTOCHANGE2@${path}@g" ../conf/nginx.conf
|
sudo sed -i "s@PATHTOCHANGE2@${path}@g" ../conf/nginx.conf
|
||||||
path=${path:-/}
|
path=${path:-/}
|
||||||
sudo sed -i "s@PATHTOCHANGE@${path}@g" ../conf/nginx.conf
|
sudo sed -i "s@PATHTOCHANGE@${path}@g" ../conf/nginx.conf
|
||||||
sudo sed -i "s@ALIASTOCHANGE@${final_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"
|
sudo cp ../conf/nginx.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
# Validate language
|
# Validate language
|
||||||
|
#=================================================
|
||||||
|
|
||||||
[[ -a "${final_path}/i18n/${language}" ]] \
|
[[ -a "${final_path}/i18n/${language}" ]] \
|
||||||
|| language="en"
|
|| language="en"
|
||||||
|
|
||||||
# Store app settings
|
#=================================================
|
||||||
sudo yunohost app setting "$app" name -v "$name"
|
|
||||||
sudo yunohost app setting "$app" language -v "$language"
|
|
||||||
|
|
||||||
# Set Jappix configuration
|
# Set Jappix configuration
|
||||||
|
#=================================================
|
||||||
|
|
||||||
sudo sed -i "s@PATHTOCHANGE@${path}@g" "${final_path}/store/conf/main.xml"
|
sudo sed -i "s@PATHTOCHANGE@${path}@g" "${final_path}/store/conf/main.xml"
|
||||||
sudo sed -i "s@PATHTOCHANGE@${path}@g" "${final_path}/store/conf/hosts.xml"
|
sudo sed -i "s@PATHTOCHANGE@${path}@g" "${final_path}/store/conf/hosts.xml"
|
||||||
sudo sed -i "s@DOMAINTOCHANGE@${domain}@g" "${final_path}/store/conf/main.xml"
|
sudo sed -i "s@DOMAINTOCHANGE@${domain}@g" "${final_path}/store/conf/main.xml"
|
||||||
sudo sed -i "s@CHANGELANG@${language}@g" "${final_path}/store/conf/main.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@CHANGENAME@${name}@g" "${final_path}/store/conf/main.xml"
|
||||||
sudo sed -i "s@DOMAINTOCHANGE@${domain}@g" "${final_path}/store/conf/hosts.xml"
|
sudo sed -i "s@DOMAINTOCHANGE@${domain}@g" "${final_path}/store/conf/hosts.xml"
|
||||||
|
#=================================================
|
||||||
# Reload services
|
# Reload services
|
||||||
|
#=================================================
|
||||||
|
|
||||||
sudo service nginx reload
|
sudo service nginx reload
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
|
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
|
||||||
set -e
|
set -eu
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
app="jappix"
|
|
||||||
|
|
||||||
# Retrieve old app settings
|
# Retrieve old app settings
|
||||||
domain=$(sudo yunohost app setting "$app" domain)
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
# Restore sources & data
|
# Restore sources & data
|
||||||
sudo cp -a ./sources "/var/www/${app}"
|
sudo cp -a ./sources "/var/www/${app}"
|
||||||
|
|
|
@ -1,29 +1,32 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
source .fonctions
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
app="jappix"
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
domain=$(sudo yunohost app setting "$app" domain)
|
domain=$(ynh_app_setting_set "$app" domain)
|
||||||
path=$(sudo yunohost app setting "$app" path)
|
path=$(ynh_app_setting_set "$app" path)
|
||||||
name=$(sudo yunohost app setting "$app" name)
|
name=$(ynh_app_setting_set "$app" name)
|
||||||
language=$(sudo yunohost app setting "$app" language)
|
language=$(ynh_app_setting_set "$app" language)
|
||||||
|
|
||||||
# Set default values
|
# Set default values
|
||||||
name="${name:-YunoJappix}"
|
name="${name:-YunoJappix}"
|
||||||
language="${language:-en}"
|
language="${language:-en}"
|
||||||
|
|
||||||
# Remove trailing "/" for next commands
|
# Remove trailing "/" for next commands
|
||||||
path=${path%/}
|
path=$(ynh_normalize_url_path $path) # Vérifie et corrige la syntaxe du path.
|
||||||
|
|
||||||
# Retrieve sources
|
|
||||||
wget -q -O jappix.tar.gz "$JAPPIX_SOURCE_URL"
|
|
||||||
|
|
||||||
|
#=================================================
|
||||||
# Copy files to the right place
|
# Copy files to the right place
|
||||||
|
#=================================================
|
||||||
|
|
||||||
final_path="/var/www/${app}"
|
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 mkdir -p "${final_path}/store/conf"
|
||||||
sudo tar -C "$final_path" -xf jappix.tar.gz --strip-components 1
|
|
||||||
sudo cp ../conf/*.xml "${final_path}/store/conf/"
|
sudo cp ../conf/*.xml "${final_path}/store/conf/"
|
||||||
|
|
||||||
# Set permissions to jappix directory
|
# Set permissions to jappix directory
|
||||||
|
|
Loading…
Add table
Reference in a new issue