mirror of
https://github.com/YunoHost-Apps/mumbleserver_ynh.git
synced 2024-09-03 19:46:03 +02:00
Use helpers and shellcheck
This commit is contained in:
parent
c736ccf103
commit
f6368ee675
2 changed files with 26 additions and 25 deletions
|
@ -85,17 +85,17 @@ pidfile=/var/run/mumble-server/mumble-server.pid
|
||||||
# configure it here than through D-Bus or Ice.
|
# configure it here than through D-Bus or Ice.
|
||||||
#
|
#
|
||||||
# Welcome message sent to clients when they connect.
|
# Welcome message sent to clients when they connect.
|
||||||
welcometext="<br />Welcome to this server running <b>Murmur</b>.<br />Enjoy your stay!<br />"
|
welcometext="__WELCOME__"
|
||||||
|
|
||||||
# Port to bind TCP and UDP sockets to.
|
# Port to bind TCP and UDP sockets to.
|
||||||
port=64738
|
port=__PORT__
|
||||||
|
|
||||||
# Specific IP or hostname to bind to.
|
# Specific IP or hostname to bind to.
|
||||||
# If this is left blank (default), Murmur will bind to all available addresses.
|
# If this is left blank (default), Murmur will bind to all available addresses.
|
||||||
#host=
|
#host=
|
||||||
|
|
||||||
# Password to join server.
|
# Password to join server.
|
||||||
serverpassword=
|
serverpassword=__SRV_PWD__
|
||||||
|
|
||||||
# Maximum bandwidth (in bits per second) clients are allowed
|
# Maximum bandwidth (in bits per second) clients are allowed
|
||||||
# to send speech at.
|
# to send speech at.
|
||||||
|
@ -143,7 +143,7 @@ users=100
|
||||||
# addresses.
|
# addresses.
|
||||||
# Only uncomment the 'registerName' parameter if you wish to give your "Root" channel a custom name.
|
# Only uncomment the 'registerName' parameter if you wish to give your "Root" channel a custom name.
|
||||||
#
|
#
|
||||||
#registerName=Mumble Server
|
registerName=__REGISTER__
|
||||||
#registerPassword=secret
|
#registerPassword=secret
|
||||||
#registerUrl=http://mumble.sourceforge.net/
|
#registerUrl=http://mumble.sourceforge.net/
|
||||||
#registerHostname=
|
#registerHostname=
|
||||||
|
|
|
@ -33,14 +33,14 @@ registerName=$YNH_APP_ARG_REGISTERNAME
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Check port availability
|
# Check port availability
|
||||||
yunohost app checkport $port
|
|
||||||
if [[ ! $? -eq 0 ]]; then
|
if [[ ! $(yunohost app checkport "$port") -eq 0 ]]; then
|
||||||
ynh_die
|
ynh_die "Port is not available"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if su_password is not empty
|
# Check if su_password is not empty
|
||||||
if [[ -z "$su_passwd" ]]; then
|
if [[ -z "$su_passwd" ]]; then
|
||||||
ynh_die
|
ynh_die "Password is not set"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -48,8 +48,11 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Save app settings
|
# Save app settings
|
||||||
ynh_app_setting_set $app port "$port"
|
ynh_app_setting_set "$app" port "$port"
|
||||||
|
ynh_app_setting_set "$app" server_password "$server_password"
|
||||||
|
ynh_app_setting_set "$app" su_passwd "$su_passwd"
|
||||||
|
ynh_app_setting_set "$app" welcometext "$welcometext"
|
||||||
|
ynh_app_setting_set "$app" registerName "$registerName"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
|
@ -58,16 +61,14 @@ ynh_app_setting_set $app port "$port"
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Open port in firewall
|
# Open port in firewall
|
||||||
yunohost firewall allow Both $port > /dev/null 2>&1
|
yunohost firewall allow Both "$port"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Install Mumble Debian package via apt
|
# Install Mumble Debian package via apt
|
||||||
apt update > /dev/null 2>&1
|
ynh_install_app_dependencies mumble-server
|
||||||
apt install -y mumble-server > /dev/null 2>&1
|
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# SPECIFIC SETUP
|
||||||
|
@ -77,21 +78,21 @@ apt install -y mumble-server > /dev/null 2>&1
|
||||||
# TODO: clean this
|
# TODO: clean this
|
||||||
|
|
||||||
# Configuring with given settings
|
# Configuring with given settings
|
||||||
mumble_conf="../conf/mumble-server.ini"
|
|
||||||
sed -i "s/welcometext=.*/welcometext=$welcometext/" $mumble_conf
|
|
||||||
sed -i "s/port=.*/port=$port/" $mumble_conf
|
|
||||||
sed -i "s/serverpassword=.*/serverpassword=$server_password/" $mumble_conf
|
|
||||||
sed -i "s/#registerName=.*/registerName=$registerName/" $mumble_conf
|
|
||||||
|
|
||||||
# Copying conf file
|
|
||||||
mumble_conf="/etc/mumble-server.ini"
|
mumble_conf="/etc/mumble-server.ini"
|
||||||
cp ../conf/mumble-server.ini $mumble_conf
|
|
||||||
|
cp ../conf/mumble-server.ini "$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"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE THE CHECKSUM OF THE CONFIG FILE
|
# STORE THE CHECKSUM OF THE CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# TODO: add this checksum step
|
# TODO: add this checksum step
|
||||||
|
ynh_store_file_checksum "$mumble_conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# Start services
|
# Start services
|
||||||
|
@ -101,7 +102,7 @@ cp ../conf/mumble-server.ini $mumble_conf
|
||||||
/etc/init.d/mumble-server start
|
/etc/init.d/mumble-server start
|
||||||
|
|
||||||
# Set super-user password
|
# Set super-user password
|
||||||
murmurd -ini $mumble_conf -supw $su_passwd
|
murmurd -ini "$mumble_conf" -supw "$su_passwd"
|
||||||
|
|
||||||
# Restart Mumble server
|
# Restart Mumble server
|
||||||
/etc/init.d/mumble-server restart
|
/etc/init.d/mumble-server restart
|
||||||
|
@ -112,8 +113,8 @@ murmurd -ini $mumble_conf -supw $su_passwd
|
||||||
# SECURE FILES AND DIRECTORIES
|
# SECURE FILES AND DIRECTORIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
chmod 660 $mumble_conf
|
chmod 660 "$mumble_conf"
|
||||||
chown :mumble-server $mumble_conf
|
chown :mumble-server "$mumble_conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||||
|
|
Loading…
Add table
Reference in a new issue