From 0791736ba659f87d849637736c6971494b39868d Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 18 Sep 2023 15:21:27 +0200 Subject: [PATCH] Attempt to finish packaging v2 ... --- check_process | 30 -------------- conf/extra_php-fpm.conf | 0 doc/DISCLAIMER.md | 3 -- manifest.toml | 10 ++--- scripts/_common.sh | 20 ---------- scripts/install | 87 +++-------------------------------------- scripts/remove | 31 +-------------- scripts/restore | 5 --- tests.toml | 5 +++ 9 files changed, 16 insertions(+), 175 deletions(-) delete mode 100644 check_process create mode 100644 conf/extra_php-fpm.conf delete mode 100644 doc/DISCLAIMER.md create mode 100644 tests.toml diff --git a/check_process b/check_process deleted file mode 100644 index 6878b03..0000000 --- a/check_process +++ /dev/null @@ -1,30 +0,0 @@ -;; Test complet - ; Manifest - domain="domain.tld" - path="/path" - is_public=1 - language="fr" - admin="john" - password="password" - expiration="0" - deletion="0" - ; Checks - pkg_linter=1 - setup_sub_dir=1 - setup_root=1 - setup_nourl=0 - setup_private=1 - setup_public=1 - upgrade=1 - # 1.0.3~ynh3 - upgrade=1 from_commit=79cdc1a139ff06805647cb56e5eab1d595ee0259 - backup_restore=1 - multi_instance=1 - port_already_use=0 - change_url=1 -;;; Options -Email=ljf+framaforms_ynh@reflexlibre.net -Notification=yes -;;; Upgrade options - ; commit=25e97123f0e82ec1b9375774f3e86b7d8f5d73cf - name=#34 from YunoHost-Apps/testing diff --git a/conf/extra_php-fpm.conf b/conf/extra_php-fpm.conf new file mode 100644 index 0000000..e69de29 diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md deleted file mode 100644 index 08d2fff..0000000 --- a/doc/DISCLAIMER.md +++ /dev/null @@ -1,3 +0,0 @@ -## Configuration - -You can modify some configurations using the Framaforms administration panel. You can log in with the admin user and the password you gave during installation. diff --git a/manifest.toml b/manifest.toml index 17540ea..4b7f693 100644 --- a/manifest.toml +++ b/manifest.toml @@ -7,7 +7,7 @@ description.fr = "Créez des formulaires et questionnaires en ligne" version = "1.1~ynh1" -maintainers = ["ljf"] +maintainers = [] [upstream] license = "GPL-2.0-only" @@ -18,11 +18,11 @@ code = "https://framagit.org/yakforms/yakforms" yunohost = ">= 4.3.0" architectures = "all" multi_instance = true -ldap = "true" +ldap = true 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 = "500M" # 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, ... +disk = "500M" +ram.build = "50M" +ram.runtime = "50M" [install] [install.domain] diff --git a/scripts/_common.sh b/scripts/_common.sh index b1a41c7..a29d197 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,23 +1,3 @@ #!/bin/bash -#================================================= -# COMMON VARIABLES -#================================================= - - - - - YNH_COMPOSER_VERSION="1.10.17" - -#================================================= -# PERSONAL HELPERS -#================================================= - -#================================================= -# EXPERIMENTAL HELPERS -#================================================= - -#================================================= -# FUTURE OFFICIAL HELPERS -#================================================= diff --git a/scripts/install b/scripts/install index ebb7a8e..3dfc236 100644 --- a/scripts/install +++ b/scripts/install @@ -9,83 +9,8 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# Exit if an error occurs during the execution of the script - - -#================================================= -# RETRIEVE ARGUMENTS FROM THE MANIFEST -#================================================= - - - - - - - - - - - - admin_mail=$(ynh_user_get_info --username=$admin --key=mail) -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= - - - - - -# Register (book) web path - - -#================================================= -# STORE SETTINGS FROM MANIFEST -#================================================= - - - - -ynh_app_setting_set --app=$app --key=language --value=$language - - -ynh_app_setting_set --app=$app --key=expiration --value=$expiration -ynh_app_setting_set --app=$app --key=deletion --value=$deletion - -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# INSTALL DEPENDENCIES -#================================================= - - - - -#================================================= -# CREATE DEDICATED USER -#================================================= - - -# Create a system user - - -#================================================= -# CREATE A POSTGRESQL DATABASE -#================================================= - - - - - - - - - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -105,8 +30,7 @@ chown -R $app:www-data "$install_dir" ynh_script_progression --message="Configuring PHP-FPM..." --weight=1 # Create a dedicated PHP-FPM config -ynh_add_fpm_config --usage=low --footprint=low - +ynh_add_fpm_config #================================================= # NGINX CONFIGURATION @@ -162,9 +86,6 @@ chmod 2775 "$install_dir/app/sites/default/files" #================================================= ynh_script_progression --message="Creating a data directory..." - - - mkdir -p $data_dir chmod 750 "$data_dir" @@ -186,6 +107,9 @@ chown $app:$app "$install_dir/app/sites/default/settings.php" #================================================= ynh_script_progression --message="Installing database..." --weight=19 +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" + update-alternatives --set php /usr/bin/php$phpversion ynh_exec_as $app env PATH=$PATH drush @$app site-install framaforms_org install_configure_form.site_contact_url="https://forum.yunohost.org/t/framaforms-create-polls-using-drag-and-drop/8208" install_configure_form.site_default_country=FR -y --locale="$language" --account-name="admin" --account-pass="$password" --site-name="Framaforms" --site-mail="$admin_mail" 2>&1 ynh_exec_as $app env PATH=$PATH drush @$app variable-set update_notify_emails "$admin_mail" @@ -232,7 +156,7 @@ ynh_exec_as $app env PATH=$PATH drush @$app pm-download ldap ynh_exec_as $app env PATH=$PATH drush @$app pm-enable -y ldap_servers ldap_user ldap_authentication ldap_authorization ldap_authorization_drupal_role # Generated with sudo -u postgres pg_dump -a -t ldap_servers --inserts framaforms ynh_exec_as $app env PATH=$PATH drush @$app sql-query "INSERT INTO public.ldap_servers VALUES ('localhost', 1, 'localhost', 1, 'default', 'ldap://127.0.0.1', 389, 0, 0, 3, '', NULL, 'a:2:{i:0;s:27:\"ou=users,dc=yunohost,dc=org\";i:1;s:32:\"ou=permission,dc=yunohost,dc=org\";}', 'uid', 'uid', 'mail', '', '', '', 0, 'cn=%username,ou=users,dc=yunohost,dc=org', '', '', '', 0, 'permissionynh', 0, 1, 'permission', 'memberuid', 'dn', 0, '', '$app.main', '', 0, 1000, 0);" -ynh_exec_as $app env PATH=$PATH drush @$app sql-query "INSERT INTO public.ldap_authorization VALUES (1, 'localhost', 'drupal_role', 'ldap_authorization_drupal_role', 1, 1, 0, 'a:2:{i:0;a:6:{s:12:\"user_entered\";s:24:\"utilisateur authentifié\";s:4:\"from\";s:51:\"cn=framaforms.main,ou=permission,dc=yunohost,dc=org\";s:10:\"normalized\";s:24:\"utilisateur authentifié\";s:10:\"simplified\";s:24:\"utilisateur authentifié\";s:5:\"valid\";b:0;s:13:\"error_message\";s:112:\"Role utilisateur authentifié_name does not exist and role creation is not enabled.\";}i:1;a:6:{s:12:\"user_entered\";s:13:\"administrator\";s:4:\"from\";s:52:\"cn=framaforms.admin,ou=permission,dc=yunohost,dc=org\";s:10:\"normalized\";s:13:\"administrator\";s:10:\"simplified\";s:13:\"administrator\";s:5:\"valid\";b:0;s:13:\"error_message\";s:101:\"Role administrator_name does not exist and role creation is not enabled.\";}}', 1, 0, 1, 1, 1, 1);" +ynh_exec_as $app env PATH=$PATH drush @$app sql-query "INSERT INTO public.ldap_authorization VALUES (1, 'localhost', 'drupal_role', 'ldap_authorization_drupal_role', 1, 1, 0, 'a:2:{i:0;a:6:{s:12:\"user_entered\";s:24:\"utilisateur authentifié\";s:4:\"from\";s:51:\"cn=$app.main,ou=permission,dc=yunohost,dc=org\";s:10:\"normalized\";s:24:\"utilisateur authentifié\";s:10:\"simplified\";s:24:\"utilisateur authentifié\";s:5:\"valid\";b:0;s:13:\"error_message\";s:112:\"Role utilisateur authentifié_name does not exist and role creation is not enabled.\";}i:1;a:6:{s:12:\"user_entered\";s:13:\"administrator\";s:4:\"from\";s:52:\"cn=$app.admin,ou=permission,dc=yunohost,dc=org\";s:10:\"normalized\";s:13:\"administrator\";s:10:\"simplified\";s:13:\"administrator\";s:5:\"valid\";b:0;s:13:\"error_message\";s:101:\"Role administrator_name does not exist and role creation is not enabled.\";}}', 1, 0, 1, 1, 1, 1);" cat ../conf/ldap.conf | ynh_exec_as $app env PATH=$PATH drush @$app variable-set --format=yaml ldap_authentication_conf - @@ -245,7 +169,6 @@ ynh_script_progression --message="Setuping the cron file..." ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index 842fd4a..38f107e 100644 --- a/scripts/remove +++ b/scripts/remove @@ -9,44 +9,15 @@ source _common.sh source /usr/share/yunohost/helpers - -#================================================= -# STANDARD REMOVE -#================================================= -# REMOVE DATA DIR -#================================================= - -# Remove the data directory if --purge option is used -if [ "${YNH_APP_PURGE:-0}" -eq 1 ] -then - ynh_script_progression --message="Removing app data directory..." - -fi - #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 +ynh_script_progression --message="Removing system configurations for $app ..." -# Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# REMOVE PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1 - -# Remove the dedicated PHP-FPM config ynh_remove_fpm_config -#================================================= -# SPECIFIC REMOVE -#================================================= -# REMOVE VARIOUS FILES -#================================================= -ynh_script_progression --message="Removing various files..." - -# Remove a cron file ynh_secure_remove --file="/etc/cron.d/$app" #================================================= diff --git a/scripts/restore b/scripts/restore index 17179a1..09aa400 100644 --- a/scripts/restore +++ b/scripts/restore @@ -36,11 +36,6 @@ chmod 750 "$data_dir" chmod -R o-rwx "$data_dir" chown -R $app:www-data "$data_dir" -#================================================= -# SPECIFIC RESTORATION -#================================================= - - #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..b1cf059 --- /dev/null +++ b/tests.toml @@ -0,0 +1,5 @@ +test_format = 1.0 + +[default] + + test_upgrade_from.79cdc1a13.name = "Upgrade from 1.0.3~ynh3"