1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mumbleserver_ynh.git synced 2024-09-03 19:46:03 +02:00

Rewrite installation

This commit is contained in:
Jean-Baptiste Holcroft 2017-11-29 23:33:21 +01:00
parent f6368ee675
commit 3d4cf111b3
5 changed files with 52 additions and 19 deletions

View file

@ -4,7 +4,7 @@
server_login_password="super_secret_password" (PASSWORD) server_login_password="super_secret_password" (PASSWORD)
password="super_secret_password" password="super_secret_password"
welcometext="Welcome to my mumble server" welcometext="Welcome to my mumble server"
port="64738" (PORT) port=64738 (PORT)
registername="Root" registername="Root"
; Checks ; Checks
pkg_linter=1 pkg_linter=1

View file

@ -13,7 +13,7 @@
# Path to database. If blank, will search for # Path to database. If blank, will search for
# murmur.sqlite in default locations or create it if not found. # 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 # 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. # 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 # logs to the file 'murmur.log'. If you leave this field blank
# on Unix-like systems, Murmur will force itself into foreground # on Unix-like systems, Murmur will force itself into foreground
# mode which logs to the console. # 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 # If set, Murmur will write its process ID to this file
# when running in daemon mode (when the -fg flag is not # when running in daemon mode (when the -fg flag is not
# specified on the command line). Only available on # specified on the command line). Only available on
# Unix-like systems. # 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. # The below will be used as defaults for new configured servers.
# If you're just running one server (the default), it's easier to # If you're just running one server (the default), it's easier to

15
conf/systemd.service Normal file
View file

@ -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

View file

@ -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." "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", "url": "https://mumble.info",
"license": "free", "license": "BSD-3-Clause",
"maintainer": { "maintainer": {
"name": "Moul", "name": "Moul",
"email": "moul@moul.re" "email": "moul@moul.re"
@ -15,6 +15,7 @@
"requirements": { "requirements": {
"yunohost": ">> 2.4.0" "yunohost": ">> 2.4.0"
}, },
"version": "1.2.8-1",
"multi_instance": false, "multi_instance": false,
"services": [ "services": [
], ],

View file

@ -32,9 +32,13 @@ registerName=$YNH_APP_ARG_REGISTERNAME
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # 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 # 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" ynh_die "Port is not available"
fi fi
@ -75,50 +79,63 @@ ynh_install_app_dependencies mumble-server
#================================================= #=================================================
# mumble server conf.ini # mumble server conf.ini
#================================================= #=================================================
# TODO: clean this
mkdir -p "$final_path"
ynh_app_setting_set "$app" final_path "$final_path"
# Configuring with given settings # Configuring with given settings
mumble_conf="/etc/mumble-server.ini" mumble_conf="$final_path/mumble-server.ini"
cp ../conf/mumble-server.ini "$mumble_conf" 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 "__WELCOME__" "$welcometext" "$mumble_conf"
ynh_replace_string "__PORT__" "$port" "$mumble_conf" ynh_replace_string "__PORT__" "$port" "$mumble_conf"
ynh_replace_string "__SRV_PWD__" "$server_password" "$mumble_conf" ynh_replace_string "__SRV_PWD__" "$server_password" "$mumble_conf"
ynh_replace_string "__REGISTER__" "$registerName" "$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 # STORE THE CHECKSUM OF THE CONFIG FILE
#================================================= #=================================================
# TODO: add this checksum step
ynh_store_file_checksum "$mumble_conf" ynh_store_file_checksum "$mumble_conf"
#================================================= #=================================================
# Start services # Start services
#================================================= #=================================================
# Start Mumble server mkdir -p /var/run/mumble-server/
/etc/init.d/mumble-server start
# Set super-user password
murmurd -ini "$mumble_conf" -supw "$su_passwd" murmurd -ini "$mumble_conf" -supw "$su_passwd"
# Restart Mumble server
/etc/init.d/mumble-server restart
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================
# SECURE FILES AND DIRECTORIES # SECURE FILES AND DIRECTORIES
#================================================= #=================================================
chmod 660 "$mumble_conf" chmod -R 770 "$final_path"
chown :mumble-server "$mumble_conf" 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 # ADVERTISE SERVICE IN ADMIN PANEL
#================================================= #=================================================
# Add Mumble as a YunoHost service # 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"