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

fix linter

This commit is contained in:
ericgaspar 2021-03-18 21:55:13 +01:00
parent fe18ac693a
commit 4499901096
No known key found for this signature in database
GPG key ID: 574F281483054D44
9 changed files with 55 additions and 100 deletions

View file

@ -1,7 +1,7 @@
# Emailpoubelle for YunoHost
[![Integration level](https://dash.yunohost.org/integration/emailpoubelle.svg)](https://dash.yunohost.org/appci/app/emailpoubelle) ![](https://ci-apps.yunohost.org/ci/badges/emailpoubelle.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/emailpoubelle.maintain.svg)
[![Install Emailpoubelle with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=emailpoubelle)
[![Install Emailpoubelle with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=emailpoubelle)
> *This package allows you to install Emailpoubelle quickly and simply on a YunoHost server.
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*

View file

@ -16,11 +16,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.1.7"
},
"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

@ -2,16 +2,11 @@
#=================================================
# 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
# 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
@ -25,7 +20,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
@ -34,39 +29,38 @@ domain=$(ynh_app_setting_get $app domain)
db_name=$(ynh_app_setting_get $app db_name)
#=================================================
# STANDARD BACKUP STEPS
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#=================================================
# 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_print_info --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 +68,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)." --last

View file

@ -26,16 +26,12 @@ 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"
# Normalize the url path syntax
path_url=$(ynh_normalize_url_path $path_url)
# Check web path availability
ynh_webpath_available $domain $path_url
# 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"
@ -45,17 +41,17 @@ 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 is_public $is_public
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
ynh_app_setting_set --app=$app --key=db_name --value=$db_user
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
#=================================================
#INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=15
ynh_install_app_dependencies $pkg_dependencies
#install locale (nginx will restart at the end of the install)
@ -68,8 +64,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
@ -80,7 +76,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
#===============================================
@ -135,25 +130,35 @@ cp -a ../conf/$app.cron /etc/cron.d/$app
chown root:root /etc/cron.d/$app
chmod 644 /etc/cron.d/$app
# Create a dedicated nginx config
ynh_script_progression --message="Configuring nginx web server..." --weight=2
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
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
#=================================================
# RELOAD SERVICES
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
ynh_systemd_action --service_name=postfix --action=reload
service php* reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last

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
#=================================================
@ -31,8 +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
#=================================================
@ -41,7 +37,6 @@ ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# REMOVE APP MAIN DIR
#=================================================
@ -50,7 +45,6 @@ ynh_script_progression --message="Removing app main directory..."
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
@ -59,18 +53,19 @@ 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 +85,8 @@ yunohost tools regen-conf postfix
ynh_systemd_action --service_name=nginx --action=reload
ynh_systemd_action --service_name=postfix --action=reload
ynh_script_progression --message="Removal of $app completed"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last

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

@ -16,7 +16,6 @@ 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)
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
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)
@ -25,27 +24,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,11 +43,18 @@ 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
#=================================================
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 () {
@ -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
#=================================================
@ -191,7 +174,6 @@ yunohost tools regen-conf postfix -f
chown -R www-data:www-data $final_path
chown root:root /etc/cron.d/$app
#=================================================
# RELOAD SERVICES
#=================================================
@ -204,5 +186,8 @@ ynh_systemd_action --service_name=nginx --action=reload
ynh_script_progression --message="Reloading postfix..."
ynh_systemd_action --service_name=postfix --action=reload
ynh_script_progression --message="Upgrade of $app completed" --last
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last