diff --git a/scripts/install b/scripts/install index d97deb1..b5b3bf7 100644 --- a/scripts/install +++ b/scripts/install @@ -1,7 +1,5 @@ #!/bin/bash -# doc: https://wiki.mumble.info/wiki/Running_Murmur - #================================================= # 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=su_passwd --value="$su_passwd" 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=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_exec_warn_less yunohost firewall allow Both $port +#================================================= +# INSTALL MUMBLE WEB +#================================================= + if [ "$mumbleweb" -eq 1 ] ; then + ynh_script_progression --message="Installing Mumble web..." --weight=1 + port_web=$(ynh_find_port --port=64737) 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 #================================================= @@ -92,40 +136,6 @@ ynh_script_progression --message="Installing dependencies..." --weight=4 # Install Mumble Debian package via apt 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 #================================================= @@ -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" -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 #================================================= @@ -154,11 +153,6 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=10 # Create a dedicated 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 #================================================= @@ -198,10 +192,6 @@ ynh_script_progression --message="Integrating service in YunoHost..." # Add Mumble as a YunoHost service 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 @@ -209,33 +199,6 @@ fi 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" -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 diff --git a/scripts/upgrade b/scripts/upgrade index 9546324..0711cb8 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -266,7 +266,7 @@ Port : $port Password to join server: $server_password SuperUser Password : $su_passwd 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 Mumble configuration file : $final_path/mumble-server.ini