1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mumbleserver_ynh.git synced 2024-09-03 19:46:03 +02:00
This commit is contained in:
ericgaspar 2021-06-05 11:44:15 +02:00
parent 4d6e373d69
commit 63df56b4de
No known key found for this signature in database
GPG key ID: 574F281483054D44
3 changed files with 71 additions and 32 deletions

View file

@ -82,8 +82,6 @@ ynh_exec_warn_less yunohost firewall allow Both $port
if [ "$mumbleweb" -eq 1 ] ; then if [ "$mumbleweb" -eq 1 ] ; then
port_web=$(ynh_find_port --port=64737) port_web=$(ynh_find_port --port=64737)
ynh_app_setting_set --app=$app --key=port_web --value=$port_web ynh_app_setting_set --app=$app --key=port_web --value=$port_web
# Open port in firewall
#ynh_exec_warn_less yunohost firewall allow Both $port_web
fi fi
#================================================= #=================================================
@ -111,9 +109,8 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
ynh_script_progression --message="Installing Mumble Web..." --weight=4 ynh_script_progression --message="Installing Mumble Web..." --weight=4
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
if [ "$mumbleweb" -eq 1 ] ; then if [ "$mumbleweb" -eq 1 ] ; then
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
ynh_setup_source --dest_dir="$final_path" ynh_setup_source --dest_dir="$final_path"
fi fi
@ -123,7 +120,9 @@ fi
ynh_script_progression --message="Configuring NGINX web server..." --weight=1 ynh_script_progression --message="Configuring NGINX web server..." --weight=1
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config if [ "$mumbleweb" -eq 1 ] ; then
ynh_add_nginx_config
fi
#================================================= #=================================================
# SPECIFIC SETUP # SPECIFIC SETUP
@ -198,7 +197,9 @@ ynh_script_progression --message="Integrating service in YunoHost..."
# Add Mumble as a YunoHost service # Add Mumble as a YunoHost service
yunohost service add $app --description="Mumble server" --log="/var/log/$app/$app.log" --needs_exposed_ports=$port yunohost service add $app --description="Mumble server" --log="/var/log/$app/$app.log" --needs_exposed_ports=$port
# Add Mumble as a YunoHost service # Add Mumble as a YunoHost service
yunohost service add mumble-web --description="Mumble web interface" --log="/var/log/$app/mumble-web.log" if [ "$mumbleweb" -eq 1 ] ; then
yunohost service add mumble-web --description="Mumble web interface" --log="/var/log/$app/mumble-web.log"
fi
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
@ -206,26 +207,33 @@ yunohost service add mumble-web --description="Mumble web interface" --log="/var
ynh_script_progression --message="Starting a systemd service..." --weight=3 ynh_script_progression --message="Starting a systemd service..." --weight=3
ynh_systemd_action --service_name=$app --action=restart --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name=$app --action=restart --log_path="/var/log/$app/$app.log"
if [ "$mumbleweb" -eq 1 ] ; then
ynh_systemd_action --service_name=mumble-web --action=restart --log_path="/var/log/$app/mumble-web.log" ynh_systemd_action --service_name=mumble-web --action=restart --log_path="/var/log/$app/mumble-web.log"
fi
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary if [ "$mumbleweb" -eq 1 ] ; then
if [ $is_public -eq 1 ] ynh_script_progression --message="Configuring permissions..." --weight=1
then
ynh_permission_update --permission="main" --add="visitors" # Make app public if necessary
if [ $is_public -eq 1 ]
then
ynh_permission_update --permission="main" --add="visitors"
fi
fi fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload if [ "$mumbleweb" -eq 1 ] ; then
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
fi
#================================================= #=================================================
# SEND README TO ADMIN # SEND README TO ADMIN

View file

@ -26,18 +26,20 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path) path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port) port=$(ynh_app_setting_get --app=$app --key=port)
mumbleweb=$(ynh_app_setting_get --app=$app --key=mumbleweb)
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
#================================================= #=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1
ynh_script_progression --message="Validating restoration parameters..." --weight=1 if [ "$mumbleweb" -eq 1 ] ; then
ynh_script_progression --message="Validating restoration parameters..." --weight=1
ynh_webpath_available --domain=$domain --path_url=$path_url \ ynh_webpath_available --domain=$domain --path_url=$path_url \
|| ynh_die --message="Path not available: ${domain}${path_url}" || ynh_die --message="Path not available: ${domain}${path_url}"
test ! -d $final_path \ test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path " || ynh_die --message="There is already a directory: $final_path "
fi
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
@ -45,7 +47,9 @@ test ! -d $final_path \
# RESTORE THE NGINX CONFIGURATION # RESTORE THE NGINX CONFIGURATION
#================================================= #=================================================
if [ "$mumbleweb" -eq 1 ] ; then
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
fi
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
@ -71,6 +75,10 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=4
# Define and install dependencies # Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
if [ "$mumbleweb" -eq 1 ] ; then
ynh_install_nodejs --nodejs_version=$nodejs_version
fi
#================================================= #=================================================
# RESTORE USER RIGHTS # RESTORE USER RIGHTS
#================================================= #=================================================
@ -102,7 +110,9 @@ ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
# Add Mumble as a YunoHost service # Add Mumble as a YunoHost service
yunohost service add $app --description="Mumble server" --log="/var/log/$app/$app.log" --needs_exposed_ports=$port yunohost service add $app --description="Mumble server" --log="/var/log/$app/$app.log" --needs_exposed_ports=$port
# Add Mumble as a YunoHost service # Add Mumble as a YunoHost service
yunohost service add mumble-web --description="Mumble web interface" --log="/var/log/$app/mumble-web.log" if [ "$mumbleweb" -eq 1 ] ; then
yunohost service add mumble-web --description="Mumble web interface" --log="/var/log/$app/mumble-web.log"
fi
#================================================= #=================================================
# RESTORE SYSTEMD # RESTORE SYSTEMD
@ -112,8 +122,10 @@ ynh_script_progression --message="Restoring the systemd configuration..." --weig
ynh_restore_file --origin_path="/etc/systemd/system/$app.service" ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable "$app.service" --quiet systemctl enable "$app.service" --quiet
ynh_restore_file --origin_path="/etc/systemd/system/mumble-web.service" if [ "$mumbleweb" -eq 1 ] ; then
systemctl enable "mumble-web.service" --quiet ynh_restore_file --origin_path="/etc/systemd/system/mumble-web.service"
systemctl enable "mumble-web.service" --quiet
fi
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
@ -121,16 +133,21 @@ systemctl enable "mumble-web.service" --quiet
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name="mumble-web" --action="start" --log_path="/var/log/$app/mumble-web.log" if [ "$mumbleweb" -eq 1 ] ; then
ynh_systemd_action --service_name="mumble-web" --action="start" --log_path="/var/log/$app/mumble-web.log"
fi
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================
# RELOAD NGINX AND PHP-FPM # RELOAD NGINX AND PHP-FPM
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload if [ "$mumbleweb" -eq 1 ] ; then
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
fi
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -125,7 +125,9 @@ ynh_abort_if_errors
ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name="$app" --action="stop" ynh_systemd_action --service_name="$app" --action="stop"
ynh_systemd_action --service_name="mumble-web" --action="stop" if [ "$mumbleweb" -eq 1 ] ; then
ynh_systemd_action --service_name="mumble-web" --action="stop"
fi
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
@ -152,7 +154,9 @@ fi
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=5 ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=5
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config if [ "$mumbleweb" -eq 1 ] ; then
ynh_add_nginx_config
fi
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
@ -162,6 +166,10 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=1
# Install Mumble Debian package via apt # Install Mumble Debian package via apt
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
if [ "$mumbleweb" -eq 1 ] ; then
ynh_install_nodejs --nodejs_version=$nodejs_version
fi
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
#================================================= #=================================================
@ -194,7 +202,7 @@ chmod -R 770 "$final_path"
chown -R :mumble-server "$final_path" chown -R :mumble-server "$final_path"
#================================================= #=================================================
#ADD USER TO SSL-CERT # ADD USER TO SSL-CERT
#================================================= #=================================================
# Add user to ssl-cert so it can read certificates # Add user to ssl-cert so it can read certificates
@ -222,7 +230,9 @@ systemctl disable mumble-server --quiet
# Add Mumble as a YunoHost service # Add Mumble as a YunoHost service
yunohost service add $app --description="Mumble server" --log="/var/log/$app/$app.log" --needs_exposed_ports=$port yunohost service add $app --description="Mumble server" --log="/var/log/$app/$app.log" --needs_exposed_ports=$port
# Add Mumble as a YunoHost service # Add Mumble as a YunoHost service
yunohost service add mumble-web --description="Mumble web interface" --log="/var/log/$app/mumble-web.log" if [ "$mumbleweb" -eq 1 ] ; then
yunohost service add mumble-web --description="Mumble web interface" --log="/var/log/$app/mumble-web.log"
fi
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
@ -230,21 +240,25 @@ yunohost service add mumble-web --description="Mumble web interface" --log="/var
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name="mumble-web" --action="start" --log_path="/var/log/$app/mumble-web.log" if [ "$mumbleweb" -eq 1 ] ; then
ynh_systemd_action --service_name="mumble-web" --action="start" --log_path="/var/log/$app/mumble-web.log"
fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=2 if [ "$mumbleweb" -eq 1 ] ; then
ynh_script_progression --message="Reloading NGINX web server..." --weight=2
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
fi
#================================================= #=================================================
# SEND README TO ADMIN # SEND README TO ADMIN
#================================================= #=================================================
message=" message="
Mumble-server was updated! Mumble server was updated!
Port : $port Port : $port
Password to join server: $server_password Password to join server: $server_password
@ -252,7 +266,7 @@ SuperUser Password : $su_passwd
Welcome text : $welcometext Welcome text : $welcometext
Root channel (your mumble server name): $registername Root channel (your mumble server name): $registername
Final path (where to find your files) : $final_path Final path (where to find your files) : $final_path
Mumble configuration file : ../conf/mumble-server.ini Mumble configuration file : $final_path/mumble-server.ini
Note about config file: this package will regenerate the config file on upgrade. Note about config file: this package will regenerate the config file on upgrade.
If you changed it manually and upgrade mumble, you'll find a backup in $final_path. If you changed it manually and upgrade mumble, you'll find a backup in $final_path.