1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/jupyterlab_ynh.git synced 2024-09-03 19:26:35 +02:00
jupyterlab_ynh/scripts/_common.sh
2018-12-28 23:47:31 +01:00

42 lines
1.3 KiB
Bash

#=================================================
# SET ALL CONSTANTS
#=================================================
app=$YNH_APP_INSTANCE_NAME
config_path="/etc/$app"
final_path="/opt/$app"
#=================================================
# CREATE FOLDERS
#=================================================
create_dir() {
mkdir -p "$config_path"
}
#=================================================
# CONFIGURATION FILE FOR JUPYTERLAB
#=================================================
config_jupyterlab() {
create_dir
jupyterlab_conf_path="$config_path/jupyterhub_config.py"
ynh_backup_if_checksum_is_different $jupyterlab_conf_path
# Gitlab configuration
cp -f ../conf/jupyterhub_config.py $jupyterlab_conf_path
ynh_replace_string "__URL__" "https://$domain" $jupyterlab_conf_path
ynh_replace_string "__PATH__" "${path_url%/}" $jupyterlab_conf_path
ynh_replace_string "__PORT__" "$port" $jupyterlab_conf_path
ynh_replace_string "__FINAL_PATH__" "$final_path" $jupyterlab_conf_path
ynh_store_file_checksum $jupyterlab_conf_path
}
#=================================================
# REMOVE THE CONFIGURATION FILE FOR GITLAB
#=================================================
remove_config_jupyterlab() {
ynh_secure_remove "$config_path/jupyterhub_config.py"
}