1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/galene_ynh.git synced 2024-09-03 18:36:31 +02:00
This commit is contained in:
Éric Gaspar 2023-02-03 13:54:11 +01:00
parent 437dfa7249
commit 5e5f6e0d1d
3 changed files with 15 additions and 85 deletions

View file

@ -23,24 +23,8 @@ ynh_app_setting_set --app=$app --key=group_description --value="$group_descripti
#=================================================
# FIND AND OPEN A PORT
#=================================================
#REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=3
# Find an available port
#REMOVEME? port=$(ynh_find_port --port=8095)
#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port
#REMOVEME? ldap_port=$(ynh_find_port --port=$(($port + 1)))
#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$ldap_port
# Find an available port for TURN
#REMOVEME? turn_port=$(ynh_find_port --port=1194)
#REMOVEME? ynh_app_setting_set --app=$app --key=turn_port --value=$turn_port
# Open TURN port
ynh_script_progression --message="Configuring firewall..." --weight=1
ynh_exec_warn_less yunohost firewall allow Both $turn_port
# Reserve UDP Port range 49152:65535
ynh_exec_warn_less yunohost firewall allow UDP -4 49152:65535
@ -85,20 +69,17 @@ pushd $install_dir/build_ldap/
ynh_exec_warn_less ynh_exec_as $app CGO_ENABLED=0 $ynh_go build -ldflags='-s -w' -o $install_dir/live_ldap/
popd
ynh_remove_go
#REMOVEME? ynh_secure_remove --file="$install_dir/build/"
#REMOVEME? ynh_secure_remove --file="$install_dir/build_ldap/"
#REMOVEME? ynh_secure_remove --file="$install_dir/.cache/"
#REMOVEME? ynh_secure_remove --file="$install_dir/go/"
#REMOVEME? ynh_secure_remove --file="$install_dir/.go-version"
ynh_secure_remove --file="$install_dir/build/"
ynh_secure_remove --file="$install_dir/build_ldap/"
ynh_secure_remove --file="$install_dir/.cache/"
ynh_secure_remove --file="$install_dir/go/"
ynh_secure_remove --file="$install_dir/.go-version"
#=================================================
# CREATE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Creating a data directory..." --weight=1
#REMOVEME? data_dir=/home/yunohost.app/$app
#REMOVEME? ynh_app_setting_set --app=$app --key=data_dir --value=$data_dir
mkdir -p $data_dir/{groups,recordings}
chmod 750 "$data_dir"
@ -150,7 +131,7 @@ ynh_add_systemd_config --service=${app}_ldap --template="ldap.service"
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=2
yunohost service add $app --description="Videoconferencing server" --needs_exposed_ports="$turn_port"
yunohost service add $app --description="Videoconferencing server" --needs_exposed_ports="$port_turn"
yunohost service add ${app}_ldap --description="LDAP integration for the videoconferencing server"
#=================================================
@ -162,13 +143,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
ynh_systemd_action --service_name=${app}_ldap --action="start" --log_path="systemd"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=2
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -37,17 +37,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
ynh_remove_systemd_config
ynh_remove_systemd_config --service=${app}_ldap
#=================================================
# REMOVE DATA DIR
#=================================================
# Remove the data directory if --purge option is used
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
then
ynh_script_progression --message="Removing app data directory..." --weight=1
#REMOVEME? ynh_secure_remove --file="$data_dir"
fi
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
@ -56,22 +45,14 @@ ynh_script_progression --message="Removing NGINX web server configuration..." --
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies
#REMOVEME? ynh_remove_app_dependencies
#=================================================
# CLOSE A PORT
#=================================================
if yunohost firewall list | grep -q "\- $turn_port$"
if yunohost firewall list | grep -q "\- $port_turn$"
then
ynh_script_progression --message="Closing port $turn_port..." --weight=1
ynh_exec_warn_less yunohost firewall disallow both $turn_port
ynh_script_progression --message="Closing port $port_turn..." --weight=1
ynh_exec_warn_less yunohost firewall disallow both $port_turn
fi
if yunohost firewall list | grep -q "\- 49152:65535"

View file

@ -37,23 +37,6 @@ then
ynh_exec_warn_less yunohost firewall disallow TCP $port
fi
# If install_dir doesn't exist, create it
if [ -z "$install_dir" ]; then
#REMOVEME? install_dir=/var/www/$app
mkdir -p $install_dir
#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
fi
# If ldap_port doesn't exist, create it
if [ -z "$ldap_port" ]; then
#REMOVEME? ldap_port=$(ynh_find_port --port=$(($port + 1)))
#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$ldap_port
# We remove the old admin/password file if present
if [ -f "$install_dir/data/passwd" ] ; then
#REMOVEME? ynh_secure_remove --file="$install_dir/data/passwd"
fi
# For version 0.6~ynh1 and before
if [[ ! -d "$install_dir/live" ]]
then
@ -69,7 +52,6 @@ fi
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Upgrading source files..." --weight=2
ynh_setup_source --dest_dir="$install_dir/build"
@ -110,11 +92,11 @@ then
ynh_exec_as $app CGO_ENABLED=0 $ynh_go build -ldflags='-s -w' -o $install_dir/live_ldap/
popd
ynh_remove_go
#REMOVEME? ynh_secure_remove --file="$install_dir/build/"
#REMOVEME? ynh_secure_remove --file="$install_dir/build_ldap/"
#REMOVEME? ynh_secure_remove --file="$install_dir/.cache/"
#REMOVEME? ynh_secure_remove --file="$install_dir/go/"
#REMOVEME? ynh_secure_remove --file="$install_dir/.go-version"
ynh_secure_remove --file="$install_dir/build/"
ynh_secure_remove --file="$install_dir/build_ldap/"
ynh_secure_remove --file="$install_dir/.cache/"
ynh_secure_remove --file="$install_dir/go/"
ynh_secure_remove --file="$install_dir/.go-version"
fi
#=================================================
@ -165,7 +147,7 @@ ynh_add_systemd_config --service=${app}_ldap --template="ldap.service"
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Videoconferencing server" --needs_exposed_ports="$turn_port"
yunohost service add $app --description="Videoconferencing server" --needs_exposed_ports="$port_turn"
yunohost service add ${app}_ldap --description="LDAP integration for the videoconferencing server"
#=================================================
@ -176,13 +158,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
ynh_systemd_action --service_name=${app}_ldap --action="start" --log_path="systemd"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=2
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================