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-06 14:33:28 +02:00
parent 3653943735
commit a29a3e37ff
2 changed files with 48 additions and 85 deletions

View file

@ -1,7 +1,5 @@
#!/bin/bash #!/bin/bash
# doc: https://wiki.mumble.info/wiki/Running_Murmur
#================================================= #=================================================
# GENERIC START # GENERIC START
#================================================= #=================================================
@ -61,7 +59,7 @@ ynh_app_setting_set --app=$app --key=no_sso --value="true"
ynh_app_setting_set --app=$app --key=server_password --value="$server_password" ynh_app_setting_set --app=$app --key=server_password --value="$server_password"
ynh_app_setting_set --app=$app --key=su_passwd --value="$su_passwd" ynh_app_setting_set --app=$app --key=su_passwd --value="$su_passwd"
ynh_app_setting_set --app=$app --key=welcometext --value="$welcometext" ynh_app_setting_set --app=$app --key=welcometext --value="$welcometext"
ynh_app_setting_set --app=$app --key=registerName --value="$registername" ynh_app_setting_set --app=$app --key=registername --value="$registername"
ynh_app_setting_set --app=$app --key=instance_id --value="$instance_id" ynh_app_setting_set --app=$app --key=instance_id --value="$instance_id"
ynh_app_setting_set --app=$app --key=mumbleweb --value="$mumbleweb" ynh_app_setting_set --app=$app --key=mumbleweb --value="$mumbleweb"
@ -79,9 +77,55 @@ ynh_app_setting_set --app=$app --key=port --value=$port
ynh_script_progression --message="Configuring firewall..." --weight=1 ynh_script_progression --message="Configuring firewall..." --weight=1
ynh_exec_warn_less yunohost firewall allow Both $port ynh_exec_warn_less yunohost firewall allow Both $port
#=================================================
# INSTALL MUMBLE WEB
#=================================================
if [ "$mumbleweb" -eq 1 ] ; then if [ "$mumbleweb" -eq 1 ] ; then
ynh_script_progression --message="Installing Mumble web..." --weight=1
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
# Install NodeJS
ynh_install_nodejs --nodejs_version=$nodejs_version
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
# Installing Mumble Web
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
ynh_setup_source --dest_dir="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
# Configuring NGINX web server
ynh_add_nginx_config
# Configuring Mumble server
ynh_use_nodejs
(
cd $final_path
chown -R $app: $final_path
ynh_exec_warn_less ynh_exec_as "$app" PATH="$nodejs_path:$PATH" "$nodejs_path/npm" install --save --loglevel warn
ynh_exec_warn_less ynh_exec_as "$app" PATH="$nodejs_path:$PATH" "$nodejs_path/npm" run build
ls -lah
)
ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/mumble-web.service"
ynh_exec_warn_less ynh_add_systemd_config --service=mumble-web --template=mumble-web.service
yunohost service add mumble-web --description="Mumble web interface" --log="/var/log/$app/mumble-web.log"
# Make app public if necessary
if [ $is_public -eq 1 ]
then
ynh_permission_update --permission="main" --add="visitors"
fi
ynh_systemd_action --service_name=nginx --action=reload
fi fi
#================================================= #=================================================
@ -92,40 +136,6 @@ ynh_script_progression --message="Installing dependencies..." --weight=4
# 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
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=1
if [ "$mumbleweb" -eq 1 ] ; then
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
fi
#=================================================
# INSTALL Mumble-web
#=================================================
ynh_script_progression --message="Installing Mumble Web..." --weight=4
if [ "$mumbleweb" -eq 1 ] ; then
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
ynh_setup_source --dest_dir="$final_path"
fi
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
# Create a dedicated nginx config
if [ "$mumbleweb" -eq 1 ] ; then
ynh_add_nginx_config
fi
#================================================= #=================================================
# SPECIFIC SETUP # SPECIFIC SETUP
#================================================= #=================================================
@ -135,17 +145,6 @@ ynh_script_progression --message="Configuring Mumble server..." --weight=1
ynh_add_config --template="../conf/mumble-server.ini" --destination="$final_path/mumble-server.ini" ynh_add_config --template="../conf/mumble-server.ini" --destination="$final_path/mumble-server.ini"
if [ "$mumbleweb" -eq 1 ] ; then
ynh_use_nodejs
(
cd $final_path
chown -R $app: $final_path
ynh_exec_warn_less ynh_exec_as "$app" PATH="$nodejs_path:$PATH" "$nodejs_path/npm" install --save --loglevel warn
ynh_exec_warn_less ynh_exec_as "$app" PATH="$nodejs_path:$PATH" "$nodejs_path/npm" run build
ls -lah
)
fi
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================
@ -154,11 +153,6 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=10
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config ynh_add_systemd_config
if [ "$mumbleweb" -eq 1 ] ; then
ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/mumble-web.service"
ynh_exec_warn_less ynh_add_systemd_config --service=mumble-web --template=mumble-web.service
fi
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================
@ -198,10 +192,6 @@ 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
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
@ -209,33 +199,6 @@ fi
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"
fi
#=================================================
# SETUP SSOWAT
#=================================================
if [ "$mumbleweb" -eq 1 ] ; then
ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary
if [ $is_public -eq 1 ]
then
ynh_permission_update --permission="main" --add="visitors"
fi
fi
#=================================================
# RELOAD NGINX
#=================================================
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

@ -266,7 +266,7 @@ Port : $port
Password to join server: $server_password Password to join server: $server_password
SuperUser Password : $su_passwd 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 : $final_path/mumble-server.ini Mumble configuration file : $final_path/mumble-server.ini