From 038300d78d262119dc8470da1bc686e03e74fc5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 17 Nov 2023 16:30:43 +0100 Subject: [PATCH] cleaning --- manifest.toml | 23 +---------------------- scripts/change_url | 2 +- scripts/install | 7 ------- scripts/remove | 5 +---- scripts/restore | 5 ----- scripts/upgrade | 33 +-------------------------------- 6 files changed, 4 insertions(+), 71 deletions(-) diff --git a/manifest.toml b/manifest.toml index 50dbe95..be27f65 100644 --- a/manifest.toml +++ b/manifest.toml @@ -7,12 +7,11 @@ name = "Grist" description.en = "Modern relational spreadsheet" description.fr = "Feuille de calcul relationnelle moderne" -version = "1.1.5~ynh2" +version = "1.1.5~ynh1" maintainers = ["fflorent"] [upstream] -# NB: Only the "license" key is mandatory. Remove entries for which there's no relevant data license = "AGPL-3.0-only" website = "https://getgrist.com" demo = "https://docs.getgrist.com" @@ -36,12 +35,9 @@ ram.runtime = "150M" [install] [install.domain] - # this is a generic question - ask strings are automatically handled by YunoHost's core type = "domain" [install.init_main_permission] - # this is a generic question - ask strings are automatically handled by YunoHost's core - # This won't be saved as setting and will instead be used to initialize the SSOwat permission type = "group" default = "visitors" @@ -53,51 +49,34 @@ ram.runtime = "150M" default = "en" [install.admin] - # this is a generic question - ask strings are automatically handled by YunoHost's core type = "user" [resources] - # See the packaging documentation for the full set - # of explanation regarding the behavior and properties for each of those [resources.sources] [resources.sources.main] - # This will pre-fetch the asset which can then be deployed during the install/upgrade scripts with : - # ynh_setup_source --dest_dir="$install_dir" - # You can also define other assets than "main" and add --source_id="foobar" in the previous command url = "https://github.com/gristlabs/grist-core/archive/refs/tags/v1.1.5.tar.gz" sha256 = "3119ba9be40d2adfca547cc80ecf9114e4b218449d84c7231a44f5fc0b5f0f4b" autoupdate.strategy = "latest_github_tag" [resources.system_user] - # This will provision/deprovision a unix system user [resources.install_dir] - # This will create/remove the install dir as /var/www/$app - # and store the corresponding setting $install_dir [resources.data_dir] - # This will create/remove the data dir as /home/yunohost.app/$app - # and store the corresponding setting $data_dir [resources.permissions] - # This will configure SSOwat permission for $domain/$path/ - # The initial allowed group of user is configured via the init_main_permission question (public=visitors, private=all_users) main.url = "/" - login.url = "/auth/login" login.show_tile = false login.allowed = "all_users" [resources.ports] - # This will pick a random port for reverse-proxying and store it as the $port setting main.default = 8484 [resources.apt] - # This will automatically install/uninstall the following apt packages - # and implicitly define the $phpversion setting as 8.0 (if phpX.Y-foobar dependencies are listed) packages = "python3.9, python3.9-venv" extras.yarn.repo = "deb https://dl.yarnpkg.com/debian/ stable main" diff --git a/scripts/change_url b/scripts/change_url index 41693fd..16e8c95 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -28,8 +28,8 @@ ynh_change_url_nginx_config #================================================= # SPECIFIC MODIFICATIONS #================================================= - ynh_script_progression --message="Updating env configuration file..." --weight=1 + domain="$new_domain" path="$new_path" ynh_add_config --template="default.env" --destination="$install_dir/default.env" diff --git a/scripts/install b/scripts/install index a2ddd6d..aa3febd 100755 --- a/scripts/install +++ b/scripts/install @@ -28,9 +28,6 @@ ynh_script_progression --message="Setting up source files..." --weight=1 # Download, check integrity, uncompress and patch the source from manifest.toml ynh_setup_source --dest_dir="$install_dir" -# $install_dir will automatically be initialized with some decent -# permission by default ... however, you may need to recursively reapply -# ownership to all files such as after the ynh_setup_source step chown -R $app:www-data "$install_dir" pushd "$install_dir" @@ -45,7 +42,6 @@ pushd "$install_dir/sandbox/pyodide" ynh_exec_warn_less ynh_exec_as $app make setup popd - #================================================= # SYSTEM CONFIGURATION #================================================= @@ -78,9 +74,6 @@ ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_add_config --template="default.env" --destination="$install_dir/default.env" -# FIXME: this should be handled by the core in the future -# You may need to use chmod 600 instead of 400, -# for example if the app is expected to be able to modify its own config chmod 400 "$install_dir/default.env" chown $app:$app "$install_dir/default.env" diff --git a/scripts/remove b/scripts/remove index 7ed4445..a22f977 100755 --- a/scripts/remove +++ b/scripts/remove @@ -16,9 +16,8 @@ source /usr/share/yunohost/helpers # REMOVE SYSTEMD SERVICE #================================================= ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 -redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) -# This should be a symetric version of what happens in the install script +redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) # Remove the service from the list of services known by YunoHost (added from `yunohost service add`) if ynh_exec_warn_less yunohost service status $app >/dev/null @@ -35,8 +34,6 @@ ynh_remove_logrotate ynh_redis_remove_db "$redis_db" -# Remove other various files specific to the app... such as : - ynh_secure_remove --file="/var/log/$app" #================================================= diff --git a/scripts/restore b/scripts/restore index c3cd900..6a3ae43 100755 --- a/scripts/restore +++ b/scripts/restore @@ -23,9 +23,6 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" -# $install_dir will automatically be initialized with some decent -# permissions by default ... however, you may need to recursively reapply -# ownership to all files such as after the ynh_setup_source step chown -R $app:www-data "$install_dir" #================================================= @@ -45,8 +42,6 @@ chown -R $app:www-data "$data_dir" #================================================= ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 -# This should be a symetric version of what happens in the install script - ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/systemd/system/$app.service" diff --git a/scripts/upgrade b/scripts/upgrade index 9e11137..2db493d 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -13,19 +13,8 @@ source /usr/share/yunohost/helpers redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) -### This helper will compare the version of the currently installed app and the version of the upstream package. -### $upgrade_type can have 2 different values -### - UPGRADE_APP if the upstream app version has changed -### - UPGRADE_PACKAGE if only the YunoHost package has changed -### ynh_check_app_version_changed will stop the upgrade if the app is up to date. -### UPGRADE_APP should be used to upgrade the core app only if there's an upgrade to do. -upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# STANDARD UPGRADE STEPS -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= +upgrade_type=$(ynh_check_app_version_changed) #================================================= # STOP SYSTEMD SERVICE @@ -56,9 +45,6 @@ then ynh_setup_source --dest_dir="$install_dir" fi -# $install_dir will automatically be initialized with some decent -# permissions by default ... however, you may need to recursively reapply -# ownership to all files such as after the ynh_setup_source step chown -R $app:www-data "$install_dir" if [ "$upgrade_type" == "UPGRADE_APP" ] @@ -81,8 +67,6 @@ fi #================================================= ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 -# This should be a literal copypaste of what happened in the install's "System configuration" section - ynh_add_nginx_config ynh_add_systemd_config @@ -98,26 +82,11 @@ ynh_use_logrotate --non-append #================================================= ynh_script_progression --message="Updating a configuration file..." --weight=1 -### Same as during install -### -### The file will automatically be backed-up if it's found to be manually modified (because -### ynh_add_config keeps track of the file's checksum) - ynh_add_config --template="default.env" --destination="$install_dir/default.env" -# FIXME: this should be handled by the core in the future -# You may need to use chmod 600 instead of 400, -# for example if the app is expected to be able to modify its own config chmod 400 "$install_dir/default.env" chown $app:$app "$install_dir/default.env" -### For more complex cases where you want to replace stuff using regexes, -### you shoud rely on ynh_replace_string (which is basically a wrapper for sed) -### When doing so, you also need to manually call ynh_store_file_checksum -### -### ynh_replace_string --match_string="match_string" --replace_string="replace_string" --target_file="$install_dir/some_config_file" -### ynh_store_file_checksum --file="$install_dir/some_config_file" - #================================================= # START SYSTEMD SERVICE #=================================================