diff --git a/check_process b/check_process index bb4a25d..31b9cf2 100644 --- a/check_process +++ b/check_process @@ -4,7 +4,7 @@ server_login_password="super_secret_password" (PASSWORD) password="super_secret_password" welcometext="Welcome to my mumble server" - port="64738" (PORT) + port=64738 (PORT) registername="Root" ; Checks pkg_linter=1 diff --git a/conf/mumble-server.ini b/conf/mumble-server.ini index a1d092e..e91f299 100644 --- a/conf/mumble-server.ini +++ b/conf/mumble-server.ini @@ -13,7 +13,7 @@ # Path to database. If blank, will search for # murmur.sqlite in default locations or create it if not found. -database=/var/lib/mumble-server/mumble-server.sqlite +database=__FINALPATH__/mumble-server.sqlite # If you wish to use something other than SQLite, you'll need to set the name # of the database above, and also uncomment the below. @@ -72,13 +72,13 @@ icesecretwrite= # logs to the file 'murmur.log'. If you leave this field blank # on Unix-like systems, Murmur will force itself into foreground # mode which logs to the console. -logfile=/var/log/mumble-server/mumble-server.log +logfile=/var/log/mumble-server/__APP__.log # If set, Murmur will write its process ID to this file # when running in daemon mode (when the -fg flag is not # specified on the command line). Only available on # Unix-like systems. -pidfile=/var/run/mumble-server/mumble-server.pid +pidfile=/var/run/mumble-server/__APP__.pid # The below will be used as defaults for new configured servers. # If you're just running one server (the default), it's easier to diff --git a/conf/systemd.service b/conf/systemd.service new file mode 100644 index 0000000..7f0e148 --- /dev/null +++ b/conf/systemd.service @@ -0,0 +1,15 @@ +[Unit] +Description=Mumble Server (Murmur, app __APP__) +Requires=network-online.target +After=network.target + +[Service] +User=mumble-server +Group=mumble-server +Type=forking +ExecStart=/usr/sbin/murmurd -ini __FINALPATH__/mumble-server.ini +PIDFile=/var/run/mumble-server/__APP__.pid +ExecReload=/bin/kill -s HUP $MAINPID + +[Install] +WantedBy=multi-user.target diff --git a/manifest.json b/manifest.json index fd6a149..41cd762 100644 --- a/manifest.json +++ b/manifest.json @@ -7,7 +7,7 @@ "fr": "Mumble est un logiciel libre de voix sur IP (VoIP), son principal usage étant la communication pendant les parties de jeux en réseau." }, "url": "https://mumble.info", - "license": "free", + "license": "BSD-3-Clause", "maintainer": { "name": "Moul", "email": "moul@moul.re" @@ -15,6 +15,7 @@ "requirements": { "yunohost": ">> 2.4.0" }, + "version": "1.2.8-1", "multi_instance": false, "services": [ ], diff --git a/scripts/install b/scripts/install index 41acbaf..4ffe185 100644 --- a/scripts/install +++ b/scripts/install @@ -32,9 +32,13 @@ registerName=$YNH_APP_ARG_REGISTERNAME # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= +final_path=/var/www/$app +test ! -e "$final_path" || ynh_die "This path already contains a folder" + # Check port availability -if [[ ! $(yunohost app checkport "$port") -eq 0 ]]; then +yunohost app checkport "$port" +if [[ ! $? -eq 0 ]]; then ynh_die "Port is not available" fi @@ -75,50 +79,63 @@ ynh_install_app_dependencies mumble-server #================================================= # mumble server conf.ini #================================================= -# TODO: clean this + +mkdir -p "$final_path" +ynh_app_setting_set "$app" final_path "$final_path" # Configuring with given settings -mumble_conf="/etc/mumble-server.ini" +mumble_conf="$final_path/mumble-server.ini" cp ../conf/mumble-server.ini "$mumble_conf" +ynh_replace_string "__FINALPATH__" "$final_path" "$mumble_conf" +ynh_replace_string "__APP__" "$app" "$mumble_conf" ynh_replace_string "__WELCOME__" "$welcometext" "$mumble_conf" ynh_replace_string "__PORT__" "$port" "$mumble_conf" ynh_replace_string "__SRV_PWD__" "$server_password" "$mumble_conf" ynh_replace_string "__REGISTER__" "$registerName" "$mumble_conf" +#================================================= +# SETUP SYSTEMD +#================================================= + +# Create a dedicated systemd config +ynh_add_systemd_config + #================================================= # STORE THE CHECKSUM OF THE CONFIG FILE #================================================= -# TODO: add this checksum step ynh_store_file_checksum "$mumble_conf" #================================================= # Start services #================================================= -# Start Mumble server -/etc/init.d/mumble-server start - -# Set super-user password +mkdir -p /var/run/mumble-server/ murmurd -ini "$mumble_conf" -supw "$su_passwd" -# Restart Mumble server -/etc/init.d/mumble-server restart - #================================================= # GENERIC FINALIZATION #================================================= # SECURE FILES AND DIRECTORIES #================================================= -chmod 660 "$mumble_conf" -chown :mumble-server "$mumble_conf" +chmod -R 770 "$final_path" +chown -R :mumble-server "$final_path" + +#================================================= +# Disable default server installed by Debian's package +#================================================= + +systemctl stop mumble-server +systemctl disable mumble-server #================================================= # ADVERTISE SERVICE IN ADMIN PANEL #================================================= # Add Mumble as a YunoHost service -yunohost service add mumble-server -l /var/log/mumble-server/mumble-server.log +yunohost service add "$app" -l "/var/log/mumble-server/$app.log" + +systemctl restart "$app"