mirror of
https://github.com/YunoHost-Apps/jenkins_ynh.git
synced 2024-09-03 19:26:18 +02:00
76 lines
2.2 KiB
Bash
Executable file
76 lines
2.2 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC STARTING
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source scripts/_common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# RETRIEVE ARGUMENTS
|
|
#=================================================
|
|
|
|
# Get is_public
|
|
is_public=${YNH_ACTION_IS_PUBLIC}
|
|
|
|
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
|
|
|
#=================================================
|
|
# CHECK IF ARGUMENTS ARE CORRECT
|
|
#=================================================
|
|
|
|
#=================================================
|
|
# CHECK IF AN ACTION HAS TO BE DONE
|
|
#=================================================
|
|
|
|
is_public_old=$(ynh_app_setting_get --app=$app --key=is_public)
|
|
|
|
if [ $is_public -eq $is_public_old ]
|
|
then
|
|
ynh_die --message="is_public is already set as $is_public." 0
|
|
fi
|
|
|
|
#=================================================
|
|
# SPECIFIC ACTION
|
|
#=================================================
|
|
# MOVE TO PUBLIC OR PRIVATE
|
|
#=================================================
|
|
if [ $is_public -eq 0 ]; then
|
|
public_private="private"
|
|
else
|
|
public_private="public"
|
|
fi
|
|
ynh_script_progression --message="Moving the application to $public_private..."
|
|
|
|
if [ $is_public -eq 0 ]
|
|
then
|
|
ynh_app_setting_delete --app=$app --key=unprotected_uris
|
|
# /path/github-webhook has to be accessible for github's webhooks
|
|
ynh_app_setting_set --app=$app --key=skipped_uris --value="/github-webhook"
|
|
else
|
|
ynh_app_setting_delete --app=$app --key=skipped_uris
|
|
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
|
|
fi
|
|
|
|
ynh_script_progression --message="Reconfigure SSOwat"
|
|
# Regen ssowat configuration
|
|
yunohost app ssowatconf
|
|
|
|
# Update the config of the app
|
|
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
|
|
|
|
#=================================================
|
|
# RELOAD NGINX
|
|
#=================================================
|
|
ynh_script_progression --message="Reload nginx"
|
|
|
|
ynh_systemd_action --service_name=nginx --action=reload
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Execution completed"
|