1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/emailpoubelle_ynh.git synced 2024-09-03 18:26:29 +02:00
This commit is contained in:
Éric Gaspar 2023-04-06 13:48:27 +02:00
parent fb0cfff9cf
commit 2a7a9bcf80
9 changed files with 24 additions and 369 deletions

View file

@ -1,59 +0,0 @@
{
"name": "EmailPoubelle",
"id": "emailpoubelle",
"packaging_format": 1,
"description": {
"en": "Create throwable email address redirected to your real one",
"fr": "Créez des adresses email jetables qui redirigent les mails vers votre adresse réelle"
},
"version": "2022.06.08~ynh1",
"url": "https://framagit.org/kepon/emailPoubellePhp/",
"upstream": {
"license": "Beerware",
"website": "https://forge.zici.fr/project/view/6",
"demo": "https://poubelle.zici.fr",
"code": "https://framagit.org/kepon/emailPoubellePhp"
},
"license": "Beerware",
"maintainer": {
"name": "Krakinou",
"email": "misterl56@hotmail.com"
},
"requirements": {
"yunohost": ">= 4.3.0"
},
"multi_instance": false,
"services": [
"nginx",
"mysql",
"dovecot",
"postfix"
],
"arguments": {
"install": [
{
"name": "domain",
"type": "domain"
},
{
"name": "path",
"type": "path",
"example": "/poubelle",
"default": "/poubelle"
},
{
"name": "is_public",
"type": "boolean",
"default": false
},
{
"name": "admin",
"type": "user"
},
{
"name": "password",
"type": "password"
}
]
}
}

View file

@ -14,26 +14,22 @@ license = "Beerware"
website = "https://forge.zici.fr/project/view/6"
demo = "https://poubelle.zici.fr"
code = "https://framagit.org/kepon/emailPoubellePhp"
cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number)
fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin.
[integration]
yunohost = ">= 4.3.0"
architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"]
yunohost = ">= 11.1.17"
architectures = "all"
multi_instance = false
ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials.
sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal.
disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ...
ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
ldap = false
sso = false
disk = "50M"
ram.build = "50M"
ram.runtime = "50M"
[install]
[install.domain]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "domain"
[install.path]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "path"
default = "/poubelle"
@ -42,11 +38,9 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen
default = false
[install.admin]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "user"
[install.password]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "password"
[resources]
@ -54,7 +48,6 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen
url = "https://framagit.org/kepon/emailPoubellePhp/-/archive/d25ae5b243f5dbd8c2b023b80b6406c110843586/emailPoubellePhp-d25ae5b243f5dbd8c2b023b80b6406c110843586.tar.gz"
sha256 = "4b96d268ecf81684a91c31416b16f2b79a7409416dfd67cdd720d4d13b2ae1d8"
[resources.system_user]
[resources.install_dir]
@ -62,5 +55,8 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen
[resources.permissions]
main.url = "/"
[resources.packaging_format]
packages = "mariadb-server, php7.4-geoip, php7.4-cli"
[resources.database]
type = "mysql"

View file

@ -4,8 +4,6 @@
# COMMON VARIABLES
#=================================================
# dependencies used by the app
#REMOVEME? pkg_dependencies="php$YNH_DEFAULT_PHP_VERSION-geoip php$YNH_DEFAULT_PHP_VERSION-cli"
lang="fr_FR.UTF-8 en_US.UTF-8 it_IT.UTF-8"
#=================================================

View file

@ -10,25 +10,6 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_print_info --message="Loading installation settings..."
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================

View file

@ -9,54 +9,12 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
#REMOVEME? domain=$YNH_APP_ARG_DOMAIN
#REMOVEME? path=$YNH_APP_ARG_PATH
#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC
#REMOVEME? admin=$YNH_APP_ARG_ADMIN
#REMOVEME? password=$YNH_APP_ARG_PASSWORD
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1
#REMOVEME? install_dir=/var/www/$app
#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder"
# Register (book) web path
#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=1
#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain
#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path
#REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin
#REMOVEME? ynh_app_setting_set --app=$app --key=password --value=$password
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# INSTALL DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=15
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
ynh_script_progression --message="Installing dependencies..." --weight=15
#install locale (nginx will restart at the end of the install)
for i in $lang ; do
@ -65,38 +23,18 @@ done
locale-gen
#=================================================
# CREATE DEDICATED USER
#=================================================
#REMOVEME? ynh_script_progression --message="Configuring system user..."
# Create a system user
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#=================================================
# CREATE A MYSQL DATABASE
#=================================================
#REMOVEME? ynh_script_progression --message="Creating a MySQL database..."
#REMOVEME? db_name=$(ynh_sanitize_dbid --db_name=$app)
#REMOVEME? db_user=$db_name
#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name
#REMOVEME? ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=5
#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir"
ynh_add_config --template="../conf/index_source.php" --destination="$install_dir/www/index.php"
#REMOVEME? ynh_secure_remove --file="$install_dir/www/admin.php"
ynh_secure_remove --file="$install_dir/www/admin.php"
ln -s $install_dir/lib $install_dir/www/lib
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
@ -149,28 +87,6 @@ ynh_add_config --template="../conf/emailpoubelle.cron" --destination="/etc/cron.
chown root:root /etc/cron.d/$app
chmod 644 /etc/cron.d/$app
#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP SSOWAT
#=================================================
#REMOVEME? ynh_script_progression --message="Configuring permissions..."
# Make app public if necessary
#REMOVEME? if [ $is_public -eq 1 ]
then
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
#REMOVEME? ynh_permission_update --permission="main" --add="visitors"
fi
#=================================================
# RELOAD NGINX
#=================================================
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..."
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -9,37 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_script_progression --message="Loading installation settings..."
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#REMOVEME? db_user=$db_name
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================
#REMOVEME? ynh_script_progression --message="Removing the MySQL database..."
# Remove a database if it exists, along with the associated user
#REMOVEME? ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE APP MAIN DIR
#=================================================
#REMOVEME? ynh_script_progression --message="Removing app main directory..."
# Remove the app directory securely
#REMOVEME? ynh_secure_remove --file="$install_dir"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
@ -56,14 +25,6 @@ ynh_script_progression --message="Removing PHP-FPM configuration..."
# Remove the dedicated PHP-FPM config
ynh_remove_fpm_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies
#REMOVEME? ynh_remove_app_dependencies
#=================================================
# SPECIFIC REMOVE
#=================================================
@ -81,16 +42,6 @@ ynh_secure_remove --file="/usr/share/yunohost/hooks/conf_regen/98-postfix_emailp
yunohost tools regen-conf postfix
ynh_systemd_action --service_name=postfix --action=reload
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..."
# Delete a system user
#REMOVEME? ynh_system_user_delete --username=$app
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -10,45 +10,6 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#REMOVEME? db_user=$db_name
#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1
#REMOVEME? test ! -d $install_dir \
|| ynh_die --message="There is already a directory: $install_dir "
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
@ -56,7 +17,6 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
ynh_restore_file --origin_path="$install_dir"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
@ -65,10 +25,7 @@ chown -R $app:www-data "$install_dir"
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=15
# Define and install dependencies
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
ynh_script_progression --message="Reinstalling dependencies..." --weight=15
#Check & regen local
for i in $lang ; do
@ -93,10 +50,8 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
#REMOVEME? ynh_script_progression --message="Restoring the MySQL database..." --weight=1
ynh_script_progression --message="Restoring the MySQL database..." --weight=1
#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
#REMOVEME? ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#=================================================

View file

@ -9,87 +9,12 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_script_progression --message="Loading installation settings..."
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin)
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#REMOVEME? db_user=$db_name
#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
#REMOVEME? password=$(ynh_app_setting_get --app=$app --key=password)
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
# Backup the current version of the app
#REMOVEME? ynh_backup_before_upgrade
#REMOVEME? ynh_clean_setup () {
# Restore it if the upgrade fails
#REMOVEME? ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
# Cleaning legacy permissions
#REMOVEME? if ynh_legacy_permissions_exists; then
#REMOVEME? ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
# If db_name doesn't exist, create it
if [ -z "$db_name" ]; then
db_name=$(ynh_sanitize_dbid --db_name=$app)
#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name
fi
# If install_dir doesn't exist, create it
if [ -z "$install_dir" ]; then
#REMOVEME? install_dir=/var/www/$app
#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
fi
if [ -z $db_pwd ]; then
db_pwd=$(grep DBPASS $install_dir/conf.php | cut -d"'" -f4)
#REMOVEME? ynh_app_setting_set --app=$app --key=mysqlpwd --value=$db_pwd
fi
if [ -z $password ]; then
password=$(grep ADMIN_PASSWORD $install_dir/conf.php | cut -d"'" -f4)
#REMOVEME? ynh_app_setting_set --app=$app --key=password --value=$password
fi
#=================================================
# CREATE DEDICATED USER
#=================================================
#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -101,22 +26,14 @@ then
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --keep="conf.php www/index.php"
ynh_add_config --template="../conf/index_source.php" --destination="$install_dir/www/index.php"
#REMOVEME? ynh_secure_remove --file="$install_dir/www/admin.php"
ynh_secure_remove --file="$install_dir/www/admin.php"
ln -s $install_dir/lib $install_dir/www/lib
fi
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Upgrading dependencies..."
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
@ -155,15 +72,6 @@ ynh_add_config --template="../conf/emailpoubelle.cron" --destination="/etc/cron.
chown root:root /etc/cron.d/$app
chmod 644 /etc/cron.d/$app
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX
#=================================================
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..."
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================

9
tests.toml Normal file
View file

@ -0,0 +1,9 @@
test_format = 1.0
[default]
# -------------------------------
# Commits to test upgrade from
# -------------------------------
test_upgrade_from.d83328c3e0d7dbbc317ded2924ac08ba3cc51d3e.name = "Upgrade from 2.0~ynh5"