From b5b3d2aa71a5ed77d43a33163de29f7d7f6ef50d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 10 Apr 2021 10:18:10 +0200 Subject: [PATCH] Upgrade to 21.04 (#18) * Upgrade to version 21.02 --- README.md | 2 +- README_fr.md | 2 +- check_process | 2 -- conf/app.src | 4 ++-- manifest.json | 16 ++-------------- scripts/change_url | 13 +++++-------- scripts/install | 20 ++++++++++---------- scripts/restore | 18 ++++++++++-------- scripts/upgrade | 18 ++++++++++-------- 9 files changed, 41 insertions(+), 54 deletions(-) diff --git a/README.md b/README.md index cc6278c..935ecc6 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ BookStack is a simple, self-hosted, easy-to-use platform for organising and stor BookStack is built using PHP, on top of the Laravel framework and it uses MySQL to store data. -**Shipped version:** 0.31.7 +**Shipped version:** 21.04 ## Screenshots diff --git a/README_fr.md b/README_fr.md index ff037aa..d0d6a9d 100644 --- a/README_fr.md +++ b/README_fr.md @@ -11,7 +11,7 @@ Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install ## Overview BookStack est une plate-forme simple, auto-hébergée et facile à utiliser pour organiser et stocker des informations. -**Version incluse :** 0.31.7 +**Version incluse :** 21.04 ## Screenshots diff --git a/check_process b/check_process index 7f19c1c..2e60d93 100644 --- a/check_process +++ b/check_process @@ -18,7 +18,6 @@ upgrade=1 from_commit=a1db7396ceab19640e68d6a8cc05befd1f9c07ad backup_restore=1 multi_instance=1 - port_already_use=0 change_url=0 ;;; Options Email= @@ -27,4 +26,3 @@ Notification=none ; commit=a1db7396ceab19640e68d6a8cc05befd1f9c07ad name=Testing (#11) manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666& - diff --git a/conf/app.src b/conf/app.src index a17f094..1da05c7 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/BookStackApp/BookStack/archive/v0.31.7.tar.gz -SOURCE_SUM=6c832378ec245a8af282c11643c8f1fe9b1786eb8cabcae2f2ef30aa08844db0 +SOURCE_URL=https://github.com/BookStackApp/BookStack/archive/refs/tags/v21.04.tar.gz +SOURCE_SUM=b0a9b8229a1983e0e8349f7ab63bfa4ea86c2a28de2f6c46463e5547e1077646 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index e06a29d..467a2c3 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Platform to create documentation/wiki content", "fr": "Plateforme pour créer du contenu de documentation/wiki " }, - "version": "0.31.7~ynh1", + "version": "21.04~ynh1", "url": "https://www.bookstackapp.com/", "license": "MIT", "maintainer": { @@ -14,7 +14,7 @@ "email": "liberodark@gmail.com" }, "requirements": { - "yunohost": ">= 4.1.0" + "yunohost": ">= 4.1.7" }, "multi_instance": true, "services": [ @@ -26,19 +26,11 @@ "install": [{ "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain name for BookStack", - "fr": "Choisissez un nom de domaine pour BookStack" - }, "example": "example.com" }, { "name": "path", "type": "path", - "ask": { - "en": "Choose a path for BookStack", - "fr": "Choisissez un chemin pour BookStack" - }, "example": "/bookstack", "default": "/bookstack" }, @@ -55,10 +47,6 @@ { "name": "is_public", "type": "boolean", - "ask": { - "en": "Is it a public site?", - "fr": "Est-ce un site public ?" - }, "help": { "en": "If enabled, BookStack will be accessible by people who do not have an account. This can be changed later via the webadmin.", "fr": "Si cette case est cochée, BookStack sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." diff --git a/scripts/change_url b/scripts/change_url index 037c9cf..42ec4d0 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -100,16 +100,13 @@ fi # MODIFY A CONFIG FILE #================================================= -cp -a ../conf/.env.example $final_path/.env +path_url="$new_path" +domain="$new_domain" +mail_pwd=$(ynh_string_random --length=12) -ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/.env" -ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/.env" -ynh_replace_string --match_string="__DOMAIN__" --replace_string="$new_domain" --target_file="$final_path/.env" -ynh_replace_string --match_string="__PATH__" --replace_string="$new_path" --target_file="$final_path/.env" -ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$final_path/.env" -ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$final_path/.env" +ynh_add_config --template=../conf/.env.example --destination=$final_path/.env -ynh_store_file_checksum $final_path/.env +chmod 600 $final_path/.env #================================================= # RELOAD NGINX diff --git a/scripts/install b/scripts/install index ef0a425..a61b96e 100644 --- a/scripts/install +++ b/scripts/install @@ -57,6 +57,14 @@ 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 +#================================================= +# 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 + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -74,14 +82,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2 # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." --weight=2 - -# Create a system user -ynh_system_user_create --username=$app - #================================================= # PHP-FPM CONFIGURATION #================================================= @@ -106,8 +106,6 @@ ynh_install_composer --phpversion=$phpversion --workdir=$final_path --install_ar mail_pwd=$(ynh_string_random --length=12) ynh_add_config --template=../conf/.env.example --destination=$final_path/.env -ynh_store_file_checksum $final_path/.env - #================================================= # FINAL BOOKSTACK INSTALL #================================================= @@ -128,6 +126,8 @@ popd chown -R $app: $final_path chmod -R 755 $final_path +chmod 600 $final_path/.env + #================================================= # SETUP SSOWAT #================================================= diff --git a/scripts/restore b/scripts/restore index 7609fc9..9bfca26 100644 --- a/scripts/restore +++ b/scripts/restore @@ -47,20 +47,20 @@ test ! -d $final_path \ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# RESTORE THE APP MAIN DIR -#================================================= -ynh_script_progression --message="Restoring the app main directory..." --weight=1 - -ynh_restore_file --origin_path="$final_path" - #================================================= # RECREATE THE DEDICATED USER #================================================= ynh_script_progression --message="Recreating the dedicated system user..." --weight=3 # Create the dedicated user (if not existing) -ynh_system_user_create --username=$app +ynh_system_user_create --username=$app --home_dir=$final_path + +#================================================= +# RESTORE THE APP MAIN DIR +#================================================= +ynh_script_progression --message="Restoring the app main directory..." --weight=1 + +ynh_restore_file --origin_path="$final_path" #================================================= # RESTORE USER RIGHTS @@ -70,6 +70,8 @@ ynh_system_user_create --username=$app chown -R $app: $final_path chmod -R 755 $final_path +chmod 600 $final_path/.env + #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 87060d5..2c12ee9 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -45,6 +45,14 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Making sure dedicated system user exists..." --weight=2 + +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir=$final_path + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -80,14 +88,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --weight=2 - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app - #================================================= # PHP-FPM CONFIGURATION #================================================= @@ -125,6 +125,8 @@ popd chown -R $app: $final_path chmod -R 755 $final_path +chmod 600 $final_path/.env + #================================================= # RELOAD NGINX #=================================================