From dc892b8d28843602fc5b2cb6c81efd79f9c83c72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 22 May 2023 08:21:08 +0200 Subject: [PATCH 01/36] v2 --- conf/nginx.conf | 2 +- manifest.toml | 57 +++++++++++++++++++++++ scripts/_common.sh | 6 +-- scripts/backup | 16 +++---- scripts/change_url | 74 +++++++++++++++--------------- scripts/install | 108 +++++++++++++++++++++---------------------- scripts/remove | 30 ++++++------ scripts/restore | 60 ++++++++++++------------ scripts/upgrade | 112 ++++++++++++++++++++++----------------------- 9 files changed, 262 insertions(+), 203 deletions(-) create mode 100644 manifest.toml diff --git a/conf/nginx.conf b/conf/nginx.conf index 06a9322..35f8581 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -2,7 +2,7 @@ location __PATH__/ { # Path to source - alias __FINALPATH__/htdocs/ ; + alias __INSTALL_DIR__/htdocs/ ; index index.php; diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..953ae21 --- /dev/null +++ b/manifest.toml @@ -0,0 +1,57 @@ +packaging_format = 2 + +id = "dolibarr" +name = "Dolibarr" +description.en = "Manage the various aspects of your business or association" +description.fr = "Gérez les différents aspects de votre activité pro ou associative" + +version = "17.0.0~ynh1" + +maintainers = ["mastereur"] + +[upstream] +license = "GPL-3.0-or-later" +website = "https://www.dolibarr.org/" +demo = "https://www.dolibarr.org/onlinedemo" +admindoc = "https://www.dolibarr.org/documentation-home" +userdoc = "https://www.dolibarr.org/#features" +code = "https://github.com/Dolibarr/dolibarr" +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 = ">= 11.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"] +multi_instance = true +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, ... + +[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 = "/dolibarr" + + [install.admin] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "user" + +[resources] + [resources.system_user] + + [resources.install_dir] + + [resources.data_dir] + + [resources.permissions] + main.url = "/" + + [resources.database] + type = "mysql" diff --git a/scripts/_common.sh b/scripts/_common.sh index 562acb3..21c9a08 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -3,9 +3,9 @@ #================================================= # COMMON VARIABLES #================================================= -YNH_PHP_VERSION="8.1" +#REMOVEME? YNH_PHP_VERSION="8.1" -php_dependencies="php$YNH_PHP_VERSION-mysql \ +#REMOVEME? php_dependencies="php$YNH_PHP_VERSION-mysql \ php$YNH_PHP_VERSION-imagick \ php$YNH_PHP_VERSION-gd \ php$YNH_PHP_VERSION-mbstring \ @@ -20,7 +20,7 @@ php_dependencies="php$YNH_PHP_VERSION-mysql \ php$YNH_PHP_VERSION-imap" # dependencies used by the app (must be on a single line) -pkg_dependencies="$php_dependencies" +#REMOVEME? pkg_dependencies="$php_dependencies" #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index 94a664e..0aa665b 100755 --- a/scripts/backup +++ b/scripts/backup @@ -15,19 +15,19 @@ source /usr/share/yunohost/helpers #================================================= # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." +#REMOVEME? ynh_print_info --message="Loading installation settings..." -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -domain=$(ynh_app_setting_get --app=$app --key=domain) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion) +#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 @@ -38,7 +38,7 @@ ynh_print_info --message="Declaring files to be backed up..." # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$final_path" +ynh_backup --src_path="$install_dir" #================================================= # BACKUP THE NGINX CONFIGURATION diff --git a/scripts/change_url b/scripts/change_url index 8927180..8cecbab 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -13,53 +13,53 @@ source /usr/share/yunohost/helpers # RETRIEVE ARGUMENTS #================================================= -old_domain=$YNH_APP_OLD_DOMAIN -old_path=$YNH_APP_OLD_PATH +#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN +#REMOVEME? old_path=$YNH_APP_OLD_PATH -new_domain=$YNH_APP_NEW_DOMAIN -new_path=$YNH_APP_NEW_PATH +#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN +#REMOVEME? new_path=$YNH_APP_NEW_PATH -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -# Needed for helper "ynh_add_nginx_config" -final_path=$(ynh_app_setting_get --app=$app --key=final_path) +#REMOVEME? # Needed for helper "ynh_add_nginx_config" +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 +#REMOVEME? ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 # Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { +#REMOVEME? ynh_backup_before_upgrade +#REMOVEME? ynh_clean_setup () { # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. - ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" +#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" # restore it if the upgrade fails - ynh_restore_upgradebackup +#REMOVEME? ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # CHECK WHICH PARTS SHOULD BE CHANGED #================================================= -change_domain=0 -if [ "$old_domain" != "$new_domain" ] +#REMOVEME? change_domain=0 +#REMOVEME? if [ "$old_domain" != "$new_domain" ] then - change_domain=1 + #REMOVEME? change_domain=1 fi -change_path=0 -if [ "$old_path" != "$new_path" ] +#REMOVEME? change_path=0 +#REMOVEME? if [ "$old_path" != "$new_path" ] then - change_path=1 + #REMOVEME? change_path=1 fi #================================================= @@ -69,28 +69,30 @@ fi #================================================= ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 -nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf +ynh_change_url_nginx_config -# Change the path in the nginx config file +#REMOVEME? nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf + +#REMOVEME? # Change the path in the nginx config file if [ $change_path -eq 1 ] then - # Make a backup of the original nginx config file if modified - ynh_backup_if_checksum_is_different --file="$nginx_conf_path" - # Set global variables for nginx helper - domain="$old_domain" - path_url="$new_path" - # Create a dedicated nginx config - ynh_add_nginx_config +#REMOVEME? # Make a backup of the original nginx config file if modified +#REMOVEME? ynh_backup_if_checksum_is_different --file="$nginx_conf_path" +#REMOVEME? # Set global variables for nginx helper +#REMOVEME? domain="$old_domain" +#REMOVEME? path="$new_path" +#REMOVEME? # Create a dedicated nginx config +#REMOVEME? ynh_add_nginx_config fi -# Change the domain for nginx +#REMOVEME? # Change the domain for nginx if [ $change_domain -eq 1 ] then # Delete file checksum for the old conf file location - ynh_delete_file_checksum --file="$nginx_conf_path" - mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf +#REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path" +#REMOVEME? mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf # Store file checksum for the new config file location - ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" +#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi #================================================= @@ -99,16 +101,16 @@ fi # UPDATE conf file #================================================= -ynh_replace_string --match_string="$old_domain$old_path" --replace_string="$new_domain$new_path" --target_file="$final_path/htdocs/conf/conf.php" +ynh_replace_string --match_string="$old_domain$old_path" --replace_string="$new_domain$new_path" --target_file="$install_dir/htdocs/conf/conf.php" #================================================= # GENERIC FINALISATION #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index 7ebde47..a606955 100644 --- a/scripts/install +++ b/scripts/install @@ -14,40 +14,40 @@ source /usr/share/yunohost/helpers #================================================= # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -domain=$YNH_APP_ARG_DOMAIN -path_url=$YNH_APP_ARG_PATH -admin=$YNH_APP_ARG_ADMIN +#REMOVEME? domain=$YNH_APP_ARG_DOMAIN +#REMOVEME? path=$YNH_APP_ARG_PATH +#REMOVEME? admin=$YNH_APP_ARG_ADMIN #member=0 #is_public=0 -phpversion=$YNH_PHP_VERSION +#REMOVEME? phpversion=$YNH_PHP_VERSION -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_script_progression --message="Validating installation parameters..." --weight=1 +#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1 -final_path=/var/www/$app -test ! -e "$final_path" || ynh_die --message="This path already contains a folder" +#REMOVEME? install_dir=/var/www/$app +#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder" # Register (book) web path -ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url +#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." --weight=2 +#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=2 -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 +#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 #ynh_app_setting_set --app=$app --key=is_public --value=$is_public #ynh_app_setting_set --app=$app --key=member --value=$member ynh_app_setting_set --app=$app --key=version --value=$(ynh_app_upstream_version "../manifest.json") @@ -57,27 +57,27 @@ ynh_app_setting_set --app=$app --key=version --value=$(ynh_app_upstream_version #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." --weight=1 +#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=1 -ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Configuring system user..." --weight=2 +#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=2 # Create a system user -ynh_system_user_create --username=$app --home_dir="$final_path" +#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" #================================================= # CREATE A MYSQL DATABASE #================================================= -ynh_script_progression --message="Creating a MySQL database..." --weight=1 +#REMOVEME? ynh_script_progression --message="Creating a MySQL database..." --weight=1 -db_name=$(ynh_sanitize_dbid --db_name=$app) -db_user=$db_name -ynh_app_setting_set --app=$app --key=db_name --value=$db_name -ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name +#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 ynh_mysql_execute_as_root --sql="ALTER DATABASE $db_name charset=utf8" @@ -99,15 +99,15 @@ SOURCE_FORMAT=tar.bz2 SOURCE_IN_SUBDIR=true EOF -ynh_app_setting_set --app=$app --key=final_path --value=$final_path +#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_script_progression --message="Download source files..." --weight=70 -ynh_setup_source --dest_dir="$final_path" +ynh_setup_source --dest_dir="$install_dir" # Create necessary files -datadir=$final_path/documents -touch $final_path/htdocs/conf/conf.php +#REMOVEME? data_dir=$install_dir/documents +touch $install_dir/htdocs/conf/conf.php #================================================= # PHP-FPM CONFIGURATION @@ -123,7 +123,7 @@ ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage # Create a dedicated php-fpm config ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint # Used by ynh_add_nginx_config -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # NGINX CONFIGURATION @@ -140,22 +140,22 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 -ynh_add_config --template="../conf/install.forced.php" --destination="$final_path/htdocs/install/install.forced.php" +ynh_add_config --template="../conf/install.forced.php" --destination="$install_dir/htdocs/install/install.forced.php" #================================================= # SETUP APPLICATION WITH CURL #================================================= # Set right permissions for curl install -chown -R $app: "$final_path" +chown -R $app: "$install_dir" # Set the app as temporarily public for cURL call if ! ynh_permission_has_user --permission "main" --user="visitors"; then - ynh_permission_update --permission="main" --add="visitors" +#REMOVEME? ynh_permission_update --permission="main" --add="visitors" fi # Reload NGINX -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload # Installation with curl @@ -210,14 +210,14 @@ ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < .. # Populate the database with YNH users. ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ../conf/sql/ldap_user.sql -if php$phpversion $final_path/scripts/user/sync_users_ldap2dolibarr.php commitiferror --server=localhost -y; then +if php$phpversion $install_dir/scripts/user/sync_users_ldap2dolibarr.php commitiferror --server=localhost -y; then ynh_print_info --message="LDAP user update ok" else ynh_print_info --message="LDAP user update ended with error" fi # Remove the public access -ynh_permission_update --permission="main" --remove="visitors" +#REMOVEME? ynh_permission_update --permission="main" --remove="visitors" #================================================= # MODIFY A CONFIG FILE @@ -225,37 +225,37 @@ ynh_permission_update --permission="main" --remove="visitors" # Setup HTTP auth in conf ynh_script_progression --message="configuring config file" --weight=1 -ynh_replace_string --match_string="dolibarr_main_authentication='dolibarr'" --replace_string="dolibarr_main_authentication='http'" --target_file="$final_path/htdocs/conf/conf.php" +ynh_replace_string --match_string="dolibarr_main_authentication='dolibarr'" --replace_string="dolibarr_main_authentication='http'" --target_file="$install_dir/htdocs/conf/conf.php" #================================================= # STORE THE CONFIG FILE CHECKSUM #================================================= # Calculate and store the config file checksum into the app settings -ynh_store_file_checksum --file="$final_path/htdocs/conf/conf.php" +ynh_store_file_checksum --file="$install_dir/htdocs/conf/conf.php" #================================================= # GENERIC FINALIZATION #================================================= # SECURE FILES AND DIRECTORIES #================================================= -ynh_script_progression --message="Configuring permissions..." --weight=1 +#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1 # Set permissions on app files -if [ ! -f "$datadir/install.lock" ]; then - echo 'This is a lock file to prevent use of install pages (set with permission 440)' > "$datadir/install.lock" - chown $app:$app "$datadir/install.lock" - chmod 440 "$datadir/install.lock" +if [ ! -f "$data_dir/install.lock" ]; then + echo 'This is a lock file to prevent use of install pages (set with permission 440)' > "$data_dir/install.lock" + chown $app:$app "$data_dir/install.lock" + chmod 440 "$data_dir/install.lock" fi -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" -chmod 644 "$final_path/htdocs/conf/conf.php" -mkdir -p "$datadir" -chown -R $app: "$datadir" -chmod go-w $datadir +chmod 644 "$install_dir/htdocs/conf/conf.php" +mkdir -p "$data_dir" +chown -R $app: "$data_dir" +chmod go-w $data_dir #================================================= # SETUP LOGROTATE @@ -263,24 +263,24 @@ chmod go-w $datadir ynh_script_progression --message="Configuring log rotation..." --weight=1 # Use logrotate to manage application logfile(s) -ynh_use_logrotate --logfile="$final_path/documents/dolibarr.log" +ynh_use_logrotate --logfile="$install_dir/documents/dolibarr.log" #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring permissions..." --weight=1 +#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1 # Create the public space permission if needed -if ! ynh_permission_exists --permission "public_space"; then - ynh_permission_create --permission "public_space" --url "/public/" --allowed "visitors" +#REMOVEME? if ! ynh_permission_exists --permission "public_space"; then +#REMOVEME? ynh_permission_create --permission "public_space" --url "/public/" --allowed "visitors" fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index 07f811b..e245996 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,40 +12,40 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -port=$(ynh_app_setting_get --app=$app --key=port) -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) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) +#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 DEPENDENCIES #================================================= -ynh_script_progression --message="Removing dependencies..." --weight=1 +#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=1 # Remove metapackage and its dependencies -ynh_remove_app_dependencies +#REMOVEME? ynh_remove_app_dependencies #================================================= # REMOVE THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Removing the MySQL database..." --weight=9 +#REMOVEME? ynh_script_progression --message="Removing the MySQL database..." --weight=9 # Remove a database if it exists, along with the associated user -ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name +#REMOVEME? ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory..." --weight=1 +#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=1 # Remove the app directory securely -ynh_secure_remove --file="$final_path" +#REMOVEME? ynh_secure_remove --file="$install_dir" #================================================= # REMOVE NGINX CONFIGURATION @@ -94,10 +94,10 @@ ynh_secure_remove --file="/var/log/$app" #================================================= # REMOVE DEDICATED USER #================================================= -ynh_script_progression --message="Removing the dedicated system user..." --weight=1 +#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=1 # Delete a system user -ynh_system_user_delete --username=$app +#REMOVEME? ynh_system_user_delete --username=$app #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index 115f3d0..d617b86 100755 --- a/scripts/restore +++ b/scripts/restore @@ -15,60 +15,60 @@ source /usr/share/yunohost/helpers #================================================= # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= ynh_script_progression --message="Loading settings..." --weight=1 -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name -datadir=$final_path/documents/ +#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? data_dir=$install_dir/documents/ -fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) -fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +#REMOVEME? fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) +#REMOVEME? fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) +#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_script_progression --message="Validating restoration parameters..." --weight=1 +#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1 -test ! -d $final_path \ - || ynh_die --message="There is already a directory: $final_path " +#REMOVEME? test ! -d $install_dir \ + || ynh_die --message="There is already a directory: $install_dir " #================================================= # STANDARD RESTORATION STEPS #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --weight=3 +#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=3 # Create the dedicated user (if not existing) -ynh_system_user_create --username=$app +#REMOVEME? ynh_system_user_create --username=$app #================================================= # RESTORE THE APP MAIN DIR #================================================= ynh_script_progression --message="Restoring the app main directory..." --weight=1 -ynh_restore_file --origin_path="$final_path" +ynh_restore_file --origin_path="$install_dir" #================================================= # SPECIFIC RESTORATION #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=1 +#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=1 # Define and install dependencies -ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_install_app_dependencies $pkg_dependencies #================================================= # RESTORE THE PHP-FPM CONFIGURATION @@ -90,10 +90,10 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Restoring the MySQL database..." --weight=27 +#REMOVEME? ynh_script_progression --message="Restoring the MySQL database..." --weight=27 -db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) -ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd +#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 #================================================= @@ -106,17 +106,17 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= # SECURE FILES AND DIRECTORIES #================================================= -ynh_script_progression --message="Configuring permissions..." --weight=1 +#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1 # Set permissions on app files -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" -chmod 644 "$final_path/htdocs/conf/conf.php" -mkdir -p "$datadir" -chown -R $app: "$datadir" -chmod go-w $datadir +chmod 644 "$install_dir/htdocs/conf/conf.php" +mkdir -p "$data_dir" +chown -R $app: "$data_dir" +chmod go-w $data_dir #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index cdd5f58..0b0c57e 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,23 +12,23 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=2 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=2 -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_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) -language=$(ynh_app_setting_get --app=$app --key=language) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -current_version=$(ynh_app_setting_get --app=$app --key=version) +#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? language=$(ynh_app_setting_get --app=$app --key=language) +#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#REMOVEME? current_version=$(ynh_app_setting_get --app=$app --key=version) update_version=$(ynh_app_upstream_version "../manifest.json") -datadir=$final_path/documents/ +#REMOVEME? data_dir=$install_dir/documents/ -fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) -fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +#REMOVEME? fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) +#REMOVEME? fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) +#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK VERSION @@ -39,16 +39,16 @@ 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)..." --weight=11 +#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=11 # Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { +#REMOVEME? ynh_backup_before_upgrade +#REMOVEME? ynh_clean_setup () { # restore it if the upgrade fails - ynh_restore_upgradebackup +#REMOVEME? ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # STANDARD UPGRADE STEPS @@ -60,13 +60,13 @@ ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 # If db_name doesn't exist, create it if [ -z "$db_name" ]; then db_name=$(ynh_sanitize_dbid --db_name=$app) - ynh_app_setting_set --app=$app --key=db_name --value=$db_name +#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name fi -# If final_path doesn't exist, create it -if [ -z "$final_path" ]; then - final_path=/var/www/$app - ynh_app_setting_set --app=$app --key=final_path --value=$final_path +# 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 fpm_footprint doesn't exist, create it @@ -82,15 +82,15 @@ if [ -z "$fpm_usage" ]; then fi # Cleaning legacy permissions -if ynh_legacy_permissions_exists; then - ynh_legacy_permissions_delete_all +#REMOVEME? if ynh_legacy_permissions_exists; then +#REMOVEME? ynh_legacy_permissions_delete_all ynh_app_setting_delete --app=$app --key=is_public fi # Create a permission if needed -if ! ynh_permission_exists --permission "public_space"; then - ynh_permission_create --permission "public_space" --url "/public/" --allowed "visitors" +#REMOVEME? if ! ynh_permission_exists --permission "public_space"; then +#REMOVEME? ynh_permission_create --permission "public_space" --url "/public/" --allowed "visitors" fi # Delete existing ini configuration file (backward compatibility) @@ -101,17 +101,17 @@ fi #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 +#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 # Create a dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir="$final_path" +#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=1 +#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=1 -ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_install_app_dependencies $pkg_dependencies #================================================= # NGINX CONFIGURATION @@ -125,7 +125,7 @@ ynh_remove_nginx_config ynh_app_setting_delete --app=$app --key="checksum__etc_nginx_conf.d_$domain.d_$app.conf" # Wait untils NGINX has fully reloaded -ynh_systemd_action --service_name=nginx --action=reload --line_match="Reloaded" --log_path="systemd" +#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload --line_match="Reloaded" --log_path="systemd" # Create a dedicated nginx config ynh_add_nginx_config @@ -150,7 +150,7 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 # Recreate a dedicated PHP-FPM config ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # SPECIFIC UPGRADE @@ -205,12 +205,12 @@ EOF # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" + ynh_setup_source --dest_dir="$install_dir" - chown -R $app: "$final_path" + chown -R $app: "$install_dir" # Remove the lock if it exists - lock=$final_path/documents/install.lock + lock=$install_dir/documents/install.lock if [ -f $lock ] then ynh_secure_remove $lock @@ -222,7 +222,7 @@ EOF # Set the app as temporarily public for cURL call if ! ynh_permission_has_user --permission "main" --user="visitors"; then - ynh_permission_update --permission="main" --add="visitors" +#REMOVEME? ynh_permission_update --permission="main" --add="visitors" fi @@ -239,7 +239,7 @@ EOF ynh_exec_fully_quiet sleep 5 - pushd $final_path/htdocs/install/ + pushd $install_dir/htdocs/install/ if php$phpversion upgrade.php $current_version $next_version > /var/log/$app/upgrade.html; then ynh_print_info --message="Step 1 upgrading ended successfully" @@ -266,7 +266,7 @@ EOF popd - ynh_permission_update --permission="main" --remove="visitors" +#REMOVEME? ynh_permission_update --permission="main" --remove="visitors" # Get the new current version number current_version=$next_version @@ -274,7 +274,7 @@ EOF done - if php$phpversion $final_path/scripts/user/sync_users_ldap2dolibarr.php commitiferror --server=localhost -y; then + if php$phpversion $install_dir/scripts/user/sync_users_ldap2dolibarr.php commitiferror --server=localhost -y; then ynh_print_info --message="LDAP user update ok" else ynh_print_info --message="LDAP user update ended with error" @@ -287,10 +287,10 @@ fi # STORE THE CONFIG FILE CHECKSUM #================================================= -ynh_backup_if_checksum_is_different --file="$final_path/htdocs/conf/conf.php" +ynh_backup_if_checksum_is_different --file="$install_dir/htdocs/conf/conf.php" # Recalculate and store the checksum of the file for the next upgrade. -ynh_store_file_checksum --file="$final_path/htdocs/conf/conf.php" -chmod 644 "$final_path/htdocs/conf/conf.php" +ynh_store_file_checksum --file="$install_dir/htdocs/conf/conf.php" +chmod 644 "$install_dir/htdocs/conf/conf.php" #================================================= # SETUP LOGROTATE @@ -305,29 +305,29 @@ ynh_use_logrotate --non-append #================================================= # SECURE FILES AND DIRECTORIES #================================================= -ynh_script_progression --message="Configuring permissions..." --weight=1 +#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1 # Set permissions on app files -if [ ! -f "$datadir/install.lock" ]; then - echo 'This is a lock file to prevent use of install pages (set with permission 440)' > "$datadir/install.lock" - chown $app:$app "$datadir/install.lock" - chmod 440 "$datadir/install.lock" +if [ ! -f "$data_dir/install.lock" ]; then + echo 'This is a lock file to prevent use of install pages (set with permission 440)' > "$data_dir/install.lock" + chown $app:$app "$data_dir/install.lock" + chmod 440 "$data_dir/install.lock" fi -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" -mkdir -p "$datadir" -chown -R $app: "$datadir" -chmod go-w $datadir +mkdir -p "$data_dir" +chown -R $app: "$data_dir" +chmod go-w $data_dir #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT From 5bce9d9409ec66fe5f4bcda6561af93dfce8e489 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 22 May 2023 08:30:20 +0200 Subject: [PATCH 02/36] v2 --- manifest.toml | 25 ++++----- scripts/_common.sh | 18 ------- scripts/backup | 19 ------- scripts/change_url | 86 ------------------------------- scripts/install | 96 +++-------------------------------- scripts/remove | 48 ------------------ scripts/restore | 59 +-------------------- scripts/upgrade | 124 +++++++-------------------------------------- 8 files changed, 40 insertions(+), 435 deletions(-) diff --git a/manifest.toml b/manifest.toml index 953ae21..3e24cf3 100644 --- a/manifest.toml +++ b/manifest.toml @@ -16,34 +16,30 @@ demo = "https://www.dolibarr.org/onlinedemo" admindoc = "https://www.dolibarr.org/documentation-home" userdoc = "https://www.dolibarr.org/#features" code = "https://github.com/Dolibarr/dolibarr" -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 = ">= 11.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.19" +architectures = "all" multi_instance = true -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 = "/dolibarr" [install.admin] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "user" [resources] + [resources.system_user] [resources.install_dir] @@ -52,6 +48,11 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen [resources.permissions] main.url = "/" + public_space.url = "/public/" + public_space.allowed = "visitors" + + [resources.apt] + packages = "mariadb-server php8.1-imagick php8.1-gd php8.1-mbstring php8.1-soap php8.1-curl php8.1-intl php8.1-opcache php8.1-calendar php8.1-zip php8.1-xml php8.1-fileinfo php8.1-imap" [resources.database] type = "mysql" diff --git a/scripts/_common.sh b/scripts/_common.sh index 21c9a08..944a65e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -3,24 +3,6 @@ #================================================= # COMMON VARIABLES #================================================= -#REMOVEME? YNH_PHP_VERSION="8.1" - -#REMOVEME? php_dependencies="php$YNH_PHP_VERSION-mysql \ - php$YNH_PHP_VERSION-imagick \ - php$YNH_PHP_VERSION-gd \ - php$YNH_PHP_VERSION-mbstring \ - php$YNH_PHP_VERSION-soap \ - php$YNH_PHP_VERSION-curl \ - php$YNH_PHP_VERSION-intl \ - php$YNH_PHP_VERSION-opcache \ - php$YNH_PHP_VERSION-calendar \ - php$YNH_PHP_VERSION-zip \ - php$YNH_PHP_VERSION-xml \ - php$YNH_PHP_VERSION-fileinfo \ - php$YNH_PHP_VERSION-imap" - -# dependencies used by the app (must be on a single line) -#REMOVEME? pkg_dependencies="$php_dependencies" #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index 0aa665b..3e51850 100755 --- a/scripts/backup +++ b/scripts/backup @@ -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 #================================================= diff --git a/scripts/change_url b/scripts/change_url index 8cecbab..b50f43a 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,59 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN -#REMOVEME? old_path=$YNH_APP_OLD_PATH - -#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN -#REMOVEME? new_path=$YNH_APP_NEW_PATH - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? # Needed for helper "ynh_add_nginx_config" -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) - -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -#REMOVEME? ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. -#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" - - # 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 - -#================================================= -# CHECK WHICH PARTS SHOULD BE CHANGED -#================================================= - -#REMOVEME? change_domain=0 -#REMOVEME? if [ "$old_domain" != "$new_domain" ] -then - #REMOVEME? change_domain=1 -fi - -#REMOVEME? change_path=0 -#REMOVEME? if [ "$old_path" != "$new_path" ] -then - #REMOVEME? change_path=1 -fi - #================================================= # STANDARD MODIFICATIONS #================================================= @@ -71,30 +18,6 @@ ynh_script_progression --message="Updating NGINX web server configuration..." -- ynh_change_url_nginx_config -#REMOVEME? nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf - -#REMOVEME? # Change the path in the nginx config file -if [ $change_path -eq 1 ] -then -#REMOVEME? # Make a backup of the original nginx config file if modified -#REMOVEME? ynh_backup_if_checksum_is_different --file="$nginx_conf_path" -#REMOVEME? # Set global variables for nginx helper -#REMOVEME? domain="$old_domain" -#REMOVEME? path="$new_path" -#REMOVEME? # Create a dedicated nginx config -#REMOVEME? ynh_add_nginx_config -fi - -#REMOVEME? # Change the domain for nginx -if [ $change_domain -eq 1 ] -then - # Delete file checksum for the old conf file location -#REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path" -#REMOVEME? mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf - # Store file checksum for the new config file location -#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" -fi - #================================================= # SPECIFIC MODIFICATIONS #================================================= @@ -103,15 +26,6 @@ fi ynh_replace_string --match_string="$old_domain$old_path" --replace_string="$new_domain$new_path" --target_file="$install_dir/htdocs/conf/conf.php" -#================================================= -# GENERIC FINALISATION -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index a606955..08c98be 100644 --- a/scripts/install +++ b/scripts/install @@ -9,75 +9,24 @@ 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? admin=$YNH_APP_ARG_ADMIN -#member=0 -#is_public=0 -#REMOVEME? phpversion=$YNH_PHP_VERSION - -#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 +member=0 #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=2 +ynh_script_progression --message="Storing installation settings..." --weight=2 -#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 -#ynh_app_setting_set --app=$app --key=is_public --value=$is_public -#ynh_app_setting_set --app=$app --key=member --value=$member +ynh_app_setting_set --app=$app --key=member --value=$member ynh_app_setting_set --app=$app --key=version --value=$(ynh_app_upstream_version "../manifest.json") -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# INSTALL DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=1 - -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies - -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=2 - -# 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..." --weight=1 - -#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 +ynh_script_progression --message="Creating a MySQL database..." --weight=1 ynh_mysql_execute_as_root --sql="ALTER DATABASE $db_name charset=utf8" @@ -86,7 +35,6 @@ ynh_mysql_execute_as_root --sql="ALTER DATABASE $db_name charset=utf8" #================================================= ynh_script_progression --message="Setting up source files..." --weight=1 - # Load the last available version source upgrade.d/upgrade.last.sh @@ -99,14 +47,12 @@ SOURCE_FORMAT=tar.bz2 SOURCE_IN_SUBDIR=true EOF -#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_script_progression --message="Download source files..." --weight=70 ynh_setup_source --dest_dir="$install_dir" # Create necessary files -#REMOVEME? data_dir=$install_dir/documents +data_dir=$install_dir/documents touch $install_dir/htdocs/conf/conf.php #================================================= @@ -122,8 +68,6 @@ ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage # Create a dedicated php-fpm config ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint -# Used by ynh_add_nginx_config -#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # NGINX CONFIGURATION @@ -149,14 +93,6 @@ ynh_add_config --template="../conf/install.forced.php" --destination="$install_d # Set right permissions for curl install chown -R $app: "$install_dir" -# Set the app as temporarily public for cURL call -if ! ynh_permission_has_user --permission "main" --user="visitors"; then -#REMOVEME? ynh_permission_update --permission="main" --add="visitors" -fi - -# Reload NGINX -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - # Installation with curl mkdir -p /var/log/$app/ @@ -216,9 +152,6 @@ else ynh_print_info --message="LDAP user update ended with error" fi -# Remove the public access -#REMOVEME? ynh_permission_update --permission="main" --remove="visitors" - #================================================= # MODIFY A CONFIG FILE #================================================= @@ -239,7 +172,7 @@ ynh_store_file_checksum --file="$install_dir/htdocs/conf/conf.php" #================================================= # SECURE FILES AND DIRECTORIES #================================================= -#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1 +ynh_script_progression --message="Configuring permissions..." --weight=1 # Set permissions on app files if [ ! -f "$data_dir/install.lock" ]; then @@ -265,23 +198,6 @@ ynh_script_progression --message="Configuring log rotation..." --weight=1 # Use logrotate to manage application logfile(s) ynh_use_logrotate --logfile="$install_dir/documents/dolibarr.log" -#================================================= -# SETUP SSOWAT -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1 - -# Create the public space permission if needed -#REMOVEME? if ! ynh_permission_exists --permission "public_space"; then -#REMOVEME? ynh_permission_create --permission "public_space" --url "/public/" --allowed "visitors" -fi - -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index e245996..89ebac2 100644 --- a/scripts/remove +++ b/scripts/remove @@ -9,44 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# 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? port=$(ynh_app_setting_get --app=$app --key=port) -#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 DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=1 - -# Remove metapackage and its dependencies -#REMOVEME? ynh_remove_app_dependencies - -#================================================= -# REMOVE THE MYSQL DATABASE -#================================================= -#REMOVEME? ynh_script_progression --message="Removing the MySQL database..." --weight=9 - -# 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..." --weight=1 - -# Remove the app directory securely -#REMOVEME? ynh_secure_remove --file="$install_dir" - #================================================= # REMOVE NGINX CONFIGURATION #================================================= @@ -89,16 +51,6 @@ ynh_secure_remove --file="/etc/$app" # Remove the log files ynh_secure_remove --file="/var/log/$app" -#================================================= -# GENERIC FINALIZATION -#================================================= -# REMOVE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=1 - -# Delete a system user -#REMOVEME? ynh_system_user_delete --username=$app - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index d617b86..f1d9dc2 100755 --- a/scripts/restore +++ b/scripts/restore @@ -10,49 +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 -#================================================= -ynh_script_progression --message="Loading 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? data_dir=$install_dir/documents/ - -#REMOVEME? fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) -#REMOVEME? fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) -#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..." --weight=3 - -# Create the dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app - #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -60,16 +17,6 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" -#================================================= -# SPECIFIC RESTORATION -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=1 - -# Define and install dependencies -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies - #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= @@ -90,10 +37,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=27 +ynh_script_progression --message="Restoring the MySQL database..." --weight=27 -#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 #================================================= @@ -106,7 +51,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= # SECURE FILES AND DIRECTORIES #================================================= -#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1 +ynh_script_progression --message="Configuring permissions..." --weight=1 # Set permissions on app files chmod 750 "$install_dir" diff --git a/scripts/upgrade b/scripts/upgrade index 0b0c57e..1cdb053 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,23 +12,8 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=2 -#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? language=$(ynh_app_setting_get --app=$app --key=language) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? current_version=$(ynh_app_setting_get --app=$app --key=version) update_version=$(ynh_app_upstream_version "../manifest.json") -#REMOVEME? data_dir=$install_dir/documents/ - -#REMOVEME? fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) -#REMOVEME? fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) -#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK VERSION @@ -36,20 +21,6 @@ update_version=$(ynh_app_upstream_version "../manifest.json") 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)..." --weight=11 - -# 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 #================================================= @@ -57,18 +28,6 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 -# 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 fpm_footprint doesn't exist, create it if [ -z "$fpm_footprint" ]; then fpm_footprint=medium @@ -81,38 +40,11 @@ if [ -z "$fpm_usage" ]; then ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage fi -# 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 - -# Create a permission if needed -#REMOVEME? if ! ynh_permission_exists --permission "public_space"; then -#REMOVEME? ynh_permission_create --permission "public_space" --url "/public/" --allowed "visitors" -fi - # Delete existing ini configuration file (backward compatibility) if [ -f /etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini ]; then ynh_secure_remove --file=/etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini fi -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 - -# Create a dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" - -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=1 - -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies - #================================================= # NGINX CONFIGURATION #================================================= @@ -125,7 +57,7 @@ ynh_remove_nginx_config ynh_app_setting_delete --app=$app --key="checksum__etc_nginx_conf.d_$domain.d_$app.conf" # Wait untils NGINX has fully reloaded -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload --line_match="Reloaded" --log_path="systemd" +ynh_systemd_action --service_name=nginx --action=reload --line_match="Reloaded" --log_path="systemd" # Create a dedicated nginx config ynh_add_nginx_config @@ -150,7 +82,6 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 # Recreate a dedicated PHP-FPM config ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint -#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # SPECIFIC UPGRADE @@ -220,12 +151,6 @@ EOF # Upgrade with CURL - # Set the app as temporarily public for cURL call - if ! ynh_permission_has_user --permission "main" --user="visitors"; then -#REMOVEME? ynh_permission_update --permission="main" --add="visitors" - fi - - charset=$(mysql -ss -N -e "SELECT default_character_set_name FROM information_schema.SCHEMATA WHERE schema_name = '$db_name'") if [ "$charset" != "utf8" ] then @@ -240,33 +165,29 @@ EOF ynh_exec_fully_quiet sleep 5 pushd $install_dir/htdocs/install/ - - if php$phpversion upgrade.php $current_version $next_version > /var/log/$app/upgrade.html; then - ynh_print_info --message="Step 1 upgrading ended successfully" - else - ynh_die --message="Step 1 upgrading ended with error" - fi + if php$phpversion upgrade.php $current_version $next_version > /var/log/$app/upgrade.html; then + ynh_print_info --message="Step 1 upgrading ended successfully" + else + ynh_die --message="Step 1 upgrading ended with error" + fi - ynh_exec_fully_quiet sleep 5 + ynh_exec_fully_quiet sleep 5 - if php$phpversion upgrade2.php $current_version $next_version > /var/log/$app/upgrade2.html; then - ynh_print_info --message="Step 2 upgrading ended successfully" - else - ynh_die --message="Step 2 upgrading ended with error" - fi + if php$phpversion upgrade2.php $current_version $next_version > /var/log/$app/upgrade2.html; then + ynh_print_info --message="Step 2 upgrading ended successfully" + else + ynh_die --message="Step 2 upgrading ended with error" + fi - ynh_exec_fully_quiet sleep 5 - - if php$phpversion step5.php $current_version $next_version > /var/log/$app/upgrade3.html; then - ynh_print_info --message="Step 3 upgrading ended successfully" - else - ynh_die --message="Step 3 upgrading ended with error" - fi - + ynh_exec_fully_quiet sleep 5 + if php$phpversion step5.php $current_version $next_version > /var/log/$app/upgrade3.html; then + ynh_print_info --message="Step 3 upgrading ended successfully" + else + ynh_die --message="Step 3 upgrading ended with error" + fi popd -#REMOVEME? ynh_permission_update --permission="main" --remove="visitors" # Get the new current version number current_version=$next_version @@ -305,7 +226,7 @@ ynh_use_logrotate --non-append #================================================= # SECURE FILES AND DIRECTORIES #================================================= -#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1 +ynh_script_progression --message="Configuring permissions..." --weight=1 # Set permissions on app files if [ ! -f "$data_dir/install.lock" ]; then @@ -322,13 +243,6 @@ mkdir -p "$data_dir" chown -R $app: "$data_dir" chmod go-w $data_dir -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= From 16c105d1aa48d0e196e544cbadf0db9aa00f9ad0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 22 May 2023 08:35:38 +0200 Subject: [PATCH 03/36] v2 --- check_process | 25 ----------------------- conf/nginx.conf | 2 +- doc/DISCLAIMER.md | 0 manifest.json | 52 ----------------------------------------------- manifest.toml | 2 +- scripts/install | 12 +++++------ scripts/upgrade | 12 +++++------ tests.toml | 3 +++ 8 files changed, 16 insertions(+), 92 deletions(-) delete mode 100644 check_process delete mode 100644 doc/DISCLAIMER.md delete mode 100644 manifest.json create mode 100644 tests.toml diff --git a/check_process b/check_process deleted file mode 100644 index 684c851..0000000 --- a/check_process +++ /dev/null @@ -1,25 +0,0 @@ -;; Test complet - ; Manifest - domain="domain.tld" - path="/path" - admin="john" - ; Checks - pkg_linter=1 - setup_sub_dir=1 - setup_root=1 - setup_nourl=0 - setup_private=0 - setup_public=0 - upgrade=1 - upgrade=1 from_commit=244f3cbdf29d6c694154ec08cead5e27d35c26fc - backup_restore=1 - multi_instance=1 - port_already_use=0 - change_url=1 -;;; Options -Email= -Notification=none -;;; Upgrade options - ; commit=CommitHash - name=5 Jul 2019 - manifest_arg=domain=DOMAIN&path=PATH&admin=USER& diff --git a/conf/nginx.conf b/conf/nginx.conf index 35f8581..eae8d07 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -2,7 +2,7 @@ location __PATH__/ { # Path to source - alias __INSTALL_DIR__/htdocs/ ; + alias __INSTALL_DIR__/htdocs/; index index.php; diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md deleted file mode 100644 index e69de29..0000000 diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 5d201d2..0000000 --- a/manifest.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "Dolibarr", - "id": "dolibarr", - "packaging_format": 1, - "description": { - "en": "Manage the various aspects of your business or association", - "fr": "Gérez les différents aspects de votre activité pro ou associative" - }, - "version": "17.0.0~ynh1", - "url": "https://www.dolibarr.org/", - "upstream": { - "license": "GPL-3.0-or-later", - "website": "https://www.dolibarr.org/", - "demo": "https://www.dolibarr.org/onlinedemo", - "admindoc": "https://www.dolibarr.org/documentation-home", - "userdoc": "https://www.dolibarr.org/#features", - "code": "https://github.com/Dolibarr/dolibarr", - "cpe": "cpe:2.3:a:dolibarr:dolibarr" - }, - "license": "GPL-3.0-or-later", - "maintainer": { - "name": "mastereur", - "url": "https://github.com/mastereur" - }, - "requirements": { - "yunohost": ">= 11.0" - }, - "multi_instance": true, - "services": [ - "nginx", - "php7.4-fpm", - "mysql" - ], - "arguments": { - "install": [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "path", - "type": "path", - "example": "/dolibarr", - "default": "/dolibarr" - }, - { - "name": "admin", - "type": "user" - } - ] - } -} \ No newline at end of file diff --git a/manifest.toml b/manifest.toml index 3e24cf3..36a5a80 100644 --- a/manifest.toml +++ b/manifest.toml @@ -21,7 +21,7 @@ code = "https://github.com/Dolibarr/dolibarr" yunohost = ">= 11.1.19" architectures = "all" multi_instance = true -ldap = false +ldap = true sso = false disk = "50M" ram.build = "50M" diff --git a/scripts/install b/scripts/install index 08c98be..6d55bce 100644 --- a/scripts/install +++ b/scripts/install @@ -14,6 +14,8 @@ source /usr/share/yunohost/helpers #================================================= member=0 +fpm_footprint="medium" +fpm_usage="medium" #================================================= # STORE SETTINGS FROM MANIFEST @@ -22,6 +24,8 @@ ynh_script_progression --message="Storing installation settings..." --weight=2 ynh_app_setting_set --app=$app --key=member --value=$member ynh_app_setting_set --app=$app --key=version --value=$(ynh_app_upstream_version "../manifest.json") +ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint +ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage #================================================= # CREATE A MYSQL DATABASE @@ -60,14 +64,8 @@ touch $install_dir/htdocs/conf/conf.php #================================================= ynh_script_progression --message="Configuring PHP-FPM" --weight=2 -fpm_footprint="medium" -fpm_usage="medium" - -ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint -ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage - # Create a dedicated php-fpm config -ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint +ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint #================================================= # NGINX CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 1cdb053..1fe00b6 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -29,15 +29,15 @@ upgrade_type=$(ynh_check_app_version_changed) ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 # If fpm_footprint doesn't exist, create it -if [ -z "$fpm_footprint" ]; then - fpm_footprint=medium - ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint +if [ -z "${fpm_footprint:-}" ]; then + fpm_footprint=low + ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint fi # If fpm_usage doesn't exist, create it -if [ -z "$fpm_usage" ]; then - fpm_usage=medium - ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage +if [ -z "${fpm_usage:-}" ]; then + fpm_usage=low + ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage fi # Delete existing ini configuration file (backward compatibility) diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..cbbeef1 --- /dev/null +++ b/tests.toml @@ -0,0 +1,3 @@ +test_format = 1.0 + +[default] From f08220a7f0abaa7df09e4a964435835a7aa971b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 31 Aug 2023 14:49:40 +0200 Subject: [PATCH 04/36] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 36a5a80..ecbd694 100644 --- a/manifest.toml +++ b/manifest.toml @@ -18,7 +18,7 @@ userdoc = "https://www.dolibarr.org/#features" code = "https://github.com/Dolibarr/dolibarr" [integration] -yunohost = ">= 11.1.19" +yunohost = ">= 11.2" architectures = "all" multi_instance = true ldap = true From 55dd81a57b6cb3ae15412eb6f522bac18a0be3bd Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Thu, 31 Aug 2023 12:49:50 +0000 Subject: [PATCH 05/36] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 62ce519..f00bf7c 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Dolibarr ERP & CRM is a modern software for managing your professional or associative activity (contacts, invoices, orders, stocks, agenda, etc.). -**Shipped version:** 17.0.1~ynh1 +**Shipped version:** 17.0.0~ynh1 **Demo:** https://www.dolibarr.org/onlinedemo diff --git a/README_fr.md b/README_fr.md index 02bfcf9..45ecc9a 100644 --- a/README_fr.md +++ b/README_fr.md @@ -18,7 +18,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Dolibarr ERP & CRM est un logiciel moderne de gestion de votre activité professionnelle ou associative (contacts, factures, commandes, stocks, agenda, etc.). -**Version incluse :** 17.0.1~ynh1 +**Version incluse :** 17.0.0~ynh1 **Démo :** https://www.dolibarr.org/onlinedemo From f8e0c749620e735f9254d1ac60320421bf32322c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 31 Aug 2023 14:52:19 +0200 Subject: [PATCH 06/36] Update manifest.toml --- manifest.toml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/manifest.toml b/manifest.toml index ecbd694..7f4c6bf 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Dolibarr" description.en = "Manage the various aspects of your business or association" description.fr = "Gérez les différents aspects de votre activité pro ou associative" -version = "17.0.0~ynh1" +version = "17.0.1~ynh1" maintainers = ["mastereur"] @@ -35,6 +35,10 @@ ram.runtime = "50M" type = "path" default = "/dolibarr" + [install.init_main_permission] + type = "group" + default = "visitors" + [install.admin] type = "user" @@ -52,7 +56,7 @@ ram.runtime = "50M" public_space.allowed = "visitors" [resources.apt] - packages = "mariadb-server php8.1-imagick php8.1-gd php8.1-mbstring php8.1-soap php8.1-curl php8.1-intl php8.1-opcache php8.1-calendar php8.1-zip php8.1-xml php8.1-fileinfo php8.1-imap" + packages = "mariadb-server php8.2-imagick php8.2-gd php8.2-mbstring php8.2-soap php8.2-curl php8.2-intl php8.2-opcache php8.2-calendar php8.2-zip php8.2-xml php8.2-fileinfo php8.2-imap" [resources.database] type = "mysql" From e51150047016c082257ca174229b280acf9fb151 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 31 Aug 2023 14:59:12 +0200 Subject: [PATCH 07/36] Update extra_php-fpm.conf --- conf/extra_php-fpm.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/extra_php-fpm.conf b/conf/extra_php-fpm.conf index 906ef2b..57a545d 100644 --- a/conf/extra_php-fpm.conf +++ b/conf/extra_php-fpm.conf @@ -5,6 +5,6 @@ php_admin_value[upload_max_filesize] = 50M php_admin_value[post_max_size] = 50M ; Other common parameters -php_admin_value[max_execution_time] = 600 +php_admin_value[max_execution_time] = 1600 php_admin_value[max_input_time] = 300 php_admin_value[memory_limit] = 256M From 6ffe625b030cb68ad905a73cd2211c32c6fd16fe Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Thu, 31 Aug 2023 12:59:22 +0000 Subject: [PATCH 08/36] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f00bf7c..62ce519 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Dolibarr ERP & CRM is a modern software for managing your professional or associative activity (contacts, invoices, orders, stocks, agenda, etc.). -**Shipped version:** 17.0.0~ynh1 +**Shipped version:** 17.0.1~ynh1 **Demo:** https://www.dolibarr.org/onlinedemo diff --git a/README_fr.md b/README_fr.md index 45ecc9a..b1fcaa4 100644 --- a/README_fr.md +++ b/README_fr.md @@ -18,7 +18,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Dolibarr ERP & CRM est un logiciel moderne de gestion de votre activité professionnelle ou associative (contacts, factures, commandes, stocks, agenda, etc.). -**Version incluse :** 17.0.0~ynh1 +**Version incluse :** 17.0.1~ynh1 **Démo :** https://www.dolibarr.org/onlinedemo From bd6da7ce6131edf302e9595cd6e46f64af670215 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 31 Aug 2023 17:00:38 +0200 Subject: [PATCH 09/36] Update manifest.toml --- manifest.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/manifest.toml b/manifest.toml index 7f4c6bf..244dec5 100644 --- a/manifest.toml +++ b/manifest.toml @@ -52,8 +52,6 @@ ram.runtime = "50M" [resources.permissions] main.url = "/" - public_space.url = "/public/" - public_space.allowed = "visitors" [resources.apt] packages = "mariadb-server php8.2-imagick php8.2-gd php8.2-mbstring php8.2-soap php8.2-curl php8.2-intl php8.2-opcache php8.2-calendar php8.2-zip php8.2-xml php8.2-fileinfo php8.2-imap" From aaa74e4dd116af81db331f350b62dba969a640da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 2 Oct 2023 12:38:21 +0200 Subject: [PATCH 10/36] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 244dec5..276a0ed 100644 --- a/manifest.toml +++ b/manifest.toml @@ -54,7 +54,7 @@ ram.runtime = "50M" main.url = "/" [resources.apt] - packages = "mariadb-server php8.2-imagick php8.2-gd php8.2-mbstring php8.2-soap php8.2-curl php8.2-intl php8.2-opcache php8.2-calendar php8.2-zip php8.2-xml php8.2-fileinfo php8.2-imap" + packages = "mariadb-server, php8.2-imagick, php8.2-gd, php8.2-mbstring, php8.2-soap, php8.2-curl, php8.2-intl, php8.2-opcache, php8.2-calendar, php8.2-zip, php8.2-xml, php8.2-fileinfo, php8.2-imap" [resources.database] type = "mysql" From 738be69a7862199004c84adfcde5929550a01a37 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 2 Oct 2023 10:38:30 +0000 Subject: [PATCH 11/36] Auto-update README --- README.md | 1 - README_fr.md | 1 - 2 files changed, 2 deletions(-) diff --git a/README.md b/README.md index 62ce519..3d5a653 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,6 @@ Dolibarr ERP & CRM is a modern software for managing your professional or associ * Official user documentation: * Official admin documentation: * Upstream app code repository: -* YunoHost documentation for this app: * Report a bug: ## Developer info diff --git a/README_fr.md b/README_fr.md index b1fcaa4..7b6d5ac 100644 --- a/README_fr.md +++ b/README_fr.md @@ -32,7 +32,6 @@ Dolibarr ERP & CRM est un logiciel moderne de gestion de votre activité profess * Documentation officielle utilisateur : * Documentation officielle de l’admin : * Dépôt de code officiel de l’app : -* Documentation YunoHost pour cette app : * Signaler un bug : ## Informations pour les développeurs From 112d226d38447bf5b7ae54c134c08730b2594f2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 2 Oct 2023 12:41:02 +0200 Subject: [PATCH 12/36] cleaning --- scripts/upgrade.d/upgrade.17.sh | 7 +++++++ scripts/upgrade.d/upgrade.last.sh | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 scripts/upgrade.d/upgrade.17.sh diff --git a/scripts/upgrade.d/upgrade.17.sh b/scripts/upgrade.d/upgrade.17.sh new file mode 100644 index 0000000..f2d8996 --- /dev/null +++ b/scripts/upgrade.d/upgrade.17.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Target version of the Dolibarr update +next_version="18.0.1" + +# Dolibarr tarball checksum +dolibarr_source_sha256="37bd3c8533b821c241dbb34b0e88349c1d5b43f7ffa6027f0b7970748d1f727a" \ No newline at end of file diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index d7ca56a..8880793 100644 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,7 +1,7 @@ #!/bin/bash # Target version of the Dolibarr update -next_version="17.0.1" +next_version="18.0.1" # Dolibarr tarball checksum -dolibarr_source_sha256="2EDDD545C07EAE291AD46E48AB55D3ADB988D99C29A8DFAA2E2FDE0A890B0DDC" +dolibarr_source_sha256="37bd3c8533b821c241dbb34b0e88349c1d5b43f7ffa6027f0b7970748d1f727a" From 984bd027c3df5f0c67c459efe79c948265e1aba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 2 Oct 2023 12:41:18 +0200 Subject: [PATCH 13/36] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 276a0ed..0093201 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Dolibarr" description.en = "Manage the various aspects of your business or association" description.fr = "Gérez les différents aspects de votre activité pro ou associative" -version = "17.0.1~ynh1" +version = "18.0.1~ynh1" maintainers = ["mastereur"] From 393d045491186f2a78b7bfb4cc509cc2b7b51a48 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 2 Oct 2023 10:41:27 +0000 Subject: [PATCH 14/36] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3d5a653..e1f0d64 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Dolibarr ERP & CRM is a modern software for managing your professional or associative activity (contacts, invoices, orders, stocks, agenda, etc.). -**Shipped version:** 17.0.1~ynh1 +**Shipped version:** 18.0.1~ynh1 **Demo:** https://www.dolibarr.org/onlinedemo diff --git a/README_fr.md b/README_fr.md index 7b6d5ac..733f59f 100644 --- a/README_fr.md +++ b/README_fr.md @@ -18,7 +18,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Dolibarr ERP & CRM est un logiciel moderne de gestion de votre activité professionnelle ou associative (contacts, factures, commandes, stocks, agenda, etc.). -**Version incluse :** 17.0.1~ynh1 +**Version incluse :** 18.0.1~ynh1 **Démo :** https://www.dolibarr.org/onlinedemo From debbeb08e12fc66efacdf190fbef8d9ea6bd8432 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 2 Oct 2023 12:44:23 +0200 Subject: [PATCH 15/36] cleaning --- scripts/install | 5 ----- scripts/remove | 22 ---------------------- scripts/restore | 25 ++++++++----------------- scripts/upgrade | 32 -------------------------------- 4 files changed, 8 insertions(+), 76 deletions(-) diff --git a/scripts/install b/scripts/install index 6d55bce..d104e8c 100644 --- a/scripts/install +++ b/scripts/install @@ -67,11 +67,6 @@ ynh_script_progression --message="Configuring PHP-FPM" --weight=2 # Create a dedicated php-fpm config ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=1 - # Create a dedicated nginx config ynh_add_nginx_config diff --git a/scripts/remove b/scripts/remove index 89ebac2..7c463be 100644 --- a/scripts/remove +++ b/scripts/remove @@ -17,34 +17,12 @@ ynh_script_progression --message="Removing NGINX web server configuration..." -- # 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 -# Delete old static pool.d conf -old_php_version=7.0 -if [ -f /etc/php/$old_php_version/fpm/pool.d/$app.conf ]; then - ynh_secure_remove --file=/etc/php/$old_php_version/fpm/pool.d/$app.conf -fi - -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Removing logrotate configuration..." --weight=1 - # Remove the app-specific logrotate config ynh_remove_logrotate -#================================================= -# SPECIFIC REMOVE -#================================================= -# REMOVE APP FOLDERS -#================================================= - # Remove a directory securely ynh_secure_remove --file="/etc/$app" diff --git a/scripts/restore b/scripts/restore index f1d9dc2..f5feb25 100755 --- a/scripts/restore +++ b/scripts/restore @@ -17,6 +17,13 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" +#================================================= +# RESTORE THE MYSQL DATABASE +#================================================= +ynh_script_progression --message="Restoring the MySQL database..." --weight=27 + +ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql + #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= @@ -26,26 +33,10 @@ ynh_print_info --message="Reconfiguring PHP-FPM..." ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" # Recreate a dedicated php-fpm config -ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint - -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= +ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# RESTORE THE MYSQL DATABASE -#================================================= -ynh_script_progression --message="Restoring the MySQL database..." --weight=27 - -ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql - -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1 - ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index dce2c53..a7fe1c3 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -40,46 +40,14 @@ if [ -z "${fpm_usage:-}" ]; then ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage fi -# Delete existing ini configuration file (backward compatibility) -if [ -f /etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini ]; then - ynh_secure_remove --file=/etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini -fi - #================================================= # NGINX CONFIGURATION #================================================= ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 -ynh_backup_if_checksum_is_different --file="/etc/nginx/conf.d/$domain.d/$app.conf" - -# Delete current NGINX configuration to be able to check if .well-known is already served. -ynh_remove_nginx_config -ynh_app_setting_delete --app=$app --key="checksum__etc_nginx_conf.d_$domain.d_$app.conf" - -# Wait untils NGINX has fully reloaded -ynh_systemd_action --service_name=nginx --action=reload --line_match="Reloaded" --log_path="systemd" - # Create a dedicated nginx config ynh_add_nginx_config -#================================================= -# PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 - -# If php has changed, remove the old fpm config file -# if [ "$phpversion" != $YNH_PHP_VERSION ] -# then - # ynh_backup_if_checksum_is_different --file="/etc/php/$phpversion/fpm/pool.d/$app.conf" - # ynh_secure_remove --file="/etc/php/$phpversion/fpm/pool.d/$app.conf" - # if [ -f /etc/php/$phpversion/fpm/conf.d/20-$app.ini ]; then - # ynh_secure_remove --file="/etc/php/$phpversion/fpm/conf.d/20-$app.ini" - # fi - # ynh_systemd_action --service_name="php${phpversion}-fpm" --action=reload - - # phpversion="$YNH_PHP_VERSION" -# fi - # Recreate a dedicated PHP-FPM config ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint From 0c49aabfb12feb01f55a0809180fdcafb61e695a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 2 Oct 2023 14:42:33 +0200 Subject: [PATCH 16/36] cleaning --- conf/conf.php | 32 ++++++++++++++++++++++++++++++++ manifest.toml | 2 +- scripts/install | 26 ++++++++++++++------------ 3 files changed, 47 insertions(+), 13 deletions(-) create mode 100644 conf/conf.php diff --git a/conf/conf.php b/conf/conf.php new file mode 100644 index 0000000..078c040 --- /dev/null +++ b/conf/conf.php @@ -0,0 +1,32 @@ +$dolibarr_main_document_root="/home/www/dolibarr/htdocs"; +$dolibarr_main_url_root="http://__DOMAIN____PATH__"; +$dolibarr_main_db_type="mysql"; +$dolibarr_main_db_host="localhost"; +$dolibarr_main_db_port="3306"; +$dolibarr_main_db_name="__DB_NAME__"; +$dolibarr_main_db_user="__DB_USER__"; +$dolibarr_main_db_pass="__DB_PWD__"; + + +// Authentication settings +//$dolibarr_main_authentication='dolibarr'; + +$dolibarr_main_authentication='ldap,dolibarr'; + +$dolibarr_main_auth_ldap_host='ldap:localhost'; + +$dolibarr_main_auth_ldap_port='389'; + +$dolibarr_main_auth_ldap_version='3'; + +$dolibarr_main_auth_ldap_servertype='openldap'; + +$dolibarr_main_auth_ldap_login_attribute='uid'; // Ex: uid or samaccountname for active directory + +$dolibarr_main_auth_ldap_dn='ou=users,dc=yunohost,dc=org'; + +$dolibarr_main_auth_ldap_filter = '&(objectClass=posixAccount)'; + +//$dolibarr_main_auth_ldap_admin_login='uid=admin,dc=yunohost,dc=org'; +//$dolibarr_main_auth_ldap_admin_pass='secret'; +//$dolibarr_main_auth_ldap_debug='false'; diff --git a/manifest.toml b/manifest.toml index 0093201..ac4905a 100644 --- a/manifest.toml +++ b/manifest.toml @@ -48,7 +48,7 @@ ram.runtime = "50M" [resources.install_dir] - [resources.data_dir] + #[resources.data_dir] [resources.permissions] main.url = "/" diff --git a/scripts/install b/scripts/install index d104e8c..a40cabf 100644 --- a/scripts/install +++ b/scripts/install @@ -77,7 +77,9 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 -ynh_add_config --template="../conf/install.forced.php" --destination="$install_dir/htdocs/install/install.forced.php" +ynh_add_config --template="../conf/conf.php" --destination="$install_dir/htdocs/conf/conf.php" + +#ynh_add_config --template="../conf/install.forced.php" --destination="$install_dir/htdocs/install/install.forced.php" #================================================= # SETUP APPLICATION WITH CURL @@ -131,26 +133,26 @@ ynh_local_curl "/install/step5.php" \ ynh_exec_fully_quiet sleep 5 -ynh_script_progression --message="configuring LDAP" --weight=1 +#ynh_script_progression --message="configuring LDAP" --weight=1 -# Populate the LDAP parameters -ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ../conf/sql/ldap.sql +# # Populate the LDAP parameters +# ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ../conf/sql/ldap.sql -# Populate the database with YNH users. -ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ../conf/sql/ldap_user.sql +# # Populate the database with YNH users. +# ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ../conf/sql/ldap_user.sql -if php$phpversion $install_dir/scripts/user/sync_users_ldap2dolibarr.php commitiferror --server=localhost -y; then - ynh_print_info --message="LDAP user update ok" -else - ynh_print_info --message="LDAP user update ended with error" -fi +# if php$phpversion $install_dir/scripts/user/sync_users_ldap2dolibarr.php commitiferror --server=localhost -y; then +# ynh_print_info --message="LDAP user update ok" +# else +# ynh_print_info --message="LDAP user update ended with error" +# fi #================================================= # MODIFY A CONFIG FILE #================================================= +ynh_script_progression --message="configuring config file" --weight=1 # Setup HTTP auth in conf -ynh_script_progression --message="configuring config file" --weight=1 ynh_replace_string --match_string="dolibarr_main_authentication='dolibarr'" --replace_string="dolibarr_main_authentication='http'" --target_file="$install_dir/htdocs/conf/conf.php" #================================================= From d94120af1c32204b757d41e0e3796c87c2a82b99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 2 Oct 2023 14:48:36 +0200 Subject: [PATCH 17/36] Update install --- scripts/install | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index a40cabf..abd9d29 100644 --- a/scripts/install +++ b/scripts/install @@ -57,7 +57,7 @@ ynh_setup_source --dest_dir="$install_dir" # Create necessary files data_dir=$install_dir/documents -touch $install_dir/htdocs/conf/conf.php +#touch $install_dir/htdocs/conf/conf.php #================================================= # PHP-FPM CONFIGURATION @@ -170,11 +170,11 @@ ynh_store_file_checksum --file="$install_dir/htdocs/conf/conf.php" ynh_script_progression --message="Configuring permissions..." --weight=1 # Set permissions on app files -if [ ! -f "$data_dir/install.lock" ]; then - echo 'This is a lock file to prevent use of install pages (set with permission 440)' > "$data_dir/install.lock" - chown $app:$app "$data_dir/install.lock" - chmod 440 "$data_dir/install.lock" -fi +# if [ ! -f "$data_dir/install.lock" ]; then +# echo 'This is a lock file to prevent use of install pages (set with permission 440)' > "$data_dir/install.lock" +# chown $app:$app "$data_dir/install.lock" +# chmod 440 "$data_dir/install.lock" +# fi chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" From e146520be9fd71a68e7edf8a7484ae5e5a66cdfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 2 Oct 2023 14:51:47 +0200 Subject: [PATCH 18/36] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index ac4905a..392db1d 100644 --- a/manifest.toml +++ b/manifest.toml @@ -54,7 +54,7 @@ ram.runtime = "50M" main.url = "/" [resources.apt] - packages = "mariadb-server, php8.2-imagick, php8.2-gd, php8.2-mbstring, php8.2-soap, php8.2-curl, php8.2-intl, php8.2-opcache, php8.2-calendar, php8.2-zip, php8.2-xml, php8.2-fileinfo, php8.2-imap" + packages = "mariadb-server, php8.1-imagick, php8.1-gd, php8.1-mbstring, php8.1-soap, php8.1-curl, php8.1-intl, php8.1-opcache, php8.1-calendar, php8.1-zip, php8.1-xml, php8.1-fileinfo, php8.1-imap" [resources.database] type = "mysql" From aa748935a1a83f2e6fc743056732f735f8d85239 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 2 Oct 2023 14:55:21 +0200 Subject: [PATCH 19/36] Update conf.php --- conf/conf.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/conf.php b/conf/conf.php index 078c040..8349eab 100644 --- a/conf/conf.php +++ b/conf/conf.php @@ -1,4 +1,4 @@ -$dolibarr_main_document_root="/home/www/dolibarr/htdocs"; +$dolibarr_main_document_root="__INSTALL_DIR__/htdocs"; $dolibarr_main_url_root="http://__DOMAIN____PATH__"; $dolibarr_main_db_type="mysql"; $dolibarr_main_db_host="localhost"; From bc9ddc865f52e13ee42683100ef0766eb05245b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 2 Oct 2023 14:55:28 +0200 Subject: [PATCH 20/36] Update install.forced.php --- conf/install.forced.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/install.forced.php b/conf/install.forced.php index b797e31..ac2d9b5 100644 --- a/conf/install.forced.php +++ b/conf/install.forced.php @@ -34,7 +34,7 @@ $force_install_mainforcehttps = true; $force_install_database = '__DB_NAME__'; /** @var string Database driver (mysql|mysqli|pgsql|mssql|sqlite|sqlite3) */ -$force_install_type = 'mysqli'; +$force_install_type = 'mysql'; /** @var string Database server host */ $force_install_dbserver = 'localhost'; @@ -46,7 +46,7 @@ $force_install_port = 3306; $force_install_prefix = 'llx_'; /** @var bool Force database creation */ -$force_install_createdatabase = false; +$force_install_createdatabase = true; /** @var string Database username */ $force_install_databaselogin = '__DB_USER__'; From fc739a104a9f4d4ae4a33653eba8cf5d08a48d79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 2 Oct 2023 14:56:08 +0200 Subject: [PATCH 21/36] Update install --- scripts/install | 58 ++++++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/scripts/install b/scripts/install index abd9d29..c43ea9b 100644 --- a/scripts/install +++ b/scripts/install @@ -92,46 +92,46 @@ chown -R $app: "$install_dir" mkdir -p /var/log/$app/ -ynh_script_progression --message="Finalizing installation..." --weight=1 +# ynh_script_progression --message="Finalizing installation..." --weight=1 -ynh_script_progression --message="Generate fileconf" --weight=1 -ynh_local_curl "/install/fileconf.php" \ - "testpost=ok" +# ynh_script_progression --message="Generate fileconf" --weight=1 +# ynh_local_curl "/install/fileconf.php" \ +# "testpost=ok" -ynh_exec_fully_quiet sleep 5 +# ynh_exec_fully_quiet sleep 5 -ynh_script_progression --message="installation - step 1" --weight=3 -ynh_local_curl "/install/step1.php" \ - "testpost=ok" \ - "action=set" > /var/log/$app/install1.html +# ynh_script_progression --message="installation - step 1" --weight=3 +# ynh_local_curl "/install/step1.php" \ +# "testpost=ok" \ +# "action=set" > /var/log/$app/install1.html -ynh_exec_fully_quiet sleep 5 +# ynh_exec_fully_quiet sleep 5 -ynh_script_progression --message="installation - step 2 (may take a while)..." --weight=72 -ynh_local_curl "/install/step2.php" \ - "testpost=ok" \ - "action=set" > /var/log/$app/install2.html +# ynh_script_progression --message="installation - step 2 (may take a while)..." --weight=72 +# ynh_local_curl "/install/step2.php" \ +# "testpost=ok" \ +# "action=set" > /var/log/$app/install2.html -ynh_exec_fully_quiet sleep 5 +# ynh_exec_fully_quiet sleep 5 -ynh_script_progression --message="installation - step 4" --weight=3 -ynh_local_curl "/install/step4.php" \ - "testpost=ok" \ - "action=set" > /var/log/$app/install3.html +# ynh_script_progression --message="installation - step 4" --weight=3 +# ynh_local_curl "/install/step4.php" \ +# "testpost=ok" \ +# "action=set" > /var/log/$app/install3.html -ynh_exec_fully_quiet sleep 5 +# ynh_exec_fully_quiet sleep 5 -# Generate a random password for the admin user (will be ignored because of LDAP) -password=$(ynh_string_random 8) +# # Generate a random password for the admin user (will be ignored because of LDAP) +# password=$(ynh_string_random 8) -ynh_script_progression --message="installation - step 5" --weight=4 -ynh_local_curl "/install/step5.php" \ - "testpost=ok" \ - "action=set" \ - "pass=$password" \ - "pass_verif=$password" > /var/log/$app/install4.html +# ynh_script_progression --message="installation - step 5" --weight=4 +# ynh_local_curl "/install/step5.php" \ +# "testpost=ok" \ +# "action=set" \ +# "pass=$password" \ +# "pass_verif=$password" > /var/log/$app/install4.html -ynh_exec_fully_quiet sleep 5 +# ynh_exec_fully_quiet sleep 5 #ynh_script_progression --message="configuring LDAP" --weight=1 From e366ea189a4b33ddc0bfd8418f3ea12cdba93c92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 2 Oct 2023 15:02:25 +0200 Subject: [PATCH 22/36] Update install --- scripts/install | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index c43ea9b..8e46a21 100644 --- a/scripts/install +++ b/scripts/install @@ -77,9 +77,9 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 -ynh_add_config --template="../conf/conf.php" --destination="$install_dir/htdocs/conf/conf.php" +#ynh_add_config --template="../conf/conf.php" --destination="$install_dir/htdocs/conf/conf.php" -#ynh_add_config --template="../conf/install.forced.php" --destination="$install_dir/htdocs/install/install.forced.php" +ynh_add_config --template="../conf/install.forced.php" --destination="$install_dir/htdocs/install/install.forced.php" #================================================= # SETUP APPLICATION WITH CURL @@ -153,14 +153,14 @@ mkdir -p /var/log/$app/ ynh_script_progression --message="configuring config file" --weight=1 # Setup HTTP auth in conf -ynh_replace_string --match_string="dolibarr_main_authentication='dolibarr'" --replace_string="dolibarr_main_authentication='http'" --target_file="$install_dir/htdocs/conf/conf.php" +#ynh_replace_string --match_string="dolibarr_main_authentication='dolibarr'" --replace_string="dolibarr_main_authentication='http'" --target_file="$install_dir/htdocs/conf/conf.php" #================================================= # STORE THE CONFIG FILE CHECKSUM #================================================= # Calculate and store the config file checksum into the app settings -ynh_store_file_checksum --file="$install_dir/htdocs/conf/conf.php" +#ynh_store_file_checksum --file="$install_dir/htdocs/conf/conf.php" #================================================= # GENERIC FINALIZATION From 21a8654302f7af9b825f442aa708ba5a075d838f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 2 Oct 2023 15:04:03 +0200 Subject: [PATCH 23/36] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 8e46a21..4b38c79 100644 --- a/scripts/install +++ b/scripts/install @@ -57,7 +57,7 @@ ynh_setup_source --dest_dir="$install_dir" # Create necessary files data_dir=$install_dir/documents -#touch $install_dir/htdocs/conf/conf.php +touch $install_dir/htdocs/conf/conf.php #================================================= # PHP-FPM CONFIGURATION From 9470bc47293b8da2e7a1e126dfe81f875c1c1df3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 2 Oct 2023 15:09:42 +0200 Subject: [PATCH 24/36] Update install --- scripts/install | 64 ++++++++++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/scripts/install b/scripts/install index 4b38c79..86c8180 100644 --- a/scripts/install +++ b/scripts/install @@ -92,48 +92,48 @@ chown -R $app: "$install_dir" mkdir -p /var/log/$app/ -# ynh_script_progression --message="Finalizing installation..." --weight=1 +ynh_script_progression --message="Finalizing installation..." --weight=1 -# ynh_script_progression --message="Generate fileconf" --weight=1 -# ynh_local_curl "/install/fileconf.php" \ -# "testpost=ok" +ynh_script_progression --message="Generate fileconf" --weight=1 +ynh_local_curl "/install/fileconf.php" \ + "testpost=ok" -# ynh_exec_fully_quiet sleep 5 +ynh_exec_fully_quiet sleep 5 -# ynh_script_progression --message="installation - step 1" --weight=3 -# ynh_local_curl "/install/step1.php" \ -# "testpost=ok" \ -# "action=set" > /var/log/$app/install1.html +ynh_script_progression --message="installation - step 1" --weight=3 +ynh_local_curl "/install/step1.php" \ + "testpost=ok" \ + "action=set" > /var/log/$app/install1.html -# ynh_exec_fully_quiet sleep 5 +ynh_exec_fully_quiet sleep 5 -# ynh_script_progression --message="installation - step 2 (may take a while)..." --weight=72 -# ynh_local_curl "/install/step2.php" \ -# "testpost=ok" \ -# "action=set" > /var/log/$app/install2.html +ynh_script_progression --message="installation - step 2 (may take a while)..." --weight=72 +ynh_local_curl "/install/step2.php" \ + "testpost=ok" \ + "action=set" > /var/log/$app/install2.html -# ynh_exec_fully_quiet sleep 5 +ynh_exec_fully_quiet sleep 5 -# ynh_script_progression --message="installation - step 4" --weight=3 -# ynh_local_curl "/install/step4.php" \ -# "testpost=ok" \ -# "action=set" > /var/log/$app/install3.html +ynh_script_progression --message="installation - step 4" --weight=3 +ynh_local_curl "/install/step4.php" \ + "testpost=ok" \ + "action=set" > /var/log/$app/install3.html -# ynh_exec_fully_quiet sleep 5 +ynh_exec_fully_quiet sleep 5 -# # Generate a random password for the admin user (will be ignored because of LDAP) -# password=$(ynh_string_random 8) +# Generate a random password for the admin user (will be ignored because of LDAP) +password=$(ynh_string_random 8) -# ynh_script_progression --message="installation - step 5" --weight=4 -# ynh_local_curl "/install/step5.php" \ -# "testpost=ok" \ -# "action=set" \ -# "pass=$password" \ -# "pass_verif=$password" > /var/log/$app/install4.html +ynh_script_progression --message="installation - step 5" --weight=4 +ynh_local_curl "/install/step5.php" \ + "testpost=ok" \ + "action=set" \ + "pass=$password" \ + "pass_verif=$password" > /var/log/$app/install4.html -# ynh_exec_fully_quiet sleep 5 +ynh_exec_fully_quiet sleep 5 -#ynh_script_progression --message="configuring LDAP" --weight=1 +ynh_script_progression --message="configuring LDAP" --weight=1 # # Populate the LDAP parameters # ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ../conf/sql/ldap.sql @@ -153,14 +153,14 @@ mkdir -p /var/log/$app/ ynh_script_progression --message="configuring config file" --weight=1 # Setup HTTP auth in conf -#ynh_replace_string --match_string="dolibarr_main_authentication='dolibarr'" --replace_string="dolibarr_main_authentication='http'" --target_file="$install_dir/htdocs/conf/conf.php" +ynh_replace_string --match_string="dolibarr_main_authentication='dolibarr'" --replace_string="dolibarr_main_authentication='http'" --target_file="$install_dir/htdocs/conf/conf.php" #================================================= # STORE THE CONFIG FILE CHECKSUM #================================================= # Calculate and store the config file checksum into the app settings -#ynh_store_file_checksum --file="$install_dir/htdocs/conf/conf.php" +ynh_store_file_checksum --file="$install_dir/htdocs/conf/conf.php" #================================================= # GENERIC FINALIZATION From 8c17f48bed72ff682967500df2d90cc0f5283cc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 2 Oct 2023 15:14:26 +0200 Subject: [PATCH 25/36] cleaning --- conf/conf.php | 2 +- scripts/install | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/conf/conf.php b/conf/conf.php index 8349eab..8489709 100644 --- a/conf/conf.php +++ b/conf/conf.php @@ -11,7 +11,7 @@ $dolibarr_main_db_pass="__DB_PWD__"; // Authentication settings //$dolibarr_main_authentication='dolibarr'; -$dolibarr_main_authentication='ldap,dolibarr'; +$dolibarr_main_authentication='ldap,dolibarr,http'; $dolibarr_main_auth_ldap_host='ldap:localhost'; diff --git a/scripts/install b/scripts/install index 86c8180..92ff2c6 100644 --- a/scripts/install +++ b/scripts/install @@ -57,7 +57,7 @@ ynh_setup_source --dest_dir="$install_dir" # Create necessary files data_dir=$install_dir/documents -touch $install_dir/htdocs/conf/conf.php +#touch $install_dir/htdocs/conf/conf.php #================================================= # PHP-FPM CONFIGURATION @@ -77,9 +77,9 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 -#ynh_add_config --template="../conf/conf.php" --destination="$install_dir/htdocs/conf/conf.php" +ynh_add_config --template="../conf/conf.php" --destination="$install_dir/htdocs/conf/conf.php" -ynh_add_config --template="../conf/install.forced.php" --destination="$install_dir/htdocs/install/install.forced.php" +#ynh_add_config --template="../conf/install.forced.php" --destination="$install_dir/htdocs/install/install.forced.php" #================================================= # SETUP APPLICATION WITH CURL @@ -133,7 +133,7 @@ ynh_local_curl "/install/step5.php" \ ynh_exec_fully_quiet sleep 5 -ynh_script_progression --message="configuring LDAP" --weight=1 +#ynh_script_progression --message="configuring LDAP" --weight=1 # # Populate the LDAP parameters # ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ../conf/sql/ldap.sql @@ -150,10 +150,10 @@ ynh_script_progression --message="configuring LDAP" --weight=1 #================================================= # MODIFY A CONFIG FILE #================================================= -ynh_script_progression --message="configuring config file" --weight=1 +#ynh_script_progression --message="configuring config file" --weight=1 # Setup HTTP auth in conf -ynh_replace_string --match_string="dolibarr_main_authentication='dolibarr'" --replace_string="dolibarr_main_authentication='http'" --target_file="$install_dir/htdocs/conf/conf.php" +#ynh_replace_string --match_string="dolibarr_main_authentication='dolibarr'" --replace_string="dolibarr_main_authentication='http'" --target_file="$install_dir/htdocs/conf/conf.php" #================================================= # STORE THE CONFIG FILE CHECKSUM From 4ac50dafec523a40d7f8f38e86035eb21f65ecc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 2 Oct 2023 15:18:44 +0200 Subject: [PATCH 26/36] Update conf.php --- conf/conf.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/conf/conf.php b/conf/conf.php index 8489709..51f45d2 100644 --- a/conf/conf.php +++ b/conf/conf.php @@ -1,6 +1,7 @@ $dolibarr_main_document_root="__INSTALL_DIR__/htdocs"; +$dolibarr_main_data_dir="__DATA_DIR__"; $dolibarr_main_url_root="http://__DOMAIN____PATH__"; -$dolibarr_main_db_type="mysql"; +$dolibarr_main_db_type="mysqli"; $dolibarr_main_db_host="localhost"; $dolibarr_main_db_port="3306"; $dolibarr_main_db_name="__DB_NAME__"; From baa191f5464952bc35b51b05575fa5414b780add Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 2 Oct 2023 15:19:59 +0200 Subject: [PATCH 27/36] Update conf.php --- conf/conf.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/conf/conf.php b/conf/conf.php index 51f45d2..f296192 100644 --- a/conf/conf.php +++ b/conf/conf.php @@ -13,19 +13,12 @@ $dolibarr_main_db_pass="__DB_PWD__"; //$dolibarr_main_authentication='dolibarr'; $dolibarr_main_authentication='ldap,dolibarr,http'; - $dolibarr_main_auth_ldap_host='ldap:localhost'; - $dolibarr_main_auth_ldap_port='389'; - $dolibarr_main_auth_ldap_version='3'; - $dolibarr_main_auth_ldap_servertype='openldap'; - $dolibarr_main_auth_ldap_login_attribute='uid'; // Ex: uid or samaccountname for active directory - $dolibarr_main_auth_ldap_dn='ou=users,dc=yunohost,dc=org'; - $dolibarr_main_auth_ldap_filter = '&(objectClass=posixAccount)'; //$dolibarr_main_auth_ldap_admin_login='uid=admin,dc=yunohost,dc=org'; From 03aebf991f7413a3893b698382ffef537d93ffbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 2 Oct 2023 15:20:08 +0200 Subject: [PATCH 28/36] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 392db1d..fa68c32 100644 --- a/manifest.toml +++ b/manifest.toml @@ -48,7 +48,7 @@ ram.runtime = "50M" [resources.install_dir] - #[resources.data_dir] + [resources.data_dir] [resources.permissions] main.url = "/" From 9c923ad7f33f4dce4034a48b454cd1cd26b5cbc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 2 Oct 2023 15:33:19 +0200 Subject: [PATCH 29/36] Update install --- scripts/install | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index 92ff2c6..8a30c1a 100644 --- a/scripts/install +++ b/scripts/install @@ -42,7 +42,7 @@ ynh_script_progression --message="Setting up source files..." --weight=1 # Load the last available version source upgrade.d/upgrade.last.sh -# Create an app.src for the last version of nextcloud +# Create an app.src for the last version of Dolibarr cat > ../conf/app.src << EOF SOURCE_URL=https://github.com/Dolibarr/dolibarr/archive/$next_version.tar.gz SOURCE_SUM=$dolibarr_source_sha256 @@ -57,7 +57,7 @@ ynh_setup_source --dest_dir="$install_dir" # Create necessary files data_dir=$install_dir/documents -#touch $install_dir/htdocs/conf/conf.php +touch $install_dir/htdocs/conf/conf.php #================================================= # PHP-FPM CONFIGURATION @@ -77,9 +77,7 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 -ynh_add_config --template="../conf/conf.php" --destination="$install_dir/htdocs/conf/conf.php" - -#ynh_add_config --template="../conf/install.forced.php" --destination="$install_dir/htdocs/install/install.forced.php" +ynh_add_config --template="../conf/install.forced.php" --destination="$install_dir/htdocs/install/install.forced.php" #================================================= # SETUP APPLICATION WITH CURL @@ -153,7 +151,7 @@ ynh_exec_fully_quiet sleep 5 #ynh_script_progression --message="configuring config file" --weight=1 # Setup HTTP auth in conf -#ynh_replace_string --match_string="dolibarr_main_authentication='dolibarr'" --replace_string="dolibarr_main_authentication='http'" --target_file="$install_dir/htdocs/conf/conf.php" +ynh_replace_string --match_string="dolibarr_main_authentication='dolibarr'" --replace_string="dolibarr_main_authentication='http'" --target_file="$install_dir/htdocs/conf/conf.php" #================================================= # STORE THE CONFIG FILE CHECKSUM From 1d0b4647e323d29e4a877b3c2dcef1149a4d15b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 2 Oct 2023 16:19:14 +0200 Subject: [PATCH 30/36] cleaning --- conf/conf.php | 26 -------------------------- conf/install.forced.php | 4 ++-- scripts/install | 9 ++------- 3 files changed, 4 insertions(+), 35 deletions(-) delete mode 100644 conf/conf.php diff --git a/conf/conf.php b/conf/conf.php deleted file mode 100644 index f296192..0000000 --- a/conf/conf.php +++ /dev/null @@ -1,26 +0,0 @@ -$dolibarr_main_document_root="__INSTALL_DIR__/htdocs"; -$dolibarr_main_data_dir="__DATA_DIR__"; -$dolibarr_main_url_root="http://__DOMAIN____PATH__"; -$dolibarr_main_db_type="mysqli"; -$dolibarr_main_db_host="localhost"; -$dolibarr_main_db_port="3306"; -$dolibarr_main_db_name="__DB_NAME__"; -$dolibarr_main_db_user="__DB_USER__"; -$dolibarr_main_db_pass="__DB_PWD__"; - - -// Authentication settings -//$dolibarr_main_authentication='dolibarr'; - -$dolibarr_main_authentication='ldap,dolibarr,http'; -$dolibarr_main_auth_ldap_host='ldap:localhost'; -$dolibarr_main_auth_ldap_port='389'; -$dolibarr_main_auth_ldap_version='3'; -$dolibarr_main_auth_ldap_servertype='openldap'; -$dolibarr_main_auth_ldap_login_attribute='uid'; // Ex: uid or samaccountname for active directory -$dolibarr_main_auth_ldap_dn='ou=users,dc=yunohost,dc=org'; -$dolibarr_main_auth_ldap_filter = '&(objectClass=posixAccount)'; - -//$dolibarr_main_auth_ldap_admin_login='uid=admin,dc=yunohost,dc=org'; -//$dolibarr_main_auth_ldap_admin_pass='secret'; -//$dolibarr_main_auth_ldap_debug='false'; diff --git a/conf/install.forced.php b/conf/install.forced.php index ac2d9b5..78aecd9 100644 --- a/conf/install.forced.php +++ b/conf/install.forced.php @@ -25,7 +25,7 @@ $force_install_noedit = 2; $force_install_message = 'Welcome to your Dolibarr install'; /** @var string Data root absolute path (documents folder) */ -$force_install_main_data_root = null; +$force_install_main_data_root = '__DATA_DIR__'; /** @var bool Force HTTPS */ $force_install_mainforcehttps = true; @@ -34,7 +34,7 @@ $force_install_mainforcehttps = true; $force_install_database = '__DB_NAME__'; /** @var string Database driver (mysql|mysqli|pgsql|mssql|sqlite|sqlite3) */ -$force_install_type = 'mysql'; +$force_install_type = 'mysqli'; /** @var string Database server host */ $force_install_dbserver = 'localhost'; diff --git a/scripts/install b/scripts/install index 8a30c1a..b3120f7 100644 --- a/scripts/install +++ b/scripts/install @@ -56,7 +56,6 @@ ynh_script_progression --message="Download source files..." --weight=70 ynh_setup_source --dest_dir="$install_dir" # Create necessary files -data_dir=$install_dir/documents touch $install_dir/htdocs/conf/conf.php #================================================= @@ -105,7 +104,7 @@ ynh_local_curl "/install/step1.php" \ ynh_exec_fully_quiet sleep 5 -ynh_script_progression --message="installation - step 2 (may take a while)..." --weight=72 +ynh_script_progression --message="installation - step 2 (may take a while)..." --weight=20 ynh_local_curl "/install/step2.php" \ "testpost=ok" \ "action=set" > /var/log/$app/install2.html @@ -175,14 +174,10 @@ ynh_script_progression --message="Configuring permissions..." --weight=1 # fi chmod 750 "$install_dir" +chmod 644 "$install_dir/htdocs/conf/conf.php" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" -chmod 644 "$install_dir/htdocs/conf/conf.php" -mkdir -p "$data_dir" -chown -R $app: "$data_dir" -chmod go-w $data_dir - #================================================= # SETUP LOGROTATE #================================================= From 3cd523503312bf5169fbf83c2fec0411c7962ae9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 2 Oct 2023 16:19:40 +0200 Subject: [PATCH 31/36] Update install --- scripts/install | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/scripts/install b/scripts/install index b3120f7..f2d0d65 100644 --- a/scripts/install +++ b/scripts/install @@ -130,24 +130,24 @@ ynh_local_curl "/install/step5.php" \ ynh_exec_fully_quiet sleep 5 -#ynh_script_progression --message="configuring LDAP" --weight=1 +ynh_script_progression --message="configuring LDAP" --weight=1 -# # Populate the LDAP parameters -# ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ../conf/sql/ldap.sql +# Populate the LDAP parameters +ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ../conf/sql/ldap.sql -# # Populate the database with YNH users. -# ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ../conf/sql/ldap_user.sql +# Populate the database with YNH users. +ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ../conf/sql/ldap_user.sql -# if php$phpversion $install_dir/scripts/user/sync_users_ldap2dolibarr.php commitiferror --server=localhost -y; then -# ynh_print_info --message="LDAP user update ok" -# else -# ynh_print_info --message="LDAP user update ended with error" -# fi +if php$phpversion $install_dir/scripts/user/sync_users_ldap2dolibarr.php commitiferror --server=localhost -y; then + ynh_print_info --message="LDAP user update ok" +else + ynh_print_info --message="LDAP user update ended with error" +fi #================================================= # MODIFY A CONFIG FILE #================================================= -#ynh_script_progression --message="configuring config file" --weight=1 +ynh_script_progression --message="configuring config file" --weight=1 # Setup HTTP auth in conf ynh_replace_string --match_string="dolibarr_main_authentication='dolibarr'" --replace_string="dolibarr_main_authentication='http'" --target_file="$install_dir/htdocs/conf/conf.php" From 35beb43d54fbb423b59c60cdc2d5ff44451a6cf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 2 Oct 2023 16:22:40 +0200 Subject: [PATCH 32/36] Update install --- scripts/install | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/install b/scripts/install index f2d0d65..9b2bb58 100644 --- a/scripts/install +++ b/scripts/install @@ -130,19 +130,19 @@ ynh_local_curl "/install/step5.php" \ ynh_exec_fully_quiet sleep 5 -ynh_script_progression --message="configuring LDAP" --weight=1 +# ynh_script_progression --message="configuring LDAP" --weight=1 -# Populate the LDAP parameters -ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ../conf/sql/ldap.sql +# # Populate the LDAP parameters +# ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ../conf/sql/ldap.sql -# Populate the database with YNH users. -ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ../conf/sql/ldap_user.sql +# # Populate the database with YNH users. +# ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ../conf/sql/ldap_user.sql -if php$phpversion $install_dir/scripts/user/sync_users_ldap2dolibarr.php commitiferror --server=localhost -y; then - ynh_print_info --message="LDAP user update ok" -else - ynh_print_info --message="LDAP user update ended with error" -fi +# if php$phpversion $install_dir/scripts/user/sync_users_ldap2dolibarr.php commitiferror --server=localhost -y; then +# ynh_print_info --message="LDAP user update ok" +# else +# ynh_print_info --message="LDAP user update ended with error" +# fi #================================================= # MODIFY A CONFIG FILE From 6dad0b1d0c8ec9d8e1c482b886f9f5f79816a44c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 27 Nov 2023 15:31:28 +0100 Subject: [PATCH 33/36] cleaning --- hooks/post_user_create | 2 +- manifest.toml | 5 ++++- scripts/upgrade.d/upgrade.last.sh | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/hooks/post_user_create b/hooks/post_user_create index bd9cbd2..5a6ed86 100644 --- a/hooks/post_user_create +++ b/hooks/post_user_create @@ -1,6 +1,6 @@ #!/bin/bash app="$(basename $0 | cut -d- -f 2-)" # Extract the app name from the script name, which is supposed to be something like "50-app_id" -src_path=$(yunohost app setting $app final_path) +src_path=$(yunohost app setting $app install_dir) # member=__MEMBER__ # Sync users diff --git a/manifest.toml b/manifest.toml index fa68c32..6c5bc33 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Dolibarr" description.en = "Manage the various aspects of your business or association" description.fr = "Gérez les différents aspects de votre activité pro ou associative" -version = "18.0.1~ynh1" +version = "18.0.3~ynh1" maintainers = ["mastereur"] @@ -21,8 +21,11 @@ code = "https://github.com/Dolibarr/dolibarr" yunohost = ">= 11.2" architectures = "all" multi_instance = true + ldap = true + sso = false + disk = "50M" ram.build = "50M" ram.runtime = "50M" diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 8880793..e73e59d 100644 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,7 +1,7 @@ #!/bin/bash # Target version of the Dolibarr update -next_version="18.0.1" +next_version="18.0.3" # Dolibarr tarball checksum -dolibarr_source_sha256="37bd3c8533b821c241dbb34b0e88349c1d5b43f7ffa6027f0b7970748d1f727a" +dolibarr_source_sha256="8639d466b26f0fba7d2b610a96ffcf36a657b1e00bdc2e5a1ac5287521dcb4ed" From a13751f2249c0660efb2e5334e7287ae5bb87ed9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 27 Nov 2023 16:46:09 +0100 Subject: [PATCH 34/36] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 9b2bb58..9187b0d 100644 --- a/scripts/install +++ b/scripts/install @@ -76,7 +76,7 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 -ynh_add_config --template="../conf/install.forced.php" --destination="$install_dir/htdocs/install/install.forced.php" +ynh_add_config --template="install.forced.php" --destination="$install_dir/htdocs/install/install.forced.php" #================================================= # SETUP APPLICATION WITH CURL From 6c7bd2a99cf5a8f87a17be820c4b8e7fcdf2ba21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 27 Nov 2023 16:47:57 +0100 Subject: [PATCH 35/36] Update upgrade --- scripts/upgrade | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/upgrade b/scripts/upgrade index a7fe1c3..041369a 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -14,6 +14,7 @@ source /usr/share/yunohost/helpers #================================================= update_version=$(ynh_app_upstream_version "../manifest.json") +current_version=$(ynh_app_setting_get --app=$app --key=version) #================================================= # CHECK VERSION From 25b36a032dd808b3082124a8e01265bf161d64d5 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 27 Nov 2023 15:48:09 +0000 Subject: [PATCH 36/36] Auto-update README --- README.md | 3 ++- README_fr.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e1f0d64..0ddb793 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Dolibarr ERP & CRM is a modern software for managing your professional or associative activity (contacts, invoices, orders, stocks, agenda, etc.). -**Shipped version:** 18.0.1~ynh1 +**Shipped version:** 18.0.3~ynh1 **Demo:** https://www.dolibarr.org/onlinedemo @@ -32,6 +32,7 @@ Dolibarr ERP & CRM is a modern software for managing your professional or associ * Official user documentation: * Official admin documentation: * Upstream app code repository: +* YunoHost Store: * Report a bug: ## Developer info diff --git a/README_fr.md b/README_fr.md index 733f59f..a9fdda6 100644 --- a/README_fr.md +++ b/README_fr.md @@ -18,7 +18,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Dolibarr ERP & CRM est un logiciel moderne de gestion de votre activité professionnelle ou associative (contacts, factures, commandes, stocks, agenda, etc.). -**Version incluse :** 18.0.1~ynh1 +**Version incluse :** 18.0.3~ynh1 **Démo :** https://www.dolibarr.org/onlinedemo @@ -32,6 +32,7 @@ Dolibarr ERP & CRM est un logiciel moderne de gestion de votre activité profess * Documentation officielle utilisateur : * Documentation officielle de l’admin : * Dépôt de code officiel de l’app : +* YunoHost Store: * Signaler un bug : ## Informations pour les développeurs