From 9bcdf26252e0c7bd4f70dc8659c8332a5b3b7428 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 26 Feb 2023 19:55:45 +0100 Subject: [PATCH] fix --- manifest.toml | 4 +-- scripts/backup | 27 ------------------ scripts/install | 76 +------------------------------------------------ scripts/remove | 74 +++++++++++++---------------------------------- 4 files changed, 21 insertions(+), 160 deletions(-) diff --git a/manifest.toml b/manifest.toml index 7e35ae4..33c7fb0 100644 --- a/manifest.toml +++ b/manifest.toml @@ -16,11 +16,9 @@ demo = "https://mybinder.org/v2/gh/jupyterlab/jupyterlab-demo/master?urlpath=lab admindoc = "https://jupyterlab.readthedocs.io/en/stable/" userdoc = "https://yunohost.org/en/app_jupyterlab" code = "https://github.com/jupyterhub/jupyterhub" -cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number) -fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin. [integration] -yunohost = ">= 4.3.0" +yunohost = ">= 11.1.11" architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] multi_instance = true ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials. diff --git a/scripts/backup b/scripts/backup index 58de52a..df692d6 100644 --- a/scripts/backup +++ b/scripts/backup @@ -10,33 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - true -} -# 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? 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? port="$(ynh_app_setting_get --app=$app --key=port)" -#REMOVEME? port_hub="$(ynh_app_setting_get --app=$app --key=port_hub)" -#REMOVEME? port_http_proxy="$(ynh_app_setting_get --app=$app --key=port_http_proxy)" -#REMOVEME? enable_terminal="$(ynh_app_setting_get --app=$app --key=enable_terminal)" -#REMOVEME? enable_extensions="$(ynh_app_setting_get --app=$app --key=enable_extensions)" - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= diff --git a/scripts/install b/scripts/install index b7f3edc..9cbcc3d 100644 --- a/scripts/install +++ b/scripts/install @@ -9,51 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# RETRIEVE ARGUMENTS FROM THE MANIFEST -#================================================= - -#REMOVEME? domain=$YNH_APP_ARG_DOMAIN -#REMOVEME? path=$YNH_APP_ARG_PATH -#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC -#REMOVEME? admin=$YNH_APP_ARG_ADMIN -#REMOVEME? enable_terminal=$YNH_APP_ARG_ENABLE_TERMINAL -#REMOVEME? enable_extensions=$YNH_APP_ARG_ENABLE_EXTENSIONS - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1 - -#REMOVEME? install_dir=/opt/yunohost/$app -#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder" - -# Register (book) web path -#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path - -#================================================= -# STORE SETTINGS FROM MANIFEST -#================================================= -#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=1 - -#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain -#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path -#REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin -ynh_app_setting_set --app=$app --key=enable_terminal --value=$enable_terminal -ynh_app_setting_set --app=$app --key=enable_extensions --value=$enable_extensions - #================================================= # STANDARD MODIFICATIONS #================================================= @@ -70,20 +25,10 @@ ynh_app_setting_set --app=$app --key=enable_extensions --value=$enable_extension #REMOVEME? ynh_app_setting_set --app=$app --key=port_hub --value=$port_hub #REMOVEME? ynh_app_setting_set --app=$app --key=port_http_proxy --value=$port_http_proxy -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=1 - -# Create a system user -#REMOVEME? ynh_system_user_create --username=$app - #================================================= # INSTALL DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=23 - -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies +ynh_script_progression --message="Installing dependencies..." --weight=23 ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version @@ -96,8 +41,6 @@ npm install -g configurable-http-proxy #================================================= ynh_script_progression --message="Setting up source files..." --weight=64 -#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir - # Set permissions to app files mkdir -p "$install_dir/.venv" chown -R $app:$app "$install_dir" @@ -185,23 +128,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=3 # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --line_match="JupyterHub is now running at" --log_path="systemd" -#================================================= -# SETUP SSOWAT -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=4 - -# Make app public if necessary -#REMOVEME? if [ $is_public -eq 1 ]; then -#REMOVEME? ynh_permission_update --permission="main" --add="visitors" -fi - -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index b02d2fc..30eb7fc 100644 --- a/scripts/remove +++ b/scripts/remove @@ -9,23 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain="$(ynh_app_setting_get --app=$app --key=domain)" -#REMOVEME? 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? port="$(ynh_app_setting_get --app=$app --key=port)" -#REMOVEME? port_hub="$(ynh_app_setting_get --app=$app --key=port_hub)" -#REMOVEME? port_http_proxy="$(ynh_app_setting_get --app=$app --key=port_http_proxy)" -#REMOVEME? enable_terminal="$(ynh_app_setting_get --app=$app --key=enable_terminal)" -#REMOVEME? enable_extensions="$(ynh_app_setting_get --app=$app --key=enable_extensions)" - #================================================= # STANDARD REMOVE #================================================= @@ -50,21 +33,10 @@ ynh_remove_systemd_config #================================================= # REMOVE DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=4 - -# Remove metapackage and its dependencies -#REMOVEME? ynh_remove_app_dependencies +ynh_script_progression --message="Removing dependencies..." --weight=4 ynh_remove_nodejs -#================================================= -# 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 #================================================= @@ -81,35 +53,27 @@ ynh_script_progression --message="Removing sudoers configuration..." --weight=1 # Remove the dedicated NGINX config ynh_secure_remove "/etc/sudoers.d/$app-sudoers" -#================================================= -# CLOSE A PORT -#================================================= +# #================================================= +# # CLOSE A PORT +# #================================================= -if yunohost firewall list | grep -q "\- $port$" -then - ynh_script_progression --message="Closing port $port..." - ynh_exec_warn_less yunohost firewall disallow TCP $port -fi +# if yunohost firewall list | grep -q "\- $port$" +# then +# ynh_script_progression --message="Closing port $port..." +# ynh_exec_warn_less yunohost firewall disallow TCP $port +# fi -if yunohost firewall list | grep -q "\- $port_hub$" -then - ynh_script_progression --message="Closing port $port_hub..." - ynh_exec_warn_less yunohost firewall disallow TCP $port_hub -fi +# if yunohost firewall list | grep -q "\- $port_hub$" +# then +# ynh_script_progression --message="Closing port $port_hub..." +# ynh_exec_warn_less yunohost firewall disallow TCP $port_hub +# fi -if yunohost firewall list | grep -q "\- $port_http_proxy$" -then - ynh_script_progression --message="Closing port $port_http_proxy..." - ynh_exec_warn_less yunohost firewall disallow TCP $port_http_proxy -fi - -#================================================= -# 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 +# if yunohost firewall list | grep -q "\- $port_http_proxy$" +# then +# ynh_script_progression --message="Closing port $port_http_proxy..." +# ynh_exec_warn_less yunohost firewall disallow TCP $port_http_proxy +# fi #================================================= # END OF SCRIPT