mirror of
https://github.com/YunoHost-Apps/jappix_ynh.git
synced 2024-09-03 19:26:19 +02:00
commit
611170f157
12 changed files with 193 additions and 75 deletions
16
README.md
16
README.md
|
@ -1,14 +1,6 @@
|
||||||
Jappix for Yunohost
|
#Jappix package for YunoHost
|
||||||
-------------------
|
|
||||||
|
|
||||||
**Shipped version:** 1.1.6
|
- **YunoHost**: https://yunohost.org/
|
||||||
|
- **Shipped version:** 1.1.7
|
||||||
|
|
||||||
[Jappix](https://jappix.org) is a full-featured XMPP web-client
|
Jappix is a fully-featured XMPP web-client with an open social platform which enables you to host your communication platform wherever you want to.
|
||||||
with an open social platform which enables you to host your communication
|
|
||||||
platform wherever you want to.
|
|
||||||
|
|
||||||
## Links ##
|
|
||||||
|
|
||||||
**Jappix**: https://jappix.org/
|
|
||||||
|
|
||||||
**YunoHost**: https://yunohost.org/
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
upgrade=1
|
upgrade=1
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=0
|
multi_instance=0
|
||||||
wrong_user=1
|
wrong_user=0
|
||||||
wrong_path=1
|
wrong_path=1
|
||||||
incorrect_path=1
|
incorrect_path=1
|
||||||
corrupt_source=0
|
corrupt_source=0
|
||||||
|
@ -26,9 +26,9 @@
|
||||||
Level 1=auto
|
Level 1=auto
|
||||||
Level 2=auto
|
Level 2=auto
|
||||||
Level 3=auto
|
Level 3=auto
|
||||||
# Niveau 4 ignoré, mais c'est à confirmé par le mainteneur de l'application.
|
Level 4=1
|
||||||
Level 4=na
|
# Niveau 5: le test ne semble pas tout à fait savoir ce qu'est vraiment un "exit" : https://github.com/YunoHost-Apps/jappix_ynh/issues/23
|
||||||
Level 5=auto
|
Level 5=1
|
||||||
Level 6=auto
|
Level 6=auto
|
||||||
Level 7=auto
|
Level 7=auto
|
||||||
Level 8=0
|
Level 8=0
|
||||||
|
|
2
conf/app.src
Normal file
2
conf/app.src
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
SOURCE_URL=https://github.com/jappix/jappix/archive/1.1.7.tar.gz
|
||||||
|
SOURCE_SUM=515b8079b42f280da9b624d8f9825109
|
|
@ -19,7 +19,7 @@ location PATHTOCHANGE {
|
||||||
include conf.d/yunohost_panel.conf.inc;
|
include conf.d/yunohost_panel.conf.inc;
|
||||||
}
|
}
|
||||||
|
|
||||||
location PATHTOCHANGE2/http-bind {
|
location PATHTOCHANGE/http-bind {
|
||||||
if ($scheme = http) {
|
if ($scheme = http) {
|
||||||
rewrite ^ https://$server_name$request_uri? permanent;
|
rewrite ^ https://$server_name$request_uri? permanent;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
},
|
},
|
||||||
"url": "https://jappix.org/",
|
"url": "https://jappix.org/",
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"version": "1.1.6",
|
"version": "1.1.7",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
"name": "titoko",
|
"name": "titoko",
|
||||||
"email": "titoko@titoko.fr"
|
"email": "titoko@titoko.fr"
|
||||||
|
|
95
scripts/.fonctions
Normal file
95
scripts/.fonctions
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CHECKING
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
CHECK_PATH () { # Vérifie la présence du / en début de path. Et son absence à la fin.
|
||||||
|
if [ "${path:0:1}" != "/" ]; then # Si le premier caractère n'est pas un /
|
||||||
|
path="/$path" # Ajoute un / en début de path
|
||||||
|
fi
|
||||||
|
if [ "${path:${#path}-1}" == "/" ] && [ ${#path} -gt 1 ]; then # Si le dernier caractère est un / et que ce n'est pas le seul caractère.
|
||||||
|
path="${path:0:${#path}-1}" # Supprime le dernier caractère
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
CHECK_DOMAINPATH () { # Vérifie la disponibilité du path et du domaine.
|
||||||
|
sudo yunohost app checkurl $domain$path -a $app
|
||||||
|
}
|
||||||
|
|
||||||
|
CHECK_FINALPATH () { # Vérifie que le dossier de destination n'est pas déjà utilisé.
|
||||||
|
final_path=/var/www/$app
|
||||||
|
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
||||||
|
}
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SETUP
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
SETUP_SOURCE () { # Télécharge la source, décompresse et copie dans $final_path
|
||||||
|
src_url=$(cat ../conf/app.src | grep SOURCE_URL | cut -d= -f2)
|
||||||
|
src_checksum=$(cat ../conf/app.src | grep SOURCE_SUM | cut -d= -f2)
|
||||||
|
# Download sources from the upstream
|
||||||
|
wget -nv -O source.tar.gz $src_url
|
||||||
|
# Vérifie la somme de contrôle de la source téléchargée.
|
||||||
|
echo "$src_checksum source.tar.gz" | md5sum -c --status || ynh_die "Corrupt source"
|
||||||
|
# Extract source into the app dir
|
||||||
|
sudo mkdir -p $final_path
|
||||||
|
sudo tar -x -f source.tar.gz -C $final_path --strip-components 1
|
||||||
|
# Copie les fichiers additionnels ou modifiés.
|
||||||
|
if test -e "../sources/ajouts"; then
|
||||||
|
sudo cp -a ../sources/ajouts/. "$final_path"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
#=================================================
|
||||||
|
# FUTUR YNH HELPERS
|
||||||
|
#=================================================
|
||||||
|
# Importer ce fichier de fonction avant celui des helpers officiel
|
||||||
|
# Ainsi, les officiels prendront le pas sur ceux-ci le cas échéant
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Manage a fail of the script
|
||||||
|
#
|
||||||
|
# Print a warning to inform that the script was failed
|
||||||
|
# Execute the ynh_clean_setup function if used in the app script
|
||||||
|
#
|
||||||
|
# usage of ynh_clean_setup function
|
||||||
|
# This function provide a way to clean some residual of installation that not managed by remove script.
|
||||||
|
# To use it, simply add in your script:
|
||||||
|
# ynh_clean_setup () {
|
||||||
|
# instructions...
|
||||||
|
# }
|
||||||
|
# This function is optionnal.
|
||||||
|
#
|
||||||
|
# Usage: ynh_exit_properly is used only by the helper ynh_check_error.
|
||||||
|
# You must not use it directly.
|
||||||
|
ynh_exit_properly () {
|
||||||
|
exit_code=$?
|
||||||
|
if [ "$exit_code" -eq 0 ]; then
|
||||||
|
exit 0 # Exit without error if the script ended correctly
|
||||||
|
fi
|
||||||
|
|
||||||
|
trap '' EXIT # Ignore new exit signals
|
||||||
|
set +eu # Do not exit anymore if a command fail or if a variable is empty
|
||||||
|
|
||||||
|
echo -e "!!\n $app's script has encountered an error. Its execution was cancelled.\n!!" >&2
|
||||||
|
|
||||||
|
if type -t ynh_clean_setup > /dev/null; then # Check if the function exist in the app script.
|
||||||
|
ynh_clean_setup # Call the function to do specific cleaning for the app.
|
||||||
|
fi
|
||||||
|
|
||||||
|
ynh_die # Exit with error status
|
||||||
|
}
|
||||||
|
|
||||||
|
# Exit if an error occurs during the execution of the script.
|
||||||
|
#
|
||||||
|
# Stop immediatly the execution if an error occured or if a empty variable is used.
|
||||||
|
# The execution of the script is derivate to ynh_exit_properly function before exit.
|
||||||
|
#
|
||||||
|
# Usage: ynh_check_error
|
||||||
|
ynh_check_error () {
|
||||||
|
set -eu # Exit if a command fail, and if a variable is used unset.
|
||||||
|
trap ynh_exit_properly EXIT # Capturing exit signals on shell script
|
||||||
|
}
|
|
@ -1,5 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
VERSION="1.1.6"
|
|
||||||
|
|
||||||
JAPPIX_SOURCE_URL="https://github.com/jappix/jappix/archive/${VERSION}.tar.gz"
|
|
|
@ -1,15 +1,15 @@
|
||||||
#!/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 YNH helpers
|
# Source YNH helpers
|
||||||
. /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
app="jappix"
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
# Retrieve app settings
|
# Retrieve app settings
|
||||||
domain=$(sudo yunohost app setting "$app" domain)
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
|
|
||||||
# Save sources & data
|
# Save sources & data
|
||||||
ynh_backup "/var/www/${app}" "sources"
|
ynh_backup "/var/www/${app}" "sources"
|
||||||
|
|
|
@ -1,55 +1,88 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
#=================================================
|
||||||
|
# GENERIC STARTING
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
source ./_common.sh
|
source .fonctions
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
app="jappix"
|
#=================================================
|
||||||
|
# MANAGE FAILURE OF THE SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# Retrieve arguments
|
ynh_check_error # Active trap pour arrêter le script si une erreur est détectée.
|
||||||
domain=$1
|
|
||||||
path=${2%/}
|
|
||||||
name=$3
|
|
||||||
language=$4
|
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
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
|
||||||
sudo yunohost app checkurl "${domain}${path}" -a "$app" \
|
#=================================================
|
||||||
|| exit 1
|
|
||||||
|
|
||||||
# Retrieve sources
|
CHECK_PATH # Vérifie et corrige la syntaxe du path.
|
||||||
wget -q -O jappix.tar.gz "$JAPPIX_SOURCE_URL"
|
CHECK_DOMAINPATH
|
||||||
|
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
|
||||||
|
ynh_app_setting_set $app final_path $final_path
|
||||||
|
|
||||||
|
#=================================================
|
||||||
# Copy files to the right place
|
# Copy files to the right place
|
||||||
final_path="/var/www/${app}"
|
#=================================================
|
||||||
|
|
||||||
|
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
|
||||||
|
#=================================================
|
||||||
|
|
||||||
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
|
#=================================================
|
||||||
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}" ]] \
|
#=================================================
|
||||||
|
|
||||||
|
[[ -e "${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/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@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,9 +1,12 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
app="jappix"
|
set -u
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
domain=$(sudo yunohost app setting "$app" domain)
|
domain=$(ynh_app_setting_get "$app" domain)
|
||||||
|
|
||||||
# Remove sources and configuration
|
# Remove sources and configuration
|
||||||
sudo rm -rf "/var/www/${app}"
|
sudo rm -rf "/var/www/${app}"
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
#!/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)
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
|
|
||||||
|
|
||||||
# Restore sources & data
|
# Restore sources & data
|
||||||
sudo cp -a ./sources "/var/www/${app}"
|
sudo cp -a ./sources "/var/www/${app}"
|
||||||
|
|
|
@ -1,47 +1,44 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
set -eu
|
||||||
|
source .fonctions
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
source ./_common.sh
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
app="jappix"
|
# Récupère les infos de l'application.
|
||||||
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
# Retrieve arguments
|
path=$(ynh_app_setting_get $app path)
|
||||||
domain=$(sudo yunohost app setting "$app" domain)
|
name=$(ynh_app_setting_get "$app" name)
|
||||||
path=$(sudo yunohost app setting "$app" path)
|
language=$(ynh_app_setting_get "$app" language)
|
||||||
name=$(sudo yunohost app setting "$app" name)
|
|
||||||
language=$(sudo yunohost app setting "$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%/}
|
CHECK_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
|
||||||
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
|
|
||||||
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"
|
||||||
|
|
||||||
# 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/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@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"
|
||||||
|
|
Loading…
Reference in a new issue