mirror of
https://github.com/YunoHost-Apps/emailpoubelle_ynh.git
synced 2024-09-03 18:26:29 +02:00
fix
This commit is contained in:
parent
95f7d1b20a
commit
8b8395ab5c
11 changed files with 87 additions and 126 deletions
|
@ -1,10 +1,10 @@
|
|||
;; Complete Test
|
||||
# Comment ignored
|
||||
; Manifest
|
||||
domain="domain.tld" (DOMAIN)
|
||||
path="/poubelle" (PATH)
|
||||
admin="john" (USER)
|
||||
is_public=1 (PUBLIC|public=1|private=0)
|
||||
domain="domain.tld"
|
||||
path="/poubelle"
|
||||
admin="john"
|
||||
is_public=1
|
||||
password="password"
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
|
@ -16,9 +16,7 @@
|
|||
upgrade=1
|
||||
backup_restore=1
|
||||
multi_instance=0
|
||||
incorrect_path=1
|
||||
change_url=1
|
||||
|
||||
;;; Options
|
||||
Email=
|
||||
Notification=none
|
||||
|
|
|
@ -1 +1 @@
|
|||
0 */2 * * * www-data cd $final_path/www/; /usr/bin/php index.php > /dev/null 2>&1
|
||||
0 */2 * * * www-data cd $final_path/www/; /usr/bin/php__PHPVERSION__ index.php > /dev/null
|
|
@ -33,7 +33,7 @@ group = __USER__
|
|||
; (IPv6 and IPv4-mapped) on a specific port;
|
||||
; '/path/to/unix/socket' - to listen on a unix socket.
|
||||
; Note: This value is mandatory.
|
||||
listen = /var/run/php/php__PHPVERSION__-fpm.sock
|
||||
listen = /var/run/php/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock
|
||||
|
||||
; Set listen(2) backlog.
|
||||
; Default Value: 511 (-1 on FreeBSD and OpenBSD)
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
"email": "misterl56@hotmail.com"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 4.2.0"
|
||||
"yunohost": ">= 4.2.8"
|
||||
},
|
||||
"multi_instance": false,
|
||||
"services": [
|
||||
|
@ -28,8 +28,7 @@
|
|||
"install" : [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain",
|
||||
"example": "domain.org"
|
||||
"type": "domain"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
|
@ -40,7 +39,6 @@
|
|||
{
|
||||
"name": "admin",
|
||||
"type": "user",
|
||||
"example": "homer",
|
||||
"help": {
|
||||
"en": "Admin user can access to the control panel, block and remove all redirection and reset any settings",
|
||||
"fr": "L'administrateur peut accéder au panneau de controle, bloquer et supprimer les redirections ainsi que réinitialiser les réglages"
|
||||
|
@ -48,8 +46,7 @@
|
|||
},
|
||||
{
|
||||
"name": "password",
|
||||
"type": "password",
|
||||
"example": "AveryStrongPassword"
|
||||
"type": "password"
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#=================================================
|
||||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
||||
YNH_PHP_VERSION="7.3"
|
||||
extra_php_dependencies="php${YNH_PHP_VERSION}-geoip php${YNH_PHP_VERSION}-cli"
|
||||
app="emailpoubelle"
|
||||
|
||||
lang="fr_FR.UTF-8 en_US.UTF-8 it_IT.UTF-8"
|
||||
|
|
|
@ -7,11 +7,7 @@
|
|||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
#if [ ! -e _common.sh ]; then
|
||||
# # Get the _common.sh file if it's not in the current directory
|
||||
# cp ../settings/scripts/_common.sh ./_common.sh
|
||||
# chmod a+rx _common.sh
|
||||
#fi
|
||||
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
@ -64,7 +60,7 @@ ynh_backup --src_path="/etc/cron.d/$app"
|
|||
# BACKUP postfix conf
|
||||
#=================================================
|
||||
|
||||
ynh_backup "/usr/share/yunohost/hooks/conf_regen/98-postfix_emailpoubelle"
|
||||
ynh_backup --src_path="/usr/share/yunohost/hooks/conf_regen/98-postfix_emailpoubelle"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -67,14 +67,10 @@ then
|
|||
change_path=1
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating NGINX web server configuration..." --time --weight=1
|
||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
|
||||
|
||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||
|
||||
|
@ -100,21 +96,10 @@ then
|
|||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC MODIFICATIONS
|
||||
#=================================================
|
||||
# ...
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
#=================================================
|
||||
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
@ -122,4 +107,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Change of URL completed for $app" --time --last
|
||||
ynh_script_progression --message="Change of URL completed for $app" --last
|
||||
|
|
|
@ -5,34 +5,38 @@
|
|||
#=================================================
|
||||
# IMPORT GENERIC 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 FROM THE MANIFEST
|
||||
#=================================================
|
||||
|
||||
# Retrieve arguments
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url=$YNH_APP_ARG_PATH
|
||||
admin=$YNH_APP_ARG_ADMIN
|
||||
ynh_print_OFF
|
||||
password=$YNH_APP_ARG_PASSWORD
|
||||
ynh_print_ON
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
final_path=/var/www/$app
|
||||
db_user=emailPoubelle
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
||||
final_path=/var/www/$app
|
||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
||||
|
||||
# Check web path availability
|
||||
ynh_webpath_available $domain $path_url
|
||||
final_path=/var/www/$app
|
||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||
|
||||
# Register (book) web path
|
||||
ynh_webpath_register $app $domain $path_url
|
||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||
|
||||
# Check user
|
||||
ynh_user_exists "$admin"
|
||||
|
@ -42,11 +46,9 @@ ynh_user_exists "$admin"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Storing installation settings..." --weight=1
|
||||
|
||||
ynh_app_setting_set $app domain $domain
|
||||
ynh_app_setting_set $app path $path_url
|
||||
ynh_app_setting_set $app admin $admin
|
||||
ynh_app_setting_set $app db_name $db_user
|
||||
ynh_app_setting_set $app final_path $final_path
|
||||
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
||||
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
||||
|
||||
#=================================================
|
||||
#INSTALL DEPENDENCIES
|
||||
|
@ -63,8 +65,8 @@ locale-gen
|
|||
#=================================================
|
||||
#INSTALL SOURCES
|
||||
#===============================================
|
||||
|
||||
ynh_script_progression --message="Setting up source files..." --weight=5
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source "$final_path"
|
||||
cp ../conf/index_source.php $final_path/www/index.php
|
||||
|
@ -117,8 +119,8 @@ chmod 644 /etc/cron.d/$app
|
|||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
||||
|
||||
ynh_script_progression --message="Configuring nginx web server..." --weight=1
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
|
@ -127,12 +129,13 @@ ynh_add_nginx_config
|
|||
ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
|
||||
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config
|
||||
ynh_add_fpm_config --package="$extra_php_dependencies"
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||
|
||||
# Make app public if necessary
|
||||
if [ "$is_public" -eq 1 ]
|
||||
|
@ -144,6 +147,8 @@ fi
|
|||
#=================================================
|
||||
# RELOAD SERVICES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=2
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
ynh_systemd_action --service_name=postfix --action=reload
|
||||
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
|
||||
|
@ -151,4 +156,5 @@ ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
|
|||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Installation of $app completed" --last
|
||||
|
|
|
@ -21,8 +21,6 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|||
db_user=$db_name
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
|
||||
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
|
@ -31,17 +29,6 @@ ynh_script_progression --message="Removing the MySQL database..."
|
|||
# Remove a database if it exists, along with the associated user
|
||||
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..."
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
|
@ -50,27 +37,27 @@ ynh_script_progression --message="Removing app main directory..."
|
|||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="$final_path"
|
||||
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing nginx web server configuration..."
|
||||
ynh_script_progression --message="Removing NGINX web server configuration..."
|
||||
|
||||
# Remove the dedicated nginx config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC REMOVE
|
||||
#=================================================
|
||||
# REMOVE THE CRON FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing cron job and aliases..."
|
||||
|
||||
ynh_secure_remove --file="/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
#removing aliases
|
||||
#=================================================
|
||||
|
||||
ynh_replace_string "devnull:/dev/null" "" /etc/aliases
|
||||
newaliases
|
||||
|
||||
|
@ -90,4 +77,8 @@ yunohost tools regen-conf postfix
|
|||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
ynh_systemd_action --service_name=postfix --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Removal of $app completed"
|
||||
|
|
|
@ -2,16 +2,10 @@
|
|||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
#if [ ! -e _common.sh ]; then
|
||||
# # Get the _common.sh file if it's not in the current directory
|
||||
# cp ../settings/scripts/_common.sh ./_common.sh
|
||||
# chmod a+rx _common.sh
|
||||
#fi
|
||||
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
@ -40,8 +34,6 @@ admin=$(ynh_app_setting_get $app admin)
|
|||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
||||
|
||||
ynh_webpath_available $domain $path_url \
|
||||
|| ynh_die "Path not available: ${domain}${path_url}"
|
||||
test ! -d $final_path \
|
||||
|| ynh_die "There is already a directory: $final_path "
|
||||
|
||||
|
@ -61,7 +53,16 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
||||
|
||||
ynh_restore_file "$final_path"
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reconfiguring PHP-FPM..." --weight=5
|
||||
|
||||
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
|
||||
ynh_add_fpm_config --package="$extra_php_dependencies"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
|
@ -87,7 +88,6 @@ for i in $lang ; do
|
|||
done
|
||||
locale-gen
|
||||
|
||||
|
||||
#=================================================
|
||||
# RESTORE POSTFIX ALIASES
|
||||
#=================================================
|
||||
|
|
|
@ -13,31 +13,39 @@ source /usr/share/yunohost/helpers
|
|||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
domain=$(ynh_app_setting_get $app domain)
|
||||
path_url=$(ynh_app_setting_get $app path)
|
||||
admin=$(ynh_app_setting_get $app admin)
|
||||
final_path=$(ynh_app_setting_get $app final_path)
|
||||
db_name=$(ynh_app_setting_get $app db_name)
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
|
||||
### This helper will compare the version of the currently installed app and the version of the upstream package.
|
||||
### $upgrade_type can have 2 different values
|
||||
### - UPGRADE_APP if the upstream app version has changed
|
||||
### - UPGRADE_PACKAGE if only the YunoHost package has changed
|
||||
### ynh_check_app_version_changed will stop the upgrade if the app is up to date.
|
||||
### UPGRADE_APP should be used to upgrade the core app only if there's an upgrade to do.
|
||||
### Not used yet in this script
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="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
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..."
|
||||
# Fix is_public as a boolean value
|
||||
|
||||
# If db_name doesn't exist, create it
|
||||
if [ -z "$db_name" ]; then
|
||||
|
@ -51,35 +59,13 @@ if [ -z "$final_path" ]; then
|
|||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
fi
|
||||
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="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
|
||||
|
||||
#=================================================
|
||||
# Migrate legacy permissions to new system
|
||||
#=================================================
|
||||
if ynh_legacy_permissions_exists
|
||||
then
|
||||
ynh_legacy_permissions_delete_all
|
||||
ynh_legacy_permissions_delete_all
|
||||
|
||||
ynh_app_setting_delete --app=$app --key=is_public
|
||||
ynh_app_setting_delete --app=$app --key=is_public
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# CHECK THE PATH
|
||||
#=================================================
|
||||
# Normalize the URL path syntax
|
||||
|
||||
#=================================================
|
||||
#check for matlink's version - DEPRECATED - uninstall & reinstall
|
||||
#=================================================
|
||||
|
@ -139,6 +125,7 @@ ynh_add_nginx_config
|
|||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..."
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
|
@ -157,8 +144,8 @@ fi
|
|||
#=================================================
|
||||
#INSTALL SOURCES
|
||||
#===============================================
|
||||
|
||||
ynh_script_progression --message="Upgrading source files..."
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source "$final_path"
|
||||
cp ../conf/index_source.php $final_path/www/index.php
|
||||
|
@ -190,17 +177,17 @@ yunohost tools regen-conf postfix -f
|
|||
chown -R www-data:www-data $final_path
|
||||
chown root:root /etc/cron.d/$app
|
||||
|
||||
|
||||
#=================================================
|
||||
# RELOAD SERVICES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=php$phpversion-fpm --action=restart
|
||||
|
||||
ynh_script_progression --message="Reloading nginx web server..."
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
ynh_script_progression --message="Reloading postfix..."
|
||||
ynh_systemd_action --service_name=postfix --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Upgrade of $app completed" --last
|
||||
|
|
Loading…
Add table
Reference in a new issue