From 20459e3eba624fc8d0a815003d14d3ee83a74536 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 25 Mar 2024 21:26:07 +0100 Subject: [PATCH 01/27] First manifestv2 retry --- conf/nginx.conf | 2 +- manifest.json | 52 ----------- manifest.toml | 72 +++++++++++++++ scripts/_common.sh | 18 ---- scripts/backup | 16 ++-- scripts/change_url | 74 ++++++++-------- scripts/install | 215 ++++++++++----------------------------------- scripts/remove | 30 +++---- scripts/restore | 60 ++++++------- scripts/upgrade | 112 +++++++++++------------ tests.toml | 11 +++ 11 files changed, 277 insertions(+), 385 deletions(-) delete mode 100644 manifest.json create mode 100644 manifest.toml create mode 100644 tests.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.json b/manifest.json deleted file mode 100644 index 28fcc73..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": "18.0.3~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.2" - }, - "multi_instance": true, - "services": [ - "nginx", - "php8.1-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 new file mode 100644 index 0000000..ec2af61 --- /dev/null +++ b/manifest.toml @@ -0,0 +1,72 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json + +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 = "18.0.3~ynh2" + +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 = "cpe:2.3:a:dolibarr:dolibarr" + +[integration] +yunohost = ">= 11.2" +architectures = "all" +multi_instance = true +ldap = true +sso = true +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] + type = "domain" + + [install.path] + type = "path" + default = "/dolibarr" + + [install.admin] + type = "user" + +[resources] + [resources.system_user] + + [resources.install_dir] + + [resources.data_dir] + + [resources.permissions] + main.url = "/" + + [resources.apt] + packages = [ + "php8.1-mysql", + "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 562acb3..944a65e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -3,24 +3,6 @@ #================================================= # COMMON VARIABLES #================================================= -YNH_PHP_VERSION="8.1" - -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) -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 c68ac42..b92df48 100644 --- a/scripts/install +++ b/scripts/install @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -10,70 +8,15 @@ source _common.sh source /usr/share/yunohost/helpers #================================================= -# MANAGE SCRIPT FAILURE +# INITIALIZE AND STORE SETTINGS #================================================= -# Exit if an error occurs during the execution of the script -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 -phpversion=$YNH_PHP_VERSION - -app=$YNH_APP_INSTANCE_NAME - -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -ynh_script_progression --message="Validating installation parameters..." --weight=1 - -final_path=/var/www/$app -test ! -e "$final_path" || ynh_die --message="This path already contains a folder" - -# Register (book) web path -ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url - -#================================================= -# STORE SETTINGS FROM MANIFEST -#================================================= -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 -ynh_app_setting_set --app=$app --key=version --value=$(ynh_app_upstream_version "../manifest.json") - -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# INSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Installing dependencies..." --weight=1 - -ynh_install_app_dependencies $pkg_dependencies - -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." --weight=2 - -# Create a system user -ynh_system_user_create --username=$app --home_dir="$final_path" +ynh_app_setting_set --app=$app --key=version --value=$(ynh_app_upstream_version) #================================================= # CREATE A MYSQL DATABASE #================================================= -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 +ynh_script_progression --message="Creating $app's MySQL database..." --weight=1 ynh_mysql_execute_as_root --sql="ALTER DATABASE $db_name charset=utf8" @@ -82,106 +25,70 @@ 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 - -# 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 -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.bz2 -SOURCE_IN_SUBDIR=true -EOF - -ynh_app_setting_set --app=$app --key=final_path --value=$final_path - # 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 --source_id="main" --dest_dir="$install_dir" # Create necessary files -datadir=$final_path/documents -touch $final_path/htdocs/conf/conf.php +touch $install_dir/htdocs/conf/conf.php #================================================= -# PHP-FPM CONFIGURATION +# PREPARE AND INSTALL APP #================================================= -ynh_script_progression --message="Configuring PHP-FPM" --weight=2 +ynh_script_progression --message="Adding $app's configuration file..." --weight=1 -fpm_footprint="medium" -fpm_usage="medium" +ynh_add_config --template="install.forced.php" --destination="$install_dir/htdocs/install/install.forced.php" -ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint -ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage +#================================================= +# SYSTEM CONFIGURATION +#================================================= +ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 # 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) - -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=1 +ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint # Create a dedicated nginx config ynh_add_nginx_config -#================================================= -# SPECIFIC SETUP -#================================================= -# PREPARE AND INSTALL APP -#================================================= -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" +# Use logrotate to manage application logfile(s) +ynh_use_logrotate --logfile="$install_dir/documents/dolibarr.log" #================================================= # SETUP APPLICATION WITH CURL #================================================= # Set right permissions for curl install -chown -R $app: "$final_path" - -# 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" -fi - -# Reload NGINX -ynh_systemd_action --service_name=nginx --action=reload +chown -R "$app:" "$install_dir" # Installation with curl -mkdir -p /var/log/$app/ +mkdir -p "/var/log/$app/" ynh_script_progression --message="Finalizing installation..." --weight=1 ynh_script_progression --message="Generate fileconf" --weight=1 ynh_local_curl "/install/fileconf.php" \ - "testpost=ok" + "testpost=ok" 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 + "testpost=ok" \ + "action=set" > /var/log/$app/install1.html 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 + "testpost=ok" \ + "action=set" > /var/log/$app/install2.html 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 + "testpost=ok" \ + "action=set" > /var/log/$app/install3.html ynh_exec_fully_quiet sleep 5 @@ -190,10 +97,10 @@ 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 + "testpost=ok" \ + "action=set" \ + "pass=$password" \ + "pass_verif=$password" > /var/log/$app/install4.html ynh_exec_fully_quiet sleep 5 @@ -205,77 +112,47 @@ 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 - ynh_print_info --message="LDAP user update ok" +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" + ynh_print_info --message="LDAP user update ended with error" fi -# Remove the public access -ynh_permission_update --permission="main" --remove="visitors" - #================================================= # MODIFY A CONFIG FILE #================================================= 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="$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 - -#================================================= -# SETUP LOGROTATE -#================================================= -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" - -#================================================= -# SETUP SSOWAT -#================================================= -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" -fi - -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -ynh_systemd_action --service_name=nginx --action=reload +chmod 644 "$install_dir/htdocs/conf/conf.php" +mkdir -p "$data_dir" +chown -R $app: "$data_dir" +chmod go-w $data_dir #================================================= # 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 666bacb..bf70b0f 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 @@ -204,10 +204,10 @@ SOURCE_IN_SUBDIR=true EOF - 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 @@ -219,7 +219,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 @@ -237,9 +237,9 @@ EOF ynh_exec_fully_quiet sleep 5 # 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" - 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 diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..35a337a --- /dev/null +++ b/tests.toml @@ -0,0 +1,11 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json + +test_format = 1.0 + +[default] + + # ------------ + # Tests to run + # ------------ + + test_upgrade_from.7e3914481ac4d6c40f3be3f35f155fac6f4387c6.name = "old version" From 298d0f636a13fe3314212d0ca5ae03b30b941df4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 25 Mar 2024 21:29:54 +0100 Subject: [PATCH 02/27] Add source to manifest --- manifest.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/manifest.toml b/manifest.toml index ec2af61..a6d9a81 100644 --- a/manifest.toml +++ b/manifest.toml @@ -42,6 +42,11 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen type = "user" [resources] + [resources.sources.main] + url = "https://github.com/Dolibarr/dolibarr/archive/18.0.3.tar.gz" + sha256 = "8639d466b26f0fba7d2b610a96ffcf36a657b1e00bdc2e5a1ac5287521dcb4ed" + autoupdate.strategy = "latest_github_release" + [resources.system_user] [resources.install_dir] From 837f1d562bc2762299c1a159ed649cfb7e331473 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 25 Mar 2024 21:34:30 +0100 Subject: [PATCH 03/27] fix install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index b92df48..b4717ad 100644 --- a/scripts/install +++ b/scripts/install @@ -44,7 +44,7 @@ ynh_add_config --template="install.forced.php" --destination="$install_dir/htdoc ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 # Create a dedicated php-fpm config -ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint +ynh_add_fpm_config # Create a dedicated nginx config ynh_add_nginx_config From c4ed8e467eb187451d697b1a181e5547d2641360 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 25 Mar 2024 21:35:24 +0100 Subject: [PATCH 04/27] add init_main_permission --- manifest.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/manifest.toml b/manifest.toml index a6d9a81..844ea5c 100644 --- a/manifest.toml +++ b/manifest.toml @@ -38,6 +38,10 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen type = "path" default = "/dolibarr" + [install.init_main_permission] + type = "group" + default = "visitors" + [install.admin] type = "user" From bd56d78737cb1af4d17bb936869b2a00726e8ae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 25 Mar 2024 22:28:52 +0100 Subject: [PATCH 05/27] Continue manifestv2 --- hooks/post_user_create | 30 ++++++------ manifest.toml | 1 + scripts/backup | 33 +------------ scripts/change_url | 96 ++---------------------------------- scripts/install | 105 +++++++++++++--------------------------- scripts/remove | 79 +++--------------------------- scripts/restore | 107 ++++++----------------------------------- scripts/upgrade | 87 +++++++++------------------------ 8 files changed, 100 insertions(+), 438 deletions(-) diff --git a/hooks/post_user_create b/hooks/post_user_create index bd9cbd2..7712448 100644 --- a/hooks/post_user_create +++ b/hooks/post_user_create @@ -1,21 +1,23 @@ -#!/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) +#!/usr/bin/env bash + +# Extract the app name from the script name, which is supposed to be something like "50-app_id" +app="$(basename "$0" | cut -d- -f 2-)" + +src_path=$(yunohost app setting "$app" install_dir) # member=__MEMBER__ - + # Sync users if sudo php "$src_path/scripts/user/sync_users_ldap2dolibarr.php" commitiferror --server=localhost -y; then - echo ldap user update ok + echo "LDAP user update succeeded" else - echo ldap user update ended with error + echo "LDAP user update ended with error" fi - + # If YNH users should also be members, sync members -# if [ $member -eq 1 ]; -# then - # if sudo php "$src_path/scripts/members/sync_members_ldap2dolibarr.php" commitiferror 1 --server=localhost -y; then - # echo ldap member update ok - # else - # echo ldap member update ended with error - # fi +# if [ $member -eq 1 ]; then +# if sudo php "$src_path/scripts/members/sync_members_ldap2dolibarr.php" commitiferror 1 --server=localhost -y; then +# echo ldap member update ok +# else +# echo ldap member update ended with error +# fi # fi diff --git a/manifest.toml b/manifest.toml index 844ea5c..5870764 100644 --- a/manifest.toml +++ b/manifest.toml @@ -69,6 +69,7 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen "php8.1-soap", "php8.1-curl", "php8.1-intl", + "php8.1-ldap", "php8.1-opcache", "php8.1-calendar", "php8.1-zip", diff --git a/scripts/backup b/scripts/backup index 0aa665b..97adcfe 100755 --- a/scripts/backup +++ b/scripts/backup @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -10,25 +8,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 #================================================= @@ -41,23 +20,13 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$install_dir" #================================================= -# BACKUP THE NGINX CONFIGURATION +# BACKUP THE SYSTEM CONFIGURATION #================================================= ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# BACKUP THE PHP-FPM CONFIGURATION -#================================================= - ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" -#================================================= -# SPECIFIC BACKUP -#================================================= -# BACKUP LOGROTATE -#================================================= - ynh_backup --src_path="/etc/logrotate.d/$app" #================================================= diff --git a/scripts/change_url b/scripts/change_url index 8cecbab..01dd48c 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC STARTING #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -9,61 +7,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 #================================================= # MODIFY URL IN NGINX CONF #================================================= @@ -71,46 +14,13 @@ 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 #================================================= # UPDATE conf file #================================================= -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 +ynh_replace_string --target_file="$install_dir/htdocs/conf/conf.php" \ + --match_string="$old_domain$old_path" \ + --replace_string="$new_domain$new_path" #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index b4717ad..846bade 100644 --- a/scripts/install +++ b/scripts/install @@ -28,8 +28,8 @@ ynh_script_progression --message="Setting up source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --source_id="main" --dest_dir="$install_dir" -# Create necessary files -touch $install_dir/htdocs/conf/conf.php +chmod 750 "$install_dir" +chown -R "$app:www-data" "$install_dir" #================================================= # PREPARE AND INSTALL APP @@ -55,104 +55,67 @@ ynh_use_logrotate --logfile="$install_dir/documents/dolibarr.log" #================================================= # SETUP APPLICATION WITH CURL #================================================= - -# Set right permissions for curl install -chown -R "$app:" "$install_dir" - -# Installation with curl - -mkdir -p "/var/log/$app/" - ynh_script_progression --message="Finalizing installation..." --weight=1 -ynh_script_progression --message="Generate fileconf" --weight=1 -ynh_local_curl "/install/fileconf.php" \ - "testpost=ok" +# Create necessary files +touch "$install_dir/htdocs/conf/conf.php" +ynh_script_progression --message="Generate fileconf" --weight=1 +ynh_local_curl "/install/fileconf.php" "testpost=ok" 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_local_curl "/install/step1.php" "testpost=ok" "action=set" 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_local_curl "/install/step2.php" "testpost=ok" "action=set" 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_local_curl "/install/step4.php" "testpost=ok" "action=set" 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) - 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_local_curl "/install/step5.php" "testpost=ok" "action=set" "pass=$password" "pass_verif=$password" ynh_exec_fully_quiet sleep 5 -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 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 - -#================================================= -# MODIFY A CONFIG FILE -#================================================= -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" -#================================================= -# 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" +chmod 644 "$install_dir/htdocs/conf/conf.php" -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= -#REMOVEME? 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" +if [ ! -f "$install_dir/documents/install.lock" ]; then + echo 'This is a lock file to prevent use of install pages (set with permission 440)' > "$install_dir/documents/install.lock" + chown "$app:$app" "$install_dir/documents/install.lock" + chmod 440 "$install_dir/documents/install.lock" fi -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$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 +mkdir -p "$install_dir/documents" +chown -R "$app:" "$install_dir/documents" +chmod go-w "$install_dir/documents" + +#================================================= +# SETUP LDAP IN DATABASE +#================================================= +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 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_warn --message="LDAP user update ended with error" +fi #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index e245996..eadb498 100644 --- a/scripts/remove +++ b/scripts/remove @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -10,78 +8,27 @@ source _common.sh source /usr/share/yunohost/helpers #================================================= -# LOAD SETTINGS +# REMOVE SYSTEM CONFIGURATIONS #================================================= -#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 -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 +ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 # 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 OLD FILES #================================================= +# 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 a directory securely ynh_secure_remove --file="/etc/$app" @@ -89,16 +36,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..6590cc8 100755 --- a/scripts/restore +++ b/scripts/restore @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -10,49 +8,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,73 +15,41 @@ 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 +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R "$app:www-data" "$install_dir" -# Define and install dependencies -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies +chmod 644 "$install_dir/htdocs/conf/conf.php" #================================================= -# RESTORE THE PHP-FPM CONFIGURATION +# RESTORE THE MYSQL DATABASE #================================================= -ynh_print_info --message="Reconfiguring PHP-FPM..." +ynh_script_progression --message="Restoring the MySQL database..." --weight=1 + +ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql + +#================================================= +# RESTORE SYSTEM CONFIGURATIONS +#================================================= +ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 # Restore the file first, so it can have a backup if different 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 --phpversion="$phpversion" 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 - -#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 - -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1 - ynh_restore_file --origin_path="/etc/logrotate.d/$app" -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1 - -# Set permissions on app files -chmod 750 "$install_dir" -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 - -#================================================= -# GENERIC FINALIZATION #================================================= # RELOAD NGINX AND PHP-FPM #================================================= ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload -ynh_systemd_action --service_name=php$phpversion-fpm --action=reload +ynh_systemd_action --service_name="php$phpversion-fpm" --action=reload #================================================= # END OF SCRIPT diff --git a/scripts/upgrade b/scripts/upgrade index bf70b0f..f4e71ea 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -9,49 +7,8 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=2 +update_version=$(ynh_app_upstream_version) -#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 -#================================================= - -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 #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -144,7 +101,7 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 # 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 @@ -171,7 +128,7 @@ then # While the current version is not the last version, do an upgrade while [ "$last_version" != "$current_version" ] do - + # The major version is the first part of the version number current_major_version=${current_version%%.*} @@ -180,7 +137,7 @@ then else source upgrade.d/upgrade.$current_major_version.sh fi - + # If the current version has the same major version than the next one, # then it's the last upgrade to do # We also cover the case where the last version is the first of the current major version series @@ -188,12 +145,12 @@ then if [[ ("$last_major_version" -eq "$current_major_version") || ( ("$last_major_version" -eq "$((current_major_version+1))") && ("$next_version" == "$last_version") ) ]]; then current_major_version=last fi - + # Load the value for this version source upgrade.d/upgrade.$current_major_version.sh ynh_print_info --message="Upgrading app from $current_version to $next_version" - + # Create an app.src for this version of Dolibarr cat > ../conf/app.src << EOF SOURCE_URL=https://github.com/Dolibarr/dolibarr/archive/$next_version.tar.gz @@ -212,35 +169,35 @@ EOF then ynh_secure_remove $lock fi - + mkdir -p /var/log/$app/ - + # 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 ynh_print_info --message="Changing Database charset to utf8" - + ynh_mysql_execute_as_root --database=$db_name --sql="ALTER DATABASE $db_name charset=utf8" - + ynh_local_curl "/install/repair.php" \ "force_utf8_on_tables=confirmed" > /var/log/$app/repair.html fi ynh_exec_fully_quiet sleep 5 - + # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" - + 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 @@ -262,24 +219,24 @@ EOF 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 current_major_version=${current_version%%.*} - + done - + 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 - + ynh_app_setting_set --app=$app --key=version --value=$update_version fi From 6682eeedd4be0fa299856f90766da84ea66e3bbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 25 Mar 2024 22:40:48 +0100 Subject: [PATCH 06/27] revert some changes --- scripts/install | 63 +++++++++++++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 23 deletions(-) diff --git a/scripts/install b/scripts/install index 846bade..1efc85a 100644 --- a/scripts/install +++ b/scripts/install @@ -28,7 +28,6 @@ ynh_script_progression --message="Setting up source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --source_id="main" --dest_dir="$install_dir" -chmod 750 "$install_dir" chown -R "$app:www-data" "$install_dir" #================================================= @@ -82,26 +81,6 @@ ynh_script_progression --message="installation - step 5" --weight=4 ynh_local_curl "/install/step5.php" "testpost=ok" "action=set" "pass=$password" "pass_verif=$password" ynh_exec_fully_quiet sleep 5 -# 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" - -# Calculate and store the config file checksum into the app settings -ynh_store_file_checksum --file="$install_dir/htdocs/conf/conf.php" -chmod 644 "$install_dir/htdocs/conf/conf.php" - -if [ ! -f "$install_dir/documents/install.lock" ]; then - echo 'This is a lock file to prevent use of install pages (set with permission 440)' > "$install_dir/documents/install.lock" - chown "$app:$app" "$install_dir/documents/install.lock" - chmod 440 "$install_dir/documents/install.lock" -fi - -chmod -R o-rwx "$install_dir" -chown -R "$app:www-data" "$install_dir" - -mkdir -p "$install_dir/documents" -chown -R "$app:" "$install_dir/documents" -chmod go-w "$install_dir/documents" - #================================================= # SETUP LDAP IN DATABASE #================================================= @@ -113,10 +92,48 @@ 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" "$install_dir/scripts/user/sync_users_ldap2dolibarr.php" commitiferror --server=localhost -y; then - ynh_print_warn --message="LDAP user update ended with error" +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_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" + +#================================================= +# SECURE FILES AND DIRECTORIES +#================================================= +#REMOVEME? 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 + +chmod 750 "$install_dir" +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 + #================================================= # END OF SCRIPT #================================================= From a48bd3ba018f86a68e0803251d5f7ac00a5cd6e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 25 Mar 2024 22:46:09 +0100 Subject: [PATCH 07/27] revert some changes --- scripts/install | 52 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 16 deletions(-) diff --git a/scripts/install b/scripts/install index 1efc85a..b92df48 100644 --- a/scripts/install +++ b/scripts/install @@ -28,7 +28,8 @@ ynh_script_progression --message="Setting up source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --source_id="main" --dest_dir="$install_dir" -chown -R "$app:www-data" "$install_dir" +# Create necessary files +touch $install_dir/htdocs/conf/conf.php #================================================= # PREPARE AND INSTALL APP @@ -43,7 +44,7 @@ ynh_add_config --template="install.forced.php" --destination="$install_dir/htdoc ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 # Create a dedicated php-fpm config -ynh_add_fpm_config +ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint # Create a dedicated nginx config ynh_add_nginx_config @@ -54,43 +55,62 @@ ynh_use_logrotate --logfile="$install_dir/documents/dolibarr.log" #================================================= # SETUP APPLICATION WITH CURL #================================================= + +# Set right permissions for curl install +chown -R "$app:" "$install_dir" + +# Installation with curl + +mkdir -p "/var/log/$app/" + ynh_script_progression --message="Finalizing installation..." --weight=1 -# Create necessary files -touch "$install_dir/htdocs/conf/conf.php" - ynh_script_progression --message="Generate fileconf" --weight=1 -ynh_local_curl "/install/fileconf.php" "testpost=ok" +ynh_local_curl "/install/fileconf.php" \ + "testpost=ok" + 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" +ynh_local_curl "/install/step1.php" \ + "testpost=ok" \ + "action=set" > /var/log/$app/install1.html + 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" +ynh_local_curl "/install/step2.php" \ + "testpost=ok" \ + "action=set" > /var/log/$app/install2.html + 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" +ynh_local_curl "/install/step4.php" \ + "testpost=ok" \ + "action=set" > /var/log/$app/install3.html + 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) + ynh_script_progression --message="installation - step 5" --weight=4 -ynh_local_curl "/install/step5.php" "testpost=ok" "action=set" "pass=$password" "pass_verif=$password" +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 -#================================================= -# SETUP LDAP IN DATABASE -#================================================= -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 +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 +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" From 39df2c48b8cbffa8afbb8ce0b27cf57c81b789f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 25 Mar 2024 22:47:38 +0100 Subject: [PATCH 08/27] revert some changes --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index b92df48..b4717ad 100644 --- a/scripts/install +++ b/scripts/install @@ -44,7 +44,7 @@ ynh_add_config --template="install.forced.php" --destination="$install_dir/htdoc ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 # Create a dedicated php-fpm config -ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint +ynh_add_fpm_config # Create a dedicated nginx config ynh_add_nginx_config From 3877c8b02ec8267b9013cf94ddebec3aee116819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 25 Mar 2024 22:51:54 +0100 Subject: [PATCH 09/27] restore some changes --- scripts/install | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/scripts/install b/scripts/install index b4717ad..fb777e5 100644 --- a/scripts/install +++ b/scripts/install @@ -61,34 +61,25 @@ chown -R "$app:" "$install_dir" # Installation with curl -mkdir -p "/var/log/$app/" - 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_local_curl "/install/fileconf.php" "testpost=ok" 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_local_curl "/install/step1.php" "testpost=ok" "action=set" 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_local_curl "/install/step2.php" "testpost=ok" "action=set" 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_local_curl "/install/step4.php" "testpost=ok" "action=set" ynh_exec_fully_quiet sleep 5 @@ -96,11 +87,7 @@ ynh_exec_fully_quiet sleep 5 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_local_curl "/install/step5.php" "testpost=ok" "action=set" "pass=$password" "pass_verif=$password" ynh_exec_fully_quiet sleep 5 From 117cf719e533f333473af390eab280675d154b59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 25 Mar 2024 23:12:32 +0100 Subject: [PATCH 10/27] restore more --- scripts/install | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index fb777e5..93abc81 100644 --- a/scripts/install +++ b/scripts/install @@ -29,7 +29,9 @@ ynh_script_progression --message="Setting up source files..." --weight=1 ynh_setup_source --source_id="main" --dest_dir="$install_dir" # Create necessary files -touch $install_dir/htdocs/conf/conf.php +touch "$install_dir/htdocs/conf/conf.php" + +chown -R "$app:www-data" "$install_dir" #================================================= # PREPARE AND INSTALL APP @@ -57,7 +59,7 @@ ynh_use_logrotate --logfile="$install_dir/documents/dolibarr.log" #================================================= # Set right permissions for curl install -chown -R "$app:" "$install_dir" +# chown -R "$app:" "$install_dir" # Installation with curl From 4e2eac785976fad5b651338c0a91531671a6da21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 25 Mar 2024 23:32:28 +0100 Subject: [PATCH 11/27] revert more --- scripts/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 93abc81..529d182 100644 --- a/scripts/install +++ b/scripts/install @@ -31,7 +31,7 @@ ynh_setup_source --source_id="main" --dest_dir="$install_dir" # Create necessary files touch "$install_dir/htdocs/conf/conf.php" -chown -R "$app:www-data" "$install_dir" +# chown -R "$app:www-data" "$install_dir" #================================================= # PREPARE AND INSTALL APP @@ -59,7 +59,7 @@ ynh_use_logrotate --logfile="$install_dir/documents/dolibarr.log" #================================================= # Set right permissions for curl install -# chown -R "$app:" "$install_dir" +chown -R "$app:" "$install_dir" # Installation with curl From f0c9b095f7902a0a01772d98811774437bd47e32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 25 Mar 2024 23:40:09 +0100 Subject: [PATCH 12/27] Update --- manifest.toml | 2 -- scripts/install | 39 ++++++++++++++++++++------------------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/manifest.toml b/manifest.toml index 5870764..8938c5e 100644 --- a/manifest.toml +++ b/manifest.toml @@ -55,8 +55,6 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen [resources.install_dir] - [resources.data_dir] - [resources.permissions] main.url = "/" diff --git a/scripts/install b/scripts/install index 529d182..0368fcd 100644 --- a/scripts/install +++ b/scripts/install @@ -28,11 +28,6 @@ ynh_script_progression --message="Setting up source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --source_id="main" --dest_dir="$install_dir" -# Create necessary files -touch "$install_dir/htdocs/conf/conf.php" - -# chown -R "$app:www-data" "$install_dir" - #================================================= # PREPARE AND INSTALL APP #================================================= @@ -58,6 +53,12 @@ ynh_use_logrotate --logfile="$install_dir/documents/dolibarr.log" # SETUP APPLICATION WITH CURL #================================================= +# Create necessary files +touch "$install_dir/htdocs/conf/conf.php" + +# chown -R "$app:www-data" "$install_dir" + + # Set right permissions for curl install chown -R "$app:" "$install_dir" @@ -85,6 +86,8 @@ ynh_local_curl "/install/step4.php" "testpost=ok" "action=set" ynh_exec_fully_quiet sleep 5 +cp "$install_dir/htdocs/conf/conf.php" "$install_dir/htdocs/conf/conf.php.intermediate" + # Generate a random password for the admin user (will be ignored because of LDAP) password=$(ynh_string_random 8) @@ -101,7 +104,7 @@ 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 $install_dir/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" @@ -113,11 +116,9 @@ fi 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" - -#================================================= -# STORE THE CONFIG FILE CHECKSUM -#================================================= +ynh_replace_string --target_file="$install_dir/htdocs/conf/conf.php" \ + --match_string="dolibarr_main_authentication='dolibarr'" \ + --replace_string="dolibarr_main_authentication='http'" # Calculate and store the config file checksum into the app settings ynh_store_file_checksum --file="$install_dir/htdocs/conf/conf.php" @@ -128,20 +129,20 @@ ynh_store_file_checksum --file="$install_dir/htdocs/conf/conf.php" #REMOVEME? 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" +if [ ! -f "$install_dir/documents/install.lock" ]; then + echo 'This is a lock file to prevent use of install pages (set with permission 440)' > "$install_dir/documents/install.lock" + chown $app:$app "$install_dir/documents/install.lock" + chmod 440 "$install_dir/documents/install.lock" fi chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$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 +mkdir -p "$install_dir/documents" +chown -R "$app:" "$install_dir/documents" +chmod go-w "$install_dir/documents" #================================================= # END OF SCRIPT From 133de8d19dbc06ae6356fc8f17dae5f478a3bde9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 25 Mar 2024 23:52:00 +0100 Subject: [PATCH 13/27] update again --- scripts/install | 69 +++++++++++++++++++------------------------------ 1 file changed, 27 insertions(+), 42 deletions(-) diff --git a/scripts/install b/scripts/install index 0368fcd..85be84d 100644 --- a/scripts/install +++ b/scripts/install @@ -52,69 +52,37 @@ ynh_use_logrotate --logfile="$install_dir/documents/dolibarr.log" #================================================= # SETUP APPLICATION WITH CURL #================================================= +# Installation with curl +ynh_script_progression --message="Configuring $app..." --weight=1 # Create necessary files touch "$install_dir/htdocs/conf/conf.php" -# chown -R "$app:www-data" "$install_dir" - - # Set right permissions for curl install chown -R "$app:" "$install_dir" -# Installation with curl - -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_exec_fully_quiet sleep 5 ynh_script_progression --message="installation - step 1" --weight=3 ynh_local_curl "/install/step1.php" "testpost=ok" "action=set" - 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" - 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" - ynh_exec_fully_quiet sleep 5 -cp "$install_dir/htdocs/conf/conf.php" "$install_dir/htdocs/conf/conf.php.intermediate" - # 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" - ynh_exec_fully_quiet sleep 5 -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 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 - -#================================================= -# MODIFY A CONFIG FILE -#================================================= -ynh_script_progression --message="configuring config file" --weight=1 - # Setup HTTP auth in conf ynh_replace_string --target_file="$install_dir/htdocs/conf/conf.php" \ --match_string="dolibarr_main_authentication='dolibarr'" \ @@ -122,24 +90,41 @@ ynh_replace_string --target_file="$install_dir/htdocs/conf/conf.php" \ # Calculate and store the config file checksum into the app settings ynh_store_file_checksum --file="$install_dir/htdocs/conf/conf.php" +chmod 644 "$install_dir/htdocs/conf/conf.php" + +# Set permissions on app files +if [ ! -f "$install_dir/documents/install.lock" ]; then + echo 'This is a lock file to prevent use of install pages (set with permission 440)' > "$install_dir/documents/install.lock" + chown "$app:$app" "$install_dir/documents/install.lock" + chmod 440 "$install_dir/documents/install.lock" +fi + +#================================================= +# SETUP LDAP +#================================================= +ynh_script_progression --message="Configuring LDAP for $app..." --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 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 #================================================= # SECURE FILES AND DIRECTORIES #================================================= #REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1 -# Set permissions on app files -if [ ! -f "$install_dir/documents/install.lock" ]; then - echo 'This is a lock file to prevent use of install pages (set with permission 440)' > "$install_dir/documents/install.lock" - chown $app:$app "$install_dir/documents/install.lock" - chmod 440 "$install_dir/documents/install.lock" -fi - chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R "$app:www-data" "$install_dir" -chmod 644 "$install_dir/htdocs/conf/conf.php" mkdir -p "$install_dir/documents" chown -R "$app:" "$install_dir/documents" chmod go-w "$install_dir/documents" From 386490336accca0c81a70038a253169bafe4e8e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 25 Mar 2024 23:56:10 +0100 Subject: [PATCH 14/27] Update, cleanup --- scripts/install | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/scripts/install b/scripts/install index 85be84d..95d7939 100644 --- a/scripts/install +++ b/scripts/install @@ -28,6 +28,8 @@ ynh_script_progression --message="Setting up source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --source_id="main" --dest_dir="$install_dir" +chmod 750 "$install_dir" + #================================================= # PREPARE AND INSTALL APP #================================================= @@ -52,8 +54,7 @@ ynh_use_logrotate --logfile="$install_dir/documents/dolibarr.log" #================================================= # SETUP APPLICATION WITH CURL #================================================= -# Installation with curl -ynh_script_progression --message="Configuring $app..." --weight=1 +ynh_script_progression --message="Configuring $app ..." --weight=1 # Create necessary files touch "$install_dir/htdocs/conf/conf.php" @@ -61,25 +62,20 @@ touch "$install_dir/htdocs/conf/conf.php" # Set right permissions for curl install chown -R "$app:" "$install_dir" -ynh_script_progression --message="Generate fileconf" --weight=1 ynh_local_curl "/install/fileconf.php" "testpost=ok" 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" 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" 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" 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) -ynh_script_progression --message="installation - step 5" --weight=4 ynh_local_curl "/install/step5.php" "testpost=ok" "action=set" "pass=$password" "pass_verif=$password" ynh_exec_fully_quiet sleep 5 @@ -99,6 +95,13 @@ if [ ! -f "$install_dir/documents/install.lock" ]; then chmod 440 "$install_dir/documents/install.lock" fi +chmod -R o-rwx "$install_dir" +chown -R "$app:www-data" "$install_dir" + +mkdir -p "$install_dir/documents" +chown -R "$app:" "$install_dir/documents" +chmod go-w "$install_dir/documents" + #================================================= # SETUP LDAP #================================================= @@ -116,19 +119,6 @@ else ynh_print_info --message="LDAP user update ended with error" fi -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1 - -chmod 750 "$install_dir" -chmod -R o-rwx "$install_dir" -chown -R "$app:www-data" "$install_dir" - -mkdir -p "$install_dir/documents" -chown -R "$app:" "$install_dir/documents" -chmod go-w "$install_dir/documents" - #================================================= # END OF SCRIPT #================================================= From 285a65d112fc86b050ddbf1448429009fc03e162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Tue, 26 Mar 2024 00:01:00 +0100 Subject: [PATCH 15/27] Try to fix permission --- scripts/install | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/install b/scripts/install index 95d7939..2f088af 100644 --- a/scripts/install +++ b/scripts/install @@ -16,7 +16,7 @@ ynh_app_setting_set --app=$app --key=version --value=$(ynh_app_upstream_version) #================================================= # CREATE A MYSQL DATABASE #================================================= -ynh_script_progression --message="Creating $app's MySQL database..." --weight=1 +ynh_script_progression --message="Configuring $app's MySQL database..." --weight=1 ynh_mysql_execute_as_root --sql="ALTER DATABASE $db_name charset=utf8" @@ -29,6 +29,8 @@ ynh_script_progression --message="Setting up source files..." --weight=1 ynh_setup_source --source_id="main" --dest_dir="$install_dir" chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chmod go-w "$install_dir/documents" #================================================= # PREPARE AND INSTALL APP @@ -95,12 +97,8 @@ if [ ! -f "$install_dir/documents/install.lock" ]; then chmod 440 "$install_dir/documents/install.lock" fi -chmod -R o-rwx "$install_dir" chown -R "$app:www-data" "$install_dir" - -mkdir -p "$install_dir/documents" chown -R "$app:" "$install_dir/documents" -chmod go-w "$install_dir/documents" #================================================= # SETUP LDAP From 793674258c5bc771755c4ff4fd8aa12f6faca251 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Tue, 26 Mar 2024 00:03:30 +0100 Subject: [PATCH 16/27] Try to fix permission --- scripts/install | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/install b/scripts/install index 2f088af..82a6659 100644 --- a/scripts/install +++ b/scripts/install @@ -28,6 +28,8 @@ ynh_script_progression --message="Setting up source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --source_id="main" --dest_dir="$install_dir" +mkdir -p "$install_dir/documents" + chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chmod go-w "$install_dir/documents" From cdf41c0517ccdc81b87cd6ca99104163ed8d8fe7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Tue, 26 Mar 2024 00:09:47 +0100 Subject: [PATCH 17/27] Remove disclaimer --- doc/DISCLAIMER.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 doc/DISCLAIMER.md diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md deleted file mode 100644 index e69de29..0000000 From 2ced4867ab1171dc3dadac623f946e1a3a108901 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Tue, 26 Mar 2024 19:23:02 +0100 Subject: [PATCH 18/27] very small cleanup --- check_process | 25 ------------------------- conf/nginx.conf | 2 +- scripts/restore | 2 +- tests.toml | 8 +++++--- 4 files changed, 7 insertions(+), 30 deletions(-) delete mode 100644 check_process diff --git a/check_process b/check_process deleted file mode 100644 index 98cba45..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=7e3914481ac4d6c40f3be3f35f155fac6f4387c6 - backup_restore=1 - multi_instance=1 - port_already_use=0 - change_url=1 -;;; Options -Email= -Notification=none -;;; Upgrade options - ; commit=CommitHash - name=16.0.5 - 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/scripts/restore b/scripts/restore index 6590cc8..b16dcb1 100755 --- a/scripts/restore +++ b/scripts/restore @@ -48,8 +48,8 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1 -ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name="php$phpversion-fpm" --action=reload +ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT diff --git a/tests.toml b/tests.toml index 35a337a..8544194 100644 --- a/tests.toml +++ b/tests.toml @@ -4,8 +4,10 @@ test_format = 1.0 [default] - # ------------ - # Tests to run - # ------------ + # ------------------------------- + # Commits to test upgrade from + # ------------------------------- + test_upgrade_from.8f6e1a302a943607aa640bbcb44405c8cb0a513d.name = "Upgrade from 18.0.3" + test_upgrade_from.c91139d3859032c3982b4bba3943aeae3ca57948.name = "15.0.3" test_upgrade_from.7e3914481ac4d6c40f3be3f35f155fac6f4387c6.name = "old version" From 771c5c62d769a3d6d013b88a1af729341965935d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Tue, 26 Mar 2024 20:38:36 +0100 Subject: [PATCH 19/27] Handle differently the upgrades --- manifest.toml | 45 +++++ scripts/install | 6 - scripts/upgrade | 276 ++++++------------------------ scripts/upgrade.d/upgrade.10.sh | 7 - scripts/upgrade.d/upgrade.11.sh | 7 - scripts/upgrade.d/upgrade.12.sh | 7 - scripts/upgrade.d/upgrade.13.sh | 7 - scripts/upgrade.d/upgrade.14.sh | 7 - scripts/upgrade.d/upgrade.15.sh | 7 - scripts/upgrade.d/upgrade.16.sh | 7 - scripts/upgrade.d/upgrade.17.sh | 7 - scripts/upgrade.d/upgrade.9.sh | 7 - scripts/upgrade.d/upgrade.last.sh | 7 - 13 files changed, 95 insertions(+), 302 deletions(-) delete mode 100644 scripts/upgrade.d/upgrade.10.sh delete mode 100644 scripts/upgrade.d/upgrade.11.sh delete mode 100644 scripts/upgrade.d/upgrade.12.sh delete mode 100644 scripts/upgrade.d/upgrade.13.sh delete mode 100644 scripts/upgrade.d/upgrade.14.sh delete mode 100644 scripts/upgrade.d/upgrade.15.sh delete mode 100644 scripts/upgrade.d/upgrade.16.sh delete mode 100644 scripts/upgrade.d/upgrade.17.sh delete mode 100644 scripts/upgrade.d/upgrade.9.sh delete mode 100644 scripts/upgrade.d/upgrade.last.sh diff --git a/manifest.toml b/manifest.toml index 8938c5e..fb1199c 100644 --- a/manifest.toml +++ b/manifest.toml @@ -51,6 +51,51 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen sha256 = "8639d466b26f0fba7d2b610a96ffcf36a657b1e00bdc2e5a1ac5287521dcb4ed" autoupdate.strategy = "latest_github_release" + [resources.sources.main_18_0_1] + url = "https://github.com/dolibarr/dolibarr/archive/18.0.1.tar.gz" + sha256 = "37bd3c8533b821c241dbb34b0e88349c1d5b43f7ffa6027f0b7970748d1f727a" + prefetch = false + + [resources.sources.main_17_0_1] + url = "https://github.com/dolibarr/dolibarr/archive/17.0.1.tar.gz" + sha256 = "2eddd545c07eae291ad46e48ab55d3adb988d99c29a8dfaa2e2fde0a890b0ddc" + prefetch = false + + [resources.sources.main_16_0_5] + url = "https://github.com/dolibarr/dolibarr/archive/16.0.5.tar.gz" + sha256 = "c8298342558e62b955a6f4c01fedb6a187b2e0c0b2c1681a97158ca979f9304f" + prefetch = false + + [resources.sources.main_15_0_3] + url = "https://github.com/dolibarr/dolibarr/archive/15.0.3.tar.gz" + sha256 = "b145a38f56c44b166721d64909fb12408c6d10d08fcf74d2c00418a60201cc9d" + prefetch = false + + [resources.sources.main_14_0_5] + url = "https://github.com/Dolibarr/dolibarr/archive/14.0.5.tar.gz" + sha256 = "31f4c934e484a9582d8867e4170f1f1acd8c41628b059370a6a449eb6e94ae75" + prefetch = false + + [resources.sources.main_13_0_5] + url = "https://github.com/Dolibarr/dolibarr/archive/13.0.5.tar.gz" + sha256 = "08ec08dc5093d614361f273237f5aaf8d70e63d764c2fa8d7f3f68a1485156d0" + prefetch = false + + [resources.sources.main_12_0_5] + url = "https://github.com/Dolibarr/dolibarr/archive/12.0.5.tar.gz" + sha256 = "b60b124ebcd294375f6200cc0683449e475b5dec687f8317b820fc8ec1413d21" + prefetch = false + + [resources.sources.main_11_0_5] + url = "https://github.com/Dolibarr/dolibarr/archive/11.0.5.tar.gz" + sha256 = "6f51435a4ffe576e836bf6449d900de9a56016f09591322cb2ba47a07c97679d" + prefetch = false + + [resources.sources.main_10_0_7] + url = "https://github.com/Dolibarr/dolibarr/archive/10.0.7.tar.gz" + sha256 = "6efc230f400a7b7152a0e4b9ba02a780f38b869b4aebd2bc28883268270ef871" + prefetch = false + [resources.system_user] [resources.install_dir] diff --git a/scripts/install b/scripts/install index 82a6659..4c2c303 100644 --- a/scripts/install +++ b/scripts/install @@ -7,12 +7,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# INITIALIZE AND STORE SETTINGS -#================================================= - -ynh_app_setting_set --app=$app --key=version --value=$(ynh_app_upstream_version) - #================================================= # CREATE A MYSQL DATABASE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index f4e71ea..72047c3 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -7,47 +7,21 @@ source _common.sh source /usr/share/yunohost/helpers -update_version=$(ynh_app_upstream_version) - #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= 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 - ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint +if [ -z "${fpm_footprint:-}" ]; then + fpm_footprint=medium + 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 -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" +if [ -z "${fpm_usage:-}" ]; then + fpm_usage=medium + ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage fi # Delete existing ini configuration file (backward compatibility) @@ -55,210 +29,56 @@ 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 +if [ -n "${version:-}" ]; then + ynh_app_setting_delete --app=$app --key="version" +fi -# Create a dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" +charset=$(mysql -ss -N -e "SELECT default_character_set_name FROM information_schema.SCHEMATA WHERE schema_name = '$db_name'") +if [ "$charset" != "utf8" ]; then + ynh_print_info --message="Changing Database charset to utf8" + ynh_mysql_execute_as_root --sql="ALTER DATABASE $db_name charset=utf8" + ynh_local_curl "/install/repair.php" "force_utf8_on_tables=confirmed" > "/var/log/$app/repair.html" + ynh_exec_fully_quiet sleep 5 +fi -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=1 - -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies - -#================================================= -# 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 -#REMOVEME? 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 -#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) - -#================================================= -# SPECIFIC UPGRADE #================================================= # MAKE SEQUENTIAL UPGRADES FROM EACH MAJOR # VERSION TO THE NEXT ONE #================================================= -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - ynh_script_progression --message="Upgrading source files..." --weight=60 +ynh_script_progression --message="Upgrading source files..." --weight=60 - # Load the last available version - source upgrade.d/upgrade.last.sh - last_version=$next_version +# Sort --version-sort cdécembrean handle underscore in versions numbers +mapfile -t main_versions < <( + ynh_read_manifest --key="resources.sources | keys[]" | grep "main_" | sort --version-sort +) +current_version="$YNH_APP_CURRENT_VERSION" +for version in "${main_versions[@]}"; do + new_version=$(echo "$version" | sed 's|main_||' | sed 's|_|.|g') + if dpkg --compare-versions "$current_version" ge "$new_version"; then + continue + fi + ynh_print_info --message="Upgrading app from $current_version to $new_version" + source_id="$version" + upgrade_dolibarr + current_version="$new_version" +done - last_major_version=${last_version%%.*} +# Final upgrade to the final version +new_version=$(ynh_app_upstream_version) +ynh_print_info --message="Upgrading app from $current_version to $new_version" +upgrade_dolibarr - # While the current version is not the last version, do an upgrade - while [ "$last_version" != "$current_version" ] - do - - # The major version is the first part of the version number - current_major_version=${current_version%%.*} - - if [ ! -f upgrade.d/upgrade.$current_major_version.sh ]; then - source upgrade.d/upgrade.last.sh - else - source upgrade.d/upgrade.$current_major_version.sh - fi - - # If the current version has the same major version than the next one, - # then it's the last upgrade to do - # We also cover the case where the last version is the first of the current major version series - # (e.g. 20.0.0 is the latest version) - if [[ ("$last_major_version" -eq "$current_major_version") || ( ("$last_major_version" -eq "$((current_major_version+1))") && ("$next_version" == "$last_version") ) ]]; then - current_major_version=last - fi - - # Load the value for this version - source upgrade.d/upgrade.$current_major_version.sh - - ynh_print_info --message="Upgrading app from $current_version to $next_version" - - # Create an app.src for this 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 -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.bz2 -SOURCE_IN_SUBDIR=true -EOF - - - chown -R $app: "$install_dir" - - # Remove the lock if it exists - lock=$install_dir/documents/install.lock - if [ -f $lock ] - then - ynh_secure_remove $lock - fi - - mkdir -p /var/log/$app/ - - # 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 - ynh_print_info --message="Changing Database charset to utf8" - - ynh_mysql_execute_as_root --database=$db_name --sql="ALTER DATABASE $db_name charset=utf8" - - ynh_local_curl "/install/repair.php" \ - "force_utf8_on_tables=confirmed" > /var/log/$app/repair.html - fi - - ynh_exec_fully_quiet sleep 5 - - # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$install_dir" - - 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 - - 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 - - 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 - current_major_version=${current_version%%.*} - - done - - 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 - - ynh_app_setting_set --app=$app --key=version --value=$update_version +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 -#================================================= -# STORE THE CONFIG FILE CHECKSUM -#================================================= - 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="$install_dir/htdocs/conf/conf.php" chmod 644 "$install_dir/htdocs/conf/conf.php" -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 - -# Use logrotate to manage app-specific logfile(s) -ynh_use_logrotate --non-append - -#================================================= -# GENERIC FINALIZATION #================================================= # SECURE FILES AND DIRECTORIES #================================================= @@ -275,16 +95,20 @@ chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" -mkdir -p "$data_dir" -chown -R $app: "$data_dir" -chmod go-w $data_dir +# mkdir -p "$data_dir" +# chown -R $app: "$data_dir" +# chmod go-w $data_dir #================================================= -# RELOAD NGINX +# REAPPLY SYSTEM CONFIGURATIONS #================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 +ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload +ynh_add_fpm_config + +ynh_add_nginx_config + +ynh_use_logrotate --non-append #================================================= # END OF SCRIPT diff --git a/scripts/upgrade.d/upgrade.10.sh b/scripts/upgrade.d/upgrade.10.sh deleted file mode 100644 index 4099105..0000000 --- a/scripts/upgrade.d/upgrade.10.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -# Target version of the Dolibarr update -next_version="11.0.5" - -# Dolibarr tarball checksum -dolibarr_source_sha256="6f51435a4ffe576e836bf6449d900de9a56016f09591322cb2ba47a07c97679d" \ No newline at end of file diff --git a/scripts/upgrade.d/upgrade.11.sh b/scripts/upgrade.d/upgrade.11.sh deleted file mode 100644 index b7d4982..0000000 --- a/scripts/upgrade.d/upgrade.11.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -# Target version of the Dolibarr update -next_version="12.0.5" - -# Dolibarr tarball checksum -dolibarr_source_sha256="b60b124ebcd294375f6200cc0683449e475b5dec687f8317b820fc8ec1413d21" \ No newline at end of file diff --git a/scripts/upgrade.d/upgrade.12.sh b/scripts/upgrade.d/upgrade.12.sh deleted file mode 100644 index 0dd40d7..0000000 --- a/scripts/upgrade.d/upgrade.12.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -# Target version of the Dolibarr update -next_version="13.0.5" - -# Dolibarr tarball checksum -dolibarr_source_sha256="08ec08dc5093d614361f273237f5aaf8d70e63d764c2fa8d7f3f68a1485156d0" \ No newline at end of file diff --git a/scripts/upgrade.d/upgrade.13.sh b/scripts/upgrade.d/upgrade.13.sh deleted file mode 100644 index 26366cd..0000000 --- a/scripts/upgrade.d/upgrade.13.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -# Target version of the Dolibarr update -next_version="14.0.5" - -# Dolibarr tarball checksum -dolibarr_source_sha256="31f4c934e484a9582d8867e4170f1f1acd8c41628b059370a6a449eb6e94ae75" \ No newline at end of file diff --git a/scripts/upgrade.d/upgrade.14.sh b/scripts/upgrade.d/upgrade.14.sh deleted file mode 100644 index e22383d..0000000 --- a/scripts/upgrade.d/upgrade.14.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -# Target version of the Dolibarr update -next_version="15.0.3" - -# Dolibarr tarball checksum -dolibarr_source_sha256="b145a38f56c44b166721d64909fb12408c6d10d08fcf74d2c00418a60201cc9d" \ No newline at end of file diff --git a/scripts/upgrade.d/upgrade.15.sh b/scripts/upgrade.d/upgrade.15.sh deleted file mode 100644 index c47eca1..0000000 --- a/scripts/upgrade.d/upgrade.15.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -# Target version of the Dolibarr update -next_version="16.0.5" - -# Dolibarr tarball checksum -dolibarr_source_sha256="C8298342558E62B955A6F4C01FEDB6A187B2E0C0B2C1681A97158CA979F9304F" diff --git a/scripts/upgrade.d/upgrade.16.sh b/scripts/upgrade.d/upgrade.16.sh deleted file mode 100644 index e5f638a..0000000 --- a/scripts/upgrade.d/upgrade.16.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -# Target version of the Dolibarr update -next_version="17.0.1" - -# Dolibarr tarball checksum -dolibarr_source_sha256="2EDDD545C07EAE291AD46E48AB55D3ADB988D99C29A8DFAA2E2FDE0A890B0DDC" \ No newline at end of file diff --git a/scripts/upgrade.d/upgrade.17.sh b/scripts/upgrade.d/upgrade.17.sh deleted file mode 100644 index 8880793..0000000 --- a/scripts/upgrade.d/upgrade.17.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -# Target version of the Dolibarr update -next_version="18.0.1" - -# Dolibarr tarball checksum -dolibarr_source_sha256="37bd3c8533b821c241dbb34b0e88349c1d5b43f7ffa6027f0b7970748d1f727a" diff --git a/scripts/upgrade.d/upgrade.9.sh b/scripts/upgrade.d/upgrade.9.sh deleted file mode 100644 index 0ff52ac..0000000 --- a/scripts/upgrade.d/upgrade.9.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -# Target version of the Dolibarr update -next_version="10.0.7" - -# Dolibarr tarball checksum -dolibarr_source_sha256="6efc230f400a7b7152a0e4b9ba02a780f38b869b4aebd2bc28883268270ef871" \ No newline at end of file diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh deleted file mode 100644 index e73e59d..0000000 --- a/scripts/upgrade.d/upgrade.last.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -# Target version of the Dolibarr update -next_version="18.0.3" - -# Dolibarr tarball checksum -dolibarr_source_sha256="8639d466b26f0fba7d2b610a96ffcf36a657b1e00bdc2e5a1ac5287521dcb4ed" From 03bb01a3d903b3d22ea17b810398d7e71015d319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Tue, 26 Mar 2024 21:13:47 +0100 Subject: [PATCH 20/27] Add missing mariadb-server dep --- manifest.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/manifest.toml b/manifest.toml index fb1199c..845467e 100644 --- a/manifest.toml +++ b/manifest.toml @@ -119,6 +119,7 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen "php8.1-xml", "php8.1-fileinfo", "php8.1-imap", + "mariadb-server", ] [resources.database] From 172984666ac1841a803df6dcbbd247b790761587 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Tue, 26 Mar 2024 21:38:52 +0100 Subject: [PATCH 21/27] Oops, missing function --- scripts/_common.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/scripts/_common.sh b/scripts/_common.sh index 944a65e..feab25c 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -8,6 +8,30 @@ # PERSONAL HELPERS #================================================= +upgrade_dolibarr() { + ynh_setup_source --source_id="$source_id" --dest_dir="$install_dir" --full_replace=1 \ + --keep="htdocs/conf/conf.php htdocs/install/install.forced.php" + chmod -R o-rwx "$install_dir" + chown -R "$app:www-data" "$install_dir" + + # Remove the lock if it exists + lock=$install_dir/documents/install.lock + if [ -f "$lock" ]; then + ynh_secure_remove --file="$lock" + fi + + pushd "$install_dir/htdocs/install/" + "php$phpversion" upgrade.php "$current_version" "$new_version" + ynh_exec_fully_quiet sleep 5 + + "php$phpversion" upgrade2.php "$current_version" "$new_version" + ynh_exec_fully_quiet sleep 5 + + "php$phpversion" step5.php "$current_version" "$new_version" + ynh_exec_fully_quiet sleep 5 + popd +} + #================================================= # EXPERIMENTAL HELPERS #================================================= From b098296ebeb1bb79aa34909bcb065c8d5cafefc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Tue, 26 Mar 2024 21:48:21 +0100 Subject: [PATCH 22/27] fix upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 72047c3..5db8698 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -49,7 +49,7 @@ ynh_script_progression --message="Upgrading source files..." --weight=60 # Sort --version-sort cdécembrean handle underscore in versions numbers mapfile -t main_versions < <( - ynh_read_manifest --key="resources.sources | keys[]" | grep "main_" | sort --version-sort + ynh_read_manifest --manifest_key="resources.sources | keys[]" | grep "main_" | sort --version-sort ) current_version="$YNH_APP_CURRENT_VERSION" for version in "${main_versions[@]}"; do From fb89b1b1eb0dd7710fceb3e8507dec0f9121851c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Tue, 26 Mar 2024 21:49:23 +0100 Subject: [PATCH 23/27] fix upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 5db8698..a0fe9fa 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -37,7 +37,7 @@ charset=$(mysql -ss -N -e "SELECT default_character_set_name FROM information_sc if [ "$charset" != "utf8" ]; then ynh_print_info --message="Changing Database charset to utf8" ynh_mysql_execute_as_root --sql="ALTER DATABASE $db_name charset=utf8" - ynh_local_curl "/install/repair.php" "force_utf8_on_tables=confirmed" > "/var/log/$app/repair.html" + ynh_local_curl "/install/repair.php" "force_utf8_on_tables=confirmed" ynh_exec_fully_quiet sleep 5 fi From f16d38ba1308825dd077e9f33c8d599649a7b913 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Tue, 26 Mar 2024 21:52:37 +0100 Subject: [PATCH 24/27] fix upgrade --- scripts/upgrade | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/upgrade b/scripts/upgrade index a0fe9fa..0e66a9d 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -65,6 +65,7 @@ done # Final upgrade to the final version new_version=$(ynh_app_upstream_version) +source_id="main" ynh_print_info --message="Upgrading app from $current_version to $new_version" upgrade_dolibarr From 785a5f886092acfaf59c443480a092bc17a78442 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Tue, 26 Mar 2024 22:01:44 +0100 Subject: [PATCH 25/27] fix upgrade --- scripts/upgrade | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 0e66a9d..f182b7a 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -80,21 +80,15 @@ ynh_backup_if_checksum_is_different --file="$install_dir/htdocs/conf/conf.php" ynh_store_file_checksum --file="$install_dir/htdocs/conf/conf.php" chmod 644 "$install_dir/htdocs/conf/conf.php" -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= -#REMOVEME? 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" +if [ ! -f "$install_dir/documents/install.lock" ]; then + echo 'This is a lock file to prevent use of install pages (set with permission 440)' > "$install_dir/documents/install.lock" + chown "$app:$app" "$install_dir/documents/install.lock" + chmod 440 "$install_dir/documents/install.lock" fi chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +chown -R "$app:www-data" "$install_dir" # mkdir -p "$data_dir" # chown -R $app: "$data_dir" From f0207da7342f05f4cc21658dc886ad59a706edd1 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Tue, 21 May 2024 17:22:12 +0000 Subject: [PATCH 26/27] Auto-update READMEs --- ALL_README.md | 4 +++- README.md | 4 ++-- README_es.md | 50 +++++++++++++++++++++++++++++++++++++++++++++++ README_eu.md | 50 +++++++++++++++++++++++++++++++++++++++++++++++ README_fr.md | 2 +- README_gl.md | 2 +- README_zh_Hans.md | 50 +++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 157 insertions(+), 5 deletions(-) create mode 100644 README_es.md create mode 100644 README_eu.md create mode 100644 README_zh_Hans.md diff --git a/ALL_README.md b/ALL_README.md index 3d6c579..152f2e7 100644 --- a/ALL_README.md +++ b/ALL_README.md @@ -1,6 +1,8 @@ # All available README files by language - [Read the README in English](README.md) +- [Lea el README en español](README_es.md) +- [Irakurri README euskaraz](README_eu.md) - [Lire le README en français](README_fr.md) - [Le o README en galego](README_gl.md) -- [Leggi il “README” in italiano](README_it.md) +- [阅读中文(简体)的 README](README_zh_Hans.md) diff --git a/README.md b/README.md index 3d4aa7f..a67199e 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ It shall NOT be edited by hand. [![Install Dolibarr with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=dolibarr) -*[Read this README is other languages.](./ALL_README.md)* +*[Read this README in other languages.](./ALL_README.md)* > *This package allows you to install Dolibarr quickly and simply on a YunoHost server.* > *If you don't have YunoHost, please consult [the guide](https://yunohost.org/install) to learn how to install it.* @@ -18,7 +18,7 @@ It shall NOT be edited by hand. Dolibarr ERP & CRM is a modern software for managing your professional or associative activity (contacts, invoices, orders, stocks, agenda, etc.). -**Shipped version:** 18.0.3~ynh1 +**Shipped version:** 18.0.3~ynh2 **Demo:** diff --git a/README_es.md b/README_es.md new file mode 100644 index 0000000..791f082 --- /dev/null +++ b/README_es.md @@ -0,0 +1,50 @@ + + +# Dolibarr para Yunohost + +[![Nivel de integración](https://dash.yunohost.org/integration/dolibarr.svg)](https://dash.yunohost.org/appci/app/dolibarr) ![Estado funcional](https://ci-apps.yunohost.org/ci/badges/dolibarr.status.svg) ![Estado En Mantención](https://ci-apps.yunohost.org/ci/badges/dolibarr.maintain.svg) + +[![Instalar Dolibarr con Yunhost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=dolibarr) + +*[Leer este README en otros idiomas.](./ALL_README.md)* + +> *Este paquete le permite instalarDolibarr rapidamente y simplement en un servidor YunoHost.* +> *Si no tiene YunoHost, visita [the guide](https://yunohost.org/install) para aprender como instalarla.* + +## Descripción general + +Dolibarr ERP & CRM is a modern software for managing your professional or associative activity (contacts, invoices, orders, stocks, agenda, etc.). + +**Versión actual:** 18.0.3~ynh2 + +**Demo:** + +## Capturas + +![Captura de Dolibarr](./doc/screenshots/screenshot.jpg) + +## Documentaciones y recursos + +- Sitio web oficial: +- Documentación usuario oficial: +- Documentación administrador oficial: +- Repositorio del código fuente oficial de la aplicación : +- Catálogo YunoHost: +- Reportar un error: + +## Información para desarrolladores + +Por favor enviar sus correcciones a la [`branch testing`](https://github.com/YunoHost-Apps/dolibarr_ynh/tree/testing + +Para probar la rama `testing`, sigue asÍ: + +```bash +sudo yunohost app install https://github.com/YunoHost-Apps/dolibarr_ynh/tree/testing --debug +o +sudo yunohost app upgrade dolibarr -u https://github.com/YunoHost-Apps/dolibarr_ynh/tree/testing --debug +``` + +**Mas informaciones sobre el empaquetado de aplicaciones:** diff --git a/README_eu.md b/README_eu.md new file mode 100644 index 0000000..560f743 --- /dev/null +++ b/README_eu.md @@ -0,0 +1,50 @@ + + +# Dolibarr YunoHost-erako + +[![Integrazio maila](https://dash.yunohost.org/integration/dolibarr.svg)](https://dash.yunohost.org/appci/app/dolibarr) ![Funtzionamendu egoera](https://ci-apps.yunohost.org/ci/badges/dolibarr.status.svg) ![Mantentze egoera](https://ci-apps.yunohost.org/ci/badges/dolibarr.maintain.svg) + +[![Instalatu Dolibarr YunoHost-ekin](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=dolibarr) + +*[Irakurri README hau beste hizkuntzatan.](./ALL_README.md)* + +> *Pakete honek Dolibarr YunoHost zerbitzari batean azkar eta zailtasunik gabe instalatzea ahalbidetzen dizu.* +> *YunoHost ez baduzu, kontsultatu [gida](https://yunohost.org/install) nola instalatu ikasteko.* + +## Aurreikuspena + +Dolibarr ERP & CRM is a modern software for managing your professional or associative activity (contacts, invoices, orders, stocks, agenda, etc.). + +**Paketatutako bertsioa:** 18.0.3~ynh2 + +**Demoa:** + +## Pantaila-argazkiak + +![Dolibarr(r)en pantaila-argazkia](./doc/screenshots/screenshot.jpg) + +## Dokumentazioa eta baliabideak + +- Aplikazioaren webgune ofiziala: +- Erabiltzaileen dokumentazio ofiziala: +- Administratzaileen dokumentazio ofiziala: +- Jatorrizko aplikazioaren kode-gordailua: +- YunoHost Denda: +- Eman errore baten berri: + +## Garatzaileentzako informazioa + +Bidali `pull request`a [`testing` abarrera](https://github.com/YunoHost-Apps/dolibarr_ynh/tree/testing). + +`testing` abarra probatzeko, ondorengoa egin: + +```bash +sudo yunohost app install https://github.com/YunoHost-Apps/dolibarr_ynh/tree/testing --debug +edo +sudo yunohost app upgrade dolibarr -u https://github.com/YunoHost-Apps/dolibarr_ynh/tree/testing --debug +``` + +**Informazio gehiago aplikazioaren paketatzeari buruz:** diff --git a/README_fr.md b/README_fr.md index 015f8df..abe9da1 100644 --- a/README_fr.md +++ b/README_fr.md @@ -18,7 +18,7 @@ Il NE doit PAS être modifié à la main. 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.3~ynh1 +**Version incluse :** 18.0.3~ynh2 **Démo :** diff --git a/README_gl.md b/README_gl.md index 51b5102..69b1d96 100644 --- a/README_gl.md +++ b/README_gl.md @@ -18,7 +18,7 @@ NON debe editarse manualmente. Dolibarr ERP & CRM is a modern software for managing your professional or associative activity (contacts, invoices, orders, stocks, agenda, etc.). -**Versión proporcionada:** 18.0.3~ynh1 +**Versión proporcionada:** 18.0.3~ynh2 **Demo:** diff --git a/README_zh_Hans.md b/README_zh_Hans.md new file mode 100644 index 0000000..4997c38 --- /dev/null +++ b/README_zh_Hans.md @@ -0,0 +1,50 @@ + + +# YunoHost 上的 Dolibarr + +[![集成程度](https://dash.yunohost.org/integration/dolibarr.svg)](https://dash.yunohost.org/appci/app/dolibarr) ![工作状态](https://ci-apps.yunohost.org/ci/badges/dolibarr.status.svg) ![维护状态](https://ci-apps.yunohost.org/ci/badges/dolibarr.maintain.svg) + +[![使用 YunoHost 安装 Dolibarr](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=dolibarr) + +*[阅读此 README 的其它语言版本。](./ALL_README.md)* + +> *通过此软件包,您可以在 YunoHost 服务器上快速、简单地安装 Dolibarr。* +> *如果您还没有 YunoHost,请参阅[指南](https://yunohost.org/install)了解如何安装它。* + +## 概况 + +Dolibarr ERP & CRM is a modern software for managing your professional or associative activity (contacts, invoices, orders, stocks, agenda, etc.). + +**分发版本:** 18.0.3~ynh2 + +**演示:** + +## 截图 + +![Dolibarr 的截图](./doc/screenshots/screenshot.jpg) + +## 文档与资源 + +- 官方应用网站: +- 官方用户文档: +- 官方管理文档: +- 上游应用代码库: +- YunoHost 商店: +- 报告 bug: + +## 开发者信息 + +请向 [`testing` 分支](https://github.com/YunoHost-Apps/dolibarr_ynh/tree/testing) 发送拉取请求。 + +如要尝试 `testing` 分支,请这样操作: + +```bash +sudo yunohost app install https://github.com/YunoHost-Apps/dolibarr_ynh/tree/testing --debug +或 +sudo yunohost app upgrade dolibarr -u https://github.com/YunoHost-Apps/dolibarr_ynh/tree/testing --debug +``` + +**有关应用打包的更多信息:** From 4f77a192c9b698640b0d9e745e786f573745e8a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Tue, 21 May 2024 21:32:22 +0200 Subject: [PATCH 27/27] remove fixmes in manifest --- manifest.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest.toml b/manifest.toml index 845467e..01751d6 100644 --- a/manifest.toml +++ b/manifest.toml @@ -26,9 +26,9 @@ architectures = "all" multi_instance = true ldap = true sso = true -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, ... +disk = "200M" +ram.build = "150M" +ram.runtime = "150M" [install] [install.domain]