From 498fc07955b25e5cc61fbef3bd4682eb090f3b85 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 22 Sep 2021 13:41:39 +0200 Subject: [PATCH 1/5] Typo... --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index aa5ac43..e31a779 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -101,7 +101,7 @@ then ynh_script_progression --message="Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src - if git -C "$final_path" rev-parse --is-inside-work-tree` >/dev/null 2>/dev/null + if git -C "$final_path" rev-parse --is-inside-work-tree >/dev/null 2>/dev/null then pushd "$final_path" git fetch From ca3c7719d7543a74c5364f3aca452131ce66b2bf Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 13 Nov 2021 17:14:41 +0100 Subject: [PATCH 2/5] Fix linter warnings --- manifest.json | 6 ++---- scripts/restore | 2 -- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/manifest.json b/manifest.json index 5bfd32b..0146e0d 100644 --- a/manifest.json +++ b/manifest.json @@ -26,8 +26,7 @@ "install" : [ { "name": "domain", - "type": "domain", - "example": "example.com" + "type": "domain" }, { "name": "path", @@ -37,8 +36,7 @@ }, { "name": "admin", - "type": "user", - "example": "johndoe" + "type": "user" }, { "name": "is_public", diff --git a/scripts/restore b/scripts/restore index 215ec0f..fb974b6 100644 --- a/scripts/restore +++ b/scripts/restore @@ -39,8 +39,6 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= ynh_script_progression --message="Validating restoration parameters..." -ynh_webpath_available --domain=$domain --path_url=$path_url \ - || ynh_die --message="Path not available: ${domain}${path_url}" test ! -d $final_path \ || ynh_die --message="There is already a directory: $final_path " From 8bf2ba8835b7e4f04979d8ead1d5057fea1469fb Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 13 Nov 2021 17:17:05 +0100 Subject: [PATCH 3/5] Remove redis-server Redis is already installed in YunoHost --- scripts/_common.sh | 1 - scripts/install | 2 -- scripts/remove | 8 -------- scripts/restore | 3 --- scripts/upgrade | 3 --- 5 files changed, 17 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 840a8ba..959bdbc 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,6 @@ #================================================= # dependencies used by the app -pkg_dependencies="redis-server" YNH_COMPOSER_VERSION="2.0.11" YNH_PHP_VERSION="7.4" NODEJS_VERSION=14 diff --git a/scripts/install b/scripts/install index e750c35..33e6ee3 100644 --- a/scripts/install +++ b/scripts/install @@ -69,8 +69,6 @@ ynh_app_setting_set --app=$app --key=version --value=$version #================================================= ynh_script_progression --message="Installing dependencies..." -ynh_install_app_dependencies $pkg_dependencies - ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" diff --git a/scripts/remove b/scripts/remove index 5fba8f1..109f130 100755 --- a/scripts/remove +++ b/scripts/remove @@ -31,14 +31,6 @@ ynh_script_progression --message="Removing the MySQL database..." # Remove a database if it exists, along with the associated user ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." - -# Remove metapackage and its dependencies -ynh_remove_app_dependencies - #================================================= # REMOVE APP MAIN DIR #================================================= diff --git a/scripts/restore b/scripts/restore index fb974b6..225d474 100644 --- a/scripts/restore +++ b/scripts/restore @@ -87,9 +87,6 @@ ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencie #================================================= ynh_script_progression --message="Reinstalling dependencies..." -# Define and install dependencies -ynh_install_app_dependencies $pkg_dependencies - ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" diff --git a/scripts/upgrade b/scripts/upgrade index e31a779..b8dda2c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -34,7 +34,6 @@ version=$(curl -s https://api.github.com/repos/monicahq/monica/releases/latest | #================================================= # CHECK VERSION #================================================= -ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) @@ -131,8 +130,6 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Upgrading dependencies..." -ynh_install_app_dependencies $pkg_dependencies - ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" From c58d88313cc095609a39334ea2eeb9bda226211d Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sat, 20 Nov 2021 14:29:42 +0100 Subject: [PATCH 4/5] Fix upgrade and add backward compatibility --- scripts/install | 4 ++-- scripts/upgrade | 26 +++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 33e6ee3..f339863 100644 --- a/scripts/install +++ b/scripts/install @@ -236,9 +236,9 @@ then ynh_permission_update --permission="main" --add="visitors" fi -# Giver API permission to visitors +# Give API permission to visitors ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true" -# Giver DAV permission to visitors +# Give DAV permission to visitors ynh_permission_create --permission="dav" --url="/dav" --allowed="visitors" --show_tile="false" --protected="true" #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index b8dda2c..ad3b85a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -70,11 +70,34 @@ if [ -z "$final_path" ]; then ynh_app_setting_set --app=$app --key=final_path --value=$final_path fi +# If dav_support doesn't exist, create it +if [ -z "$dav_support" ]; then + dav_support=0 + ynh_app_setting_set --app=$app --key=dav_support --value=$dav_support +fi + +# If signup doesn't exist, create it +if [ -z "$signup" ]; then + signup=0 + ynh_app_setting_set --app=$app --key=signup --value=$signup +fi + +# If signup doesn't exist, create it +if [ -z "$two_factor" ]; then + two_factor=0 + ynh_app_setting_set --app=$app --key=two_factor --value=$two_factor +fi + # Create a permission if needed if ! ynh_permission_exists --permission="api"; then ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true" fi +# Create a permission if needed +if ! ynh_permission_exists --permission="dav"; then + ynh_permission_create --permission="dav" --url="/dav" --allowed="visitors" --show_tile="false" --protected="true" +fi + #================================================= # CREATE DEDICATED USER #================================================= @@ -157,6 +180,7 @@ ynh_exec_warn_less ynh_composer_exec --phpversion="$phpversion" --workdir="$fina ynh_script_progression --message="Updating a configuration file..." config="$final_path/.env" +db_user=$db_name # Enable or disable DAV support for users if [ $dav_support -eq 0 ] @@ -195,7 +219,7 @@ ynh_script_progression --message="Deploying..." update-alternatives --set php /usr/bin/php$phpversion -pushd "$final_path" +pushd "$final_path" ynh_use_nodejs yarn install yarn run production From c3462d1c74bebd4b442d30f2ec4507b9993ae92b Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sat, 20 Nov 2021 14:32:39 +0100 Subject: [PATCH 5/5] Silence upgrade warnings --- scripts/install | 2 +- scripts/upgrade | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index f339863..db6b875 100644 --- a/scripts/install +++ b/scripts/install @@ -183,7 +183,7 @@ pushd "$final_path" ynh_use_nodejs yarn install yarn run production - + php$phpversion artisan setup:production --email=$email --password=$password -n --force php$phpversion artisan passport:client --password -n > key.txt mobile_id=$( cd $final_path && tail -2 key.txt | head -1 | cut -c 12- ) diff --git a/scripts/upgrade b/scripts/upgrade index ad3b85a..85b3551 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -221,9 +221,9 @@ update-alternatives --set php /usr/bin/php$phpversion pushd "$final_path" ynh_use_nodejs - yarn install - yarn run production - php$phpversion artisan monica:update --force + ynh_exec_warn_less yarn install + ynh_exec_warn_less yarn run production + ynh_exec_warn_less php$phpversion artisan monica:update --force popd if [ -f $final_path/storage/oauth-private.key ]; then