1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/emailpoubelle_ynh.git synced 2024-09-03 18:26:29 +02:00

Cleaning up

This commit is contained in:
ericgaspar 2021-06-24 09:59:49 +02:00
parent fe18ac693a
commit 54b3688751
No known key found for this signature in database
GPG key ID: 574F281483054D44
8 changed files with 21 additions and 82 deletions

View file

@ -1,10 +1,9 @@
;; 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,11 +15,7 @@
upgrade=1
backup_restore=1
multi_instance=0
incorrect_path=1
port_already_use=0 (XXXX)
change_url=0
;;; Levels
Level 5=auto
;;; Options
Email=
Notification=none

View file

@ -14,7 +14,7 @@
"email": "misterl56@hotmail.com"
},
"requirements": {
"yunohost": ">= 3.5.2"
"yunohost": ">= 4.2.0"
},
"multi_instance": false,
"services": [
@ -28,29 +28,17 @@
{
"name": "domain",
"type": "domain",
"ask": {
"en": "Choose a domain for emailpoubelle",
"fr": "Choisissez un domaine pour emailpoubelle"
},
"example": "domain.org"
},
{
"name": "path",
"type": "path",
"ask": {
"en": "Choose a path for emailpoubelle",
"fr": "Choisissez un chemin pour emailpoubelle"
},
"example": "/poubelle",
"default": "/poubelle"
},
{
"name": "admin",
"type": "user",
"ask": {
"en": "Choose an admin user for emailpoubelle",
"fr": "Choisissez un administrateur pour emailpoubelle"
},
"example": "homer",
"help": {
"en": "Admin user can access to the control panel, block and remove all redirection and reset any settings",
@ -60,19 +48,11 @@
{
"name": "password",
"type": "password",
"ask": {
"en": "Enter a password to access the admin panel",
"fr": "Entrer un mot de passe pour accéder au tableau d'administration"
},
"example": "AveryStrongPassword"
},
{
"name": "is_public",
"type": "boolean",
"ask": {
"en": "Is it a public application?",
"fr": "Est-ce une application publique ?"
},
"default": false,
"help": {
"en": "The app can be accessed outside Yunohost and anyone will be able to create a trash email adress",

View file

@ -1,6 +1,7 @@
#=================================================
# COMMON VARIABLES
#=================================================
pkg_dependencies="php-geoip php7.0-cli"
app="emailpoubelle"
lang="fr_FR.UTF-8 en_US.UTF-8 it_IT.UTF-8"

View file

@ -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
@ -25,7 +21,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
@ -38,35 +34,30 @@ db_name=$(ynh_app_setting_get $app db_name)
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Backing up the main app directory..."
ynh_backup --src_path="$final_path"
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Backing up nginx web server configuration..."
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Backing up the MySQL database..."
ynh_mysql_dump_db "$db_name" > db.sql
#=================================================
# BACKUP THE CRON FILE
#=================================================
ynh_script_progression --message="Backing up cron configuration..."
ynh_backup --src_path="/etc/cron.d/$app"
#=================================================
# BACKUP postfix conf
#=================================================
ynh_script_progression --message="Backing up postfix conf configuration..."
ynh_backup "/usr/share/yunohost/hooks/conf_regen/98-postfix_emailpoubelle"
@ -74,4 +65,4 @@ ynh_backup "/usr/share/yunohost/hooks/conf_regen/98-postfix_emailpoubelle"
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -26,6 +26,7 @@ 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"
@ -80,7 +81,6 @@ ln -s $final_path/lang/fr $final_path/lang/fr_FR
ln -s $final_path/lang/it $final_path/lang/it_IT
ln -s $final_path/www/template-exemple $final_path/template-exemple
#===============================================
#SETTINGS & DATABASE
#===============================================
@ -142,12 +142,12 @@ ynh_add_nginx_config
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary
if [ $is_public -eq 1 ]
then
# unprotected_uris allows SSO credentials to be passed anyway.
ynh_app_setting_set $app unprotected_uris "/"
ynh_permission_update --permission="main" --add="visitors"
fi
#=================================================

View file

@ -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
#=================================================
@ -41,7 +39,6 @@ ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# REMOVE APP MAIN DIR
#=================================================
@ -50,7 +47,6 @@ ynh_script_progression --message="Removing app main directory..."
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
@ -59,7 +55,6 @@ ynh_script_progression --message="Removing nginx web server configuration..."
# Remove the dedicated nginx config
ynh_remove_nginx_config
#=================================================
# SPECIFIC REMOVE
#=================================================

View file

@ -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
@ -87,7 +83,6 @@ for i in $lang ; do
done
locale-gen
#=================================================
# RESTORE POSTFIX ALIASES
#=================================================
@ -126,4 +121,4 @@ ynh_systemd_action --service_name=postfix --action=reload
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app" --last
ynh_script_progression --message="Restoration completed for $app" --last

View file

@ -25,27 +25,12 @@ db_name=$(ynh_app_setting_get $app 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)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
# Fix is_public as a boolean value
if [ "$is_public" = "Yes" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=1
is_public=1
elif [ "$is_public" = "No" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=0
is_public=0
fi
# If db_name doesn't exist, create it
if [ -z "$db_name" ]; then
@ -59,6 +44,12 @@ if [ -z "$final_path" ]; then
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
@ -73,14 +64,6 @@ ynh_clean_setup () {
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CHECK THE PATH
#=================================================
# Normalize the URL path syntax
path_url=$(ynh_normalize_url_path $path_url)
#=================================================
#check for matlink's version - DEPRECATED - uninstall & reinstall
#=================================================
@ -140,6 +123,7 @@ ynh_add_nginx_config
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..."
ynh_install_app_dependencies $pkg_dependencies
#=================================================
@ -191,7 +175,6 @@ yunohost tools regen-conf postfix -f
chown -R www-data:www-data $final_path
chown root:root /etc/cron.d/$app
#=================================================
# RELOAD SERVICES
#=================================================
@ -205,4 +188,3 @@ ynh_script_progression --message="Reloading postfix..."
ynh_systemd_action --service_name=postfix --action=reload
ynh_script_progression --message="Upgrade of $app completed" --last