mirror of
https://github.com/YunoHost-Apps/jupyterlab_ynh.git
synced 2024-09-03 19:26:35 +02:00
Format files
This commit is contained in:
parent
03ba0348c2
commit
5ed1002562
7 changed files with 94 additions and 108 deletions
|
@ -143,24 +143,21 @@ setup_source() {
|
||||||
src_filename="${src_id}.${src_format}"
|
src_filename="${src_id}.${src_format}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! test -e "$final_path"
|
if ! test -e "$final_path"; then
|
||||||
then
|
|
||||||
|
|
||||||
local local_src="/opt/yunohost-apps-src/${YNH_APP_ID}/${src_filename}"
|
local local_src="/opt/yunohost-apps-src/${YNH_APP_ID}/${src_filename}"
|
||||||
|
|
||||||
ynh_print_info "Downloading anaconda files (used by JupyterLab)..."
|
ynh_print_info "Downloading anaconda files (used by JupyterLab)..."
|
||||||
|
|
||||||
|
if test -e "$local_src"; then # Use the local source file if it is present
|
||||||
if test -e "$local_src"
|
|
||||||
then # Use the local source file if it is present
|
|
||||||
cp $local_src $src_filename
|
cp $local_src $src_filename
|
||||||
else # If not, download the source
|
else # If not, download the source
|
||||||
local out=`wget -nv -O $src_filename $src_url 2>&1` || ynh_print_err $out
|
local out=$(wget -nv -O $src_filename $src_url 2>&1) || ynh_print_err $out
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check the control sum
|
# Check the control sum
|
||||||
echo "${src_sum} ${src_filename}" | ${src_sumprg} -c --status \
|
echo "${src_sum} ${src_filename}" | ${src_sumprg} -c --status ||
|
||||||
|| ynh_die "Corrupt source"
|
ynh_die "Corrupt source"
|
||||||
|
|
||||||
ynh_print_info "Installing anaconda (used by JupyterLab)..."
|
ynh_print_info "Installing anaconda (used by JupyterLab)..."
|
||||||
|
|
||||||
|
@ -171,9 +168,7 @@ setup_source() {
|
||||||
|
|
||||||
ynh_print_info "Installing JupyterLab..."
|
ynh_print_info "Installing JupyterLab..."
|
||||||
|
|
||||||
|
if [ "$src_id" = "arm" ]; then
|
||||||
if [ "$src_id" = "arm" ]
|
|
||||||
then
|
|
||||||
conda install jupyterlab=$jupyterlab_version notebook nodejs -y
|
conda install jupyterlab=$jupyterlab_version notebook nodejs -y
|
||||||
pip install jupyterhub jupyterhub-ldapauthenticator
|
pip install jupyterhub jupyterhub-ldapauthenticator
|
||||||
else
|
else
|
||||||
|
|
|
@ -54,14 +54,12 @@ path_url="$new_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
change_domain=0
|
change_domain=0
|
||||||
if [ "$old_domain" != "$new_domain" ]
|
if [ "$old_domain" != "$new_domain" ]; then
|
||||||
then
|
|
||||||
change_domain=1
|
change_domain=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
change_path=0
|
change_path=0
|
||||||
if [ "$old_path" != "$new_path" ]
|
if [ "$old_path" != "$new_path" ]; then
|
||||||
then
|
|
||||||
change_path=1
|
change_path=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -78,8 +76,7 @@ yunohost service stop jupyterlab
|
||||||
#=================================================
|
#=================================================
|
||||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||||
|
|
||||||
if [ $change_path -eq 1 ]
|
if [ $change_path -eq 1 ]; then
|
||||||
then
|
|
||||||
ynh_print_info "Changing path..."
|
ynh_print_info "Changing path..."
|
||||||
|
|
||||||
# Make a backup of the original nginx config file if modified
|
# Make a backup of the original nginx config file if modified
|
||||||
|
@ -92,8 +89,7 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Change the domain for nginx
|
# Change the domain for nginx
|
||||||
if [ $change_domain -eq 1 ]
|
if [ $change_domain -eq 1 ]; then
|
||||||
then
|
|
||||||
ynh_print_info "Changing domain..."
|
ynh_print_info "Changing domain..."
|
||||||
|
|
||||||
# Delete file checksum for the old conf file location
|
# Delete file checksum for the old conf file location
|
||||||
|
|
|
@ -33,8 +33,7 @@ ynh_systemd_action() {
|
||||||
ynh_print_info "Waiting for a response from $service_name..."
|
ynh_print_info "Waiting for a response from $service_name..."
|
||||||
|
|
||||||
# Start to read the log
|
# Start to read the log
|
||||||
if [[ -n "${line_match:-}" ]]
|
if [[ -n "${line_match:-}" ]]; then
|
||||||
then
|
|
||||||
local templog="$(mktemp)"
|
local templog="$(mktemp)"
|
||||||
# Following the starting of the app in its log
|
# Following the starting of the app in its log
|
||||||
if [ "$log_path" == "systemd" ]; then
|
if [ "$log_path" == "systemd" ]; then
|
||||||
|
@ -49,28 +48,28 @@ ynh_systemd_action() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "${action^} the service $service_name" >&2
|
echo "${action^} the service $service_name" >&2
|
||||||
systemctl $action $service_name \
|
systemctl $action $service_name ||
|
||||||
|| ( journalctl --lines=$length -u $service_name >&2 \
|
(
|
||||||
; test -n "$log_path" && echo "--" && tail --lines=$length "$log_path" >&2 \
|
journalctl --lines=$length -u $service_name >&2 \
|
||||||
; false )
|
;
|
||||||
|
test -n "$log_path" && echo "--" && tail --lines=$length "$log_path" >&2 \
|
||||||
|
;
|
||||||
|
false
|
||||||
|
)
|
||||||
|
|
||||||
# Start the timeout and try to find line_match
|
# Start the timeout and try to find line_match
|
||||||
if [[ -n "${line_match:-}" ]]
|
if [[ -n "${line_match:-}" ]]; then
|
||||||
then
|
|
||||||
local i=0
|
local i=0
|
||||||
for i in $(seq 1 $timeout)
|
for i in $(seq 1 $timeout); do
|
||||||
do
|
|
||||||
# Read the log until the sentence is found, that means the app finished to start. Or run until the timeout
|
# Read the log until the sentence is found, that means the app finished to start. Or run until the timeout
|
||||||
if grep --quiet "$line_match" "$templog"
|
if grep --quiet "$line_match" "$templog"; then
|
||||||
then
|
|
||||||
echo "The service $service_name has correctly started." >&2
|
echo "The service $service_name has correctly started." >&2
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
echo -n "." >&2
|
echo -n "." >&2
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
if [ $i -eq $timeout ]
|
if [ $i -eq $timeout ]; then
|
||||||
then
|
|
||||||
echo "The service $service_name didn't fully started before the timeout." >&2
|
echo "The service $service_name didn't fully started before the timeout." >&2
|
||||||
journalctl --lines=$length -u $service_name >&2
|
journalctl --lines=$length -u $service_name >&2
|
||||||
test -n "$log_path" && echo "--" && tail --lines=$length "$log_path" >&2
|
test -n "$log_path" && echo "--" && tail --lines=$length "$log_path" >&2
|
||||||
|
|
|
@ -42,8 +42,8 @@ ynh_webpath_register $app $domain $path_url
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Check user parameter
|
# Check user parameter
|
||||||
ynh_user_exists "$admin" \
|
ynh_user_exists "$admin" ||
|
||||||
|| ynh_die "The chosen admin user does not exist."
|
ynh_die "The chosen admin user does not exist."
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
|
|
|
@ -37,8 +37,7 @@ ynh_remove_systemd_config
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Remove a service from the admin panel, added by `yunohost service add`
|
# Remove a service from the admin panel, added by `yunohost service add`
|
||||||
if yunohost service status | grep -q $app
|
if yunohost service status | grep -q $app; then
|
||||||
then
|
|
||||||
echo "Remove $app service"
|
echo "Remove $app service"
|
||||||
yunohost service remove $app
|
yunohost service remove $app
|
||||||
fi
|
fi
|
||||||
|
@ -66,18 +65,15 @@ ynh_secure_remove "/var/log/$app.log"
|
||||||
# CLOSE PORTS
|
# CLOSE PORTS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if yunohost firewall list | grep -q "\- $port$"
|
if yunohost firewall list | grep -q "\- $port$"; then
|
||||||
then
|
|
||||||
echo "Close port $port" >&2
|
echo "Close port $port" >&2
|
||||||
yunohost firewall disallow TCP $port 2>&1
|
yunohost firewall disallow TCP $port 2>&1
|
||||||
fi
|
fi
|
||||||
if yunohost firewall list | grep -q "\- $port_hub$"
|
if yunohost firewall list | grep -q "\- $port_hub$"; then
|
||||||
then
|
|
||||||
echo "Close port $port_hub" >&2
|
echo "Close port $port_hub" >&2
|
||||||
yunohost firewall disallow TCP $port_hub 2>&1
|
yunohost firewall disallow TCP $port_hub 2>&1
|
||||||
fi
|
fi
|
||||||
if yunohost firewall list | grep -q "\- $port_http_proxy$"
|
if yunohost firewall list | grep -q "\- $port_http_proxy$"; then
|
||||||
then
|
|
||||||
echo "Close port $port_http_proxy" >&2
|
echo "Close port $port_http_proxy" >&2
|
||||||
yunohost firewall disallow TCP $port_http_proxy 2>&1
|
yunohost firewall disallow TCP $port_http_proxy 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue