1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/jupyterlab_ynh.git synced 2024-09-03 19:26:35 +02:00

Upgrade to 3.0.11

This commit is contained in:
ericgaspar 2021-03-17 18:55:20 +01:00
parent e856ff01da
commit 9c8c9987a4
No known key found for this signature in database
GPG key ID: 574F281483054D44
4 changed files with 66 additions and 39 deletions

View file

@ -9,7 +9,7 @@ pkg_dependencies="python3-dev python3-pip libffi-dev libzmq3-dev"
nodejs_version="14"
jupyterlab_version="3.0.10"
jupyterlab_version="3.0.11"
#=================================================
# PERSONAL HELPERS

View file

@ -33,6 +33,23 @@ port_hub=$(ynh_app_setting_get --app=$app --key=port_hub)
port_http_proxy=$(ynh_app_setting_get --app=$app --key=port_http_proxy)
admin=$(ynh_app_setting_get --app=$app --key=admin)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
@ -93,21 +110,23 @@ fi
# CONFIGURE JUPYTERLAB
#=================================================
ynh_backup_if_checksum_is_different --file="$final_path/config/jupyterhub_config.py"
#ynh_backup_if_checksum_is_different --file="$final_path/config/jupyterhub_config.py"
domain=$new_domain
path_url=$new_path
path_url=${new_path%/}
cp -f ../conf/jupyterhub_config.py $final_path/config/jupyterhub_config.py
ynh_replace_string --match_string="__URL__" --replace_string="https://$domain" --target_file="$final_path/config/jupyterhub_config.py"
ynh_replace_string --match_string="__PATH__" --replace_string="${path_url%/}" --target_file="$final_path/config/jupyterhub_config.py"
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/config/jupyterhub_config.py"
ynh_replace_string --match_string="__PORT_HUB__" --replace_string="$port_hub" --target_file="$final_path/config/jupyterhub_config.py"
ynh_replace_string --match_string="__PORT_HTTP_PROXY__" --replace_string="$port_http_proxy" --target_file="$final_path/config/jupyterhub_config.py"
ynh_replace_string --match_string="__FINAL_PATH__" --replace_string="$final_path" --target_file="$final_path/config/jupyterhub_config.py"
ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="$final_path/config/jupyterhub_config.py"
# cp -f ../conf/jupyterhub_config.py $final_path/config/jupyterhub_config.py
# ynh_replace_string --match_string="__URL__" --replace_string="https://$domain" --target_file="$final_path/config/jupyterhub_config.py"
# ynh_replace_string --match_string="__PATH__" --replace_string="${path_url%/}" --target_file="$final_path/config/jupyterhub_config.py"
# ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/config/jupyterhub_config.py"
# ynh_replace_string --match_string="__PORT_HUB__" --replace_string="$port_hub" --target_file="$final_path/config/jupyterhub_config.py"
# ynh_replace_string --match_string="__PORT_HTTP_PROXY__" --replace_string="$port_http_proxy" --target_file="$final_path/config/jupyterhub_config.py"
# ynh_replace_string --match_string="__FINAL_PATH__" --replace_string="$final_path" --target_file="$final_path/config/jupyterhub_config.py"
# ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="$final_path/config/jupyterhub_config.py"
ynh_store_file_checksum --file="$final_path/config/jupyterhub_config.py"
# ynh_store_file_checksum --file="$final_path/config/jupyterhub_config.py"
ynh_add_config --template="../conf/jupyterhub_config.py" --destination="$final_path/config/jupyterhub_config.py"
#=================================================
# GENERIC FINALISATION

View file

@ -135,28 +135,32 @@ ynh_add_systemd_config
mkdir -p "$final_path/config"
# JupyterHub configuration
cp -f ../conf/jupyterhub_config.py $final_path/config/jupyterhub_config.py
# cp -f ../conf/jupyterhub_config.py $final_path/config/jupyterhub_config.py
ynh_replace_string --match_string="__URL__" --replace_string="https://$domain" --target_file="$final_path/config/jupyterhub_config.py"
ynh_replace_string --match_string="__PATH__" --replace_string="${path_url%/}" --target_file="$final_path/config/jupyterhub_config.py"
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/config/jupyterhub_config.py"
ynh_replace_string --match_string="__PORT_HUB__" --replace_string="$port_hub" --target_file="$final_path/config/jupyterhub_config.py"
ynh_replace_string --match_string="__PORT_HTTP_PROXY__" --replace_string="$port_http_proxy" --target_file="$final_path/config/jupyterhub_config.py"
ynh_replace_string --match_string="__FINAL_PATH__" --replace_string="$final_path" --target_file="$final_path/config/jupyterhub_config.py"
ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="$final_path/config/jupyterhub_config.py"
# ynh_replace_string --match_string="__URL__" --replace_string="https://$domain" --target_file="$final_path/config/jupyterhub_config.py"
# ynh_replace_string --match_string="__PATH__" --replace_string="${path_url%/}" --target_file="$final_path/config/jupyterhub_config.py"
# ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/config/jupyterhub_config.py"
# ynh_replace_string --match_string="__PORT_HUB__" --replace_string="$port_hub" --target_file="$final_path/config/jupyterhub_config.py"
# ynh_replace_string --match_string="__PORT_HTTP_PROXY__" --replace_string="$port_http_proxy" --target_file="$final_path/config/jupyterhub_config.py"
# ynh_replace_string --match_string="__FINAL_PATH__" --replace_string="$final_path" --target_file="$final_path/config/jupyterhub_config.py"
# ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="$final_path/config/jupyterhub_config.py"
ynh_add_config --template="../conf/jupyterhub_config.py" --destination="$final_path/config/jupyterhub_config.py"
# Jupyter notebook configuration
cp -f ../conf/jupyter_notebook_config.py $final_path/config/jupyter_notebook_config.py
# cp -f ../conf/jupyter_notebook_config.py $final_path/config/jupyter_notebook_config.py
ynh_replace_string --match_string="__ENABLE_TERMINAL__" --replace_string="$enable_terminal" --target_file="$final_path/config/jupyter_notebook_config.py"
# ynh_replace_string --match_string="__ENABLE_TERMINAL__" --replace_string="$enable_terminal" --target_file="$final_path/config/jupyter_notebook_config.py"
ynh_add_config --template="../conf/jupyter_notebook_config.py" --destination="$final_path/config/jupyter_notebook_config.py"
#=================================================
# STORE THE CONFIG FILE CHECKSUM
#=================================================
# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$final_path/config/jupyterhub_config.py"
ynh_store_file_checksum --file="$final_path/config/jupyter_notebook_config.py"
# ynh_store_file_checksum --file="$final_path/config/jupyterhub_config.py"
# ynh_store_file_checksum --file="$final_path/config/jupyter_notebook_config.py"
#=================================================
# GENERIC FINALIZATION

View file

@ -132,29 +132,33 @@ fi
# STORE THE CONFIG FILE CHECKSUM
#=================================================
ynh_backup_if_checksum_is_different --file="$final_path/config/jupyterhub_config.py"
#ynh_backup_if_checksum_is_different --file="$final_path/config/jupyterhub_config.py"
mkdir -p "$final_path/config"
cp -f ../conf/jupyterhub_config.py $final_path/config/jupyterhub_config.py
ynh_replace_string --match_string="__URL__" --replace_string="https://$domain" --target_file="$final_path/config/jupyterhub_config.py"
ynh_replace_string --match_string="__PATH__" --replace_string="${path_url%/}" --target_file="$final_path/config/jupyterhub_config.py"
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/config/jupyterhub_config.py"
ynh_replace_string --match_string="__PORT_HUB__" --replace_string="$port_hub" --target_file="$final_path/config/jupyterhub_config.py"
ynh_replace_string --match_string="__PORT_HTTP_PROXY__" --replace_string="$port_http_proxy" --target_file="$final_path/config/jupyterhub_config.py"
ynh_replace_string --match_string="__FINAL_PATH__" --replace_string="$final_path" --target_file="$final_path/config/jupyterhub_config.py"
ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="$final_path/config/jupyterhub_config.py"
# cp -f ../conf/jupyterhub_config.py $final_path/config/jupyterhub_config.py
# ynh_replace_string --match_string="__URL__" --replace_string="https://$domain" --target_file="$final_path/config/jupyterhub_config.py"
# ynh_replace_string --match_string="__PATH__" --replace_string="${path_url%/}" --target_file="$final_path/config/jupyterhub_config.py"
# ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/config/jupyterhub_config.py"
# ynh_replace_string --match_string="__PORT_HUB__" --replace_string="$port_hub" --target_file="$final_path/config/jupyterhub_config.py"
# ynh_replace_string --match_string="__PORT_HTTP_PROXY__" --replace_string="$port_http_proxy" --target_file="$final_path/config/jupyterhub_config.py"
# ynh_replace_string --match_string="__FINAL_PATH__" --replace_string="$final_path" --target_file="$final_path/config/jupyterhub_config.py"
# ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="$final_path/config/jupyterhub_config.py"
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="$final_path/config/jupyterhub_config.py"
# # Recalculate and store the checksum of the file for the next upgrade.
# ynh_store_file_checksum --file="$final_path/config/jupyterhub_config.py"
ynh_backup_if_checksum_is_different --file="$final_path/config/jupyter_notebook_config.py"
ynh_add_config --template="../conf/jupyterhub_config.py" --destination="$final_path/config/jupyterhub_config.py"
cp -f ../conf/jupyter_notebook_config.py $final_path/config/jupyter_notebook_config.py
#ynh_backup_if_checksum_is_different --file="$final_path/config/jupyter_notebook_config.py"
ynh_replace_string --match_string="__ENABLE_TERMINAL__" --replace_string="$enable_terminal" --target_file="$final_path/config/jupyter_notebook_config.py"
# cp -f ../conf/jupyter_notebook_config.py $final_path/config/jupyter_notebook_config.py
ynh_store_file_checksum --file="$final_path/config/jupyter_notebook_config.py"
# ynh_replace_string --match_string="__ENABLE_TERMINAL__" --replace_string="$enable_terminal" --target_file="$final_path/config/jupyter_notebook_config.py"
# ynh_store_file_checksum --file="$final_path/config/jupyter_notebook_config.py"
ynh_add_config --template="../conf/jupyter_notebook_config.py" --destination="$final_path/config/jupyter_notebook_config.py"
#=================================================
# SETUP SYSTEMD