mirror of
https://github.com/YunoHost-Apps/z-push_ynh.git
synced 2024-09-03 18:05:58 +02:00
parent
bdac42b709
commit
96fda9562e
6 changed files with 78 additions and 37 deletions
|
@ -15,7 +15,7 @@
|
|||
multi_instance=0
|
||||
wrong_user=0
|
||||
wrong_path=1
|
||||
incorrect_path=1
|
||||
incorrect_path=0
|
||||
corrupt_source=0
|
||||
fail_download_source=0
|
||||
port_already_use=0
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
"en": "Z-Push is an Exchange ActiveSync fronted written in php which lets you synchronize emails (imap/smtp backend) and calendar/contacts (carddav and caldav backend)",
|
||||
"fr": "Z-Push est un fronted Exchange ActiveSync écrit en php qui permet de synchroniser vos email (backend imap/smtp) et vos contacts/calendrier (backend carddav et caldav)"
|
||||
},
|
||||
"version": "2.3.6~ynh2",
|
||||
"url": "https://z-push.org",
|
||||
"license": "free",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"maintainer": {
|
||||
"name": "beudbeud, polytan02"
|
||||
},
|
||||
|
|
20
scripts/_common.sh
Normal file
20
scripts/_common.sh
Normal file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
||||
# dependencies used by the app
|
||||
pkg_dependencies="deb1 deb2"
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# FUTURE OFFICIAL HELPERS
|
||||
#=================================================
|
|
@ -1,36 +1,21 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Active trap pour arrêter le script si une erreur est détectée.
|
||||
EXIT_PROPERLY () { # Provoque l'arrêt du script en cas d'erreur. Et nettoye les résidus.
|
||||
exit_code=$?
|
||||
if [ "$exit_code" -eq 0 ]; then
|
||||
exit 0 # Quitte sans erreur si le script se termine correctement.
|
||||
fi
|
||||
trap '' EXIT
|
||||
set +eu
|
||||
echo -e "\e[91m \e[1m" # Shell in light red bold
|
||||
echo -e "!!\n $app install's script has encountered an error. Installation was cancelled.\n!!" >&2
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
if type -t CLEAN_SETUP > /dev/null; then # Vérifie l'existance de la fonction avant de l'exécuter.
|
||||
CLEAN_SETUP # Appel la fonction de nettoyage spécifique du script install.
|
||||
fi
|
||||
|
||||
# Compense le bug de ssowat qui ne supprime pas l'entrée de l'app en cas d'erreur d'installation.
|
||||
sudo sed -i "\@\"$domain$path/\":@d" /etc/ssowat/conf.json
|
||||
|
||||
ynh_die
|
||||
}
|
||||
|
||||
TRAP_ON () { # Activate signal capture
|
||||
set -eu # Exit if a command fail, and if a variable is used unset.
|
||||
trap EXIT_PROPERLY EXIT # Capturing exit signals on shell script
|
||||
}
|
||||
|
||||
TRAP_ON
|
||||
|
||||
# Source app helpers
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
# Retrieve arguments
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
|
|
|
@ -1,11 +1,27 @@
|
|||
#!/bin/bash
|
||||
set -eu
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
# Source YunoHost 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_clean_setup () {
|
||||
#### Remove this function if there's nothing to clean before calling the remove script.
|
||||
true
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
# Retrieve old app settings
|
||||
path=$(ynh_app_setting_get $app path)
|
||||
domain=$(ynh_app_setting_get $app domain)
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
#!/bin/bash
|
||||
set -eu
|
||||
|
||||
# Source app helpers
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
# Retrieve arguments
|
||||
|
@ -23,6 +28,20 @@ else
|
|||
echo "${final_path} exists, we don't create it."
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_print_info "Backing up the app before upgrading (may take a while)..."
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
# restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
if [ -z "$statedir" ];
|
||||
then
|
||||
statedir="/home/yunohost.app/$app"
|
||||
|
@ -64,8 +83,8 @@ ynh_package_install_from_equivs ../conf/z-push-deps.control \
|
|||
|
||||
|
||||
# Cleaning
|
||||
sudo rm -rf $final_path
|
||||
sudo rm -rf $final_logpath
|
||||
ynh_secure_remove "$final_path"
|
||||
ynh_secure_remove "$final_logpath"
|
||||
sudo rm -f $final_nginxconf
|
||||
sudo rm -f $final_phpconf
|
||||
sudo rm -f /etc/logrotate.d/$app
|
||||
|
|
Loading…
Add table
Reference in a new issue