From 03ba0348c253f4cec706509c66b996f142e94ede Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Bourr=C3=A9?= Date: Sat, 26 Jan 2019 15:03:05 +0100 Subject: [PATCH] Add infos --- scripts/_common.sh | 16 ++++++++++++++++ scripts/change_url | 8 ++++++++ scripts/experimental_helper.sh | 3 +++ scripts/install | 2 ++ scripts/remove | 2 ++ 5 files changed, 31 insertions(+) diff --git a/scripts/_common.sh b/scripts/_common.sh index b09af15..824fafa 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -34,6 +34,8 @@ create_dir() { # CONFIGURATION FILES FOR JUPYTERLAB #================================================= config_jupyterlab() { + ynh_print_info "Configuring JupyterLab..." + create_dir jupyterlab_conf_path="$config_path/jupyterhub_config.py" @@ -55,6 +57,8 @@ config_jupyterlab() { } config_jupyter_notebook() { + ynh_print_info "Configuring Jupyter Notebook..." + jupyter_notebook_conf_path="$final_path/etc/jupyter/jupyter_notebook_config.py" ynh_backup_if_checksum_is_different $jupyter_notebook_conf_path @@ -71,6 +75,8 @@ config_jupyter_notebook() { # CREATE A DEDICATED SYSTEMD CONFIG #================================================= add_systemd_config () { + ynh_print_info "Adding Jupyterlab as a service..." + sudo cp ../conf/systemd.service.default ../conf/systemd.service tempsystemdconf="../conf/systemd.service" @@ -85,6 +91,8 @@ add_systemd_config () { # REMOVE THE CONFIGURATION FILE FOR JUPYTERLAB #================================================= remove_config_jupyterlab() { + ynh_print_info "Removing the configuration file..." + ynh_secure_remove "$config_path/jupyterhub_config.py" } @@ -140,6 +148,9 @@ setup_source() { local local_src="/opt/yunohost-apps-src/${YNH_APP_ID}/${src_filename}" + ynh_print_info "Downloading anaconda files (used by JupyterLab)..." + + if test -e "$local_src" then # Use the local source file if it is present cp $local_src $src_filename @@ -151,11 +162,16 @@ setup_source() { echo "${src_sum} ${src_filename}" | ${src_sumprg} -c --status \ || ynh_die "Corrupt source" + ynh_print_info "Installing anaconda (used by JupyterLab)..." + bash $src_filename -b -p $final_path fi export "PATH=$final_path/bin/:$PATH" + ynh_print_info "Installing JupyterLab..." + + if [ "$src_id" = "arm" ] then conda install jupyterlab=$jupyterlab_version notebook nodejs -y diff --git a/scripts/change_url b/scripts/change_url index 7bb414d..7391ef5 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -80,14 +80,22 @@ nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf if [ $change_path -eq 1 ] then + ynh_print_info "Changing path..." + + # Make a backup of the original nginx config file if modified + ynh_backup_if_checksum_is_different "$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 fi # Change the domain for nginx if [ $change_domain -eq 1 ] then + ynh_print_info "Changing domain..." + # Delete file checksum for the old conf file location ynh_delete_file_checksum "$nginx_conf_path" mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf diff --git a/scripts/experimental_helper.sh b/scripts/experimental_helper.sh index 5e6a77f..7875bfe 100644 --- a/scripts/experimental_helper.sh +++ b/scripts/experimental_helper.sh @@ -11,6 +11,7 @@ # | arg: -t, --timeout= - Timeout - The maximum time to wait before ending the watching. Default : 300 seconds. # | arg: -e, --length= - Length of the error log : Default : 20 ynh_systemd_action() { + # Declare an array to define the options of this helper. declare -Ar args_array=( [n]=service_name= [a]=action= [l]=line_match= [p]=log_path= [t]=timeout= [e]=length= ) local service_name @@ -29,6 +30,8 @@ ynh_systemd_action() { local length=${length:-20} local timeout=${timeout:-300} + ynh_print_info "Waiting for a response from $service_name..." + # Start to read the log if [[ -n "${line_match:-}" ]] then diff --git a/scripts/install b/scripts/install index 042b324..1f06239 100644 --- a/scripts/install +++ b/scripts/install @@ -61,6 +61,8 @@ ynh_app_setting_set $app enable_terminal $enable_terminal # FIND AND OPEN PORTS #================================================= +ynh_print_info "Getting ports..." + # Find free ports port=$(ynh_find_port 8080) port_hub=$(ynh_find_port $(($port + 1))) diff --git a/scripts/remove b/scripts/remove index 54f70d1..8182905 100644 --- a/scripts/remove +++ b/scripts/remove @@ -54,6 +54,8 @@ remove_config_jupyterlab # REMOVE APP MAIN DIR #================================================= +ynh_print_info "Removing JupyterLab..." + ynh_secure_remove "$final_path" ynh_secure_remove "$config_path"