Commit def04ebc authored by anonym's avatar anonym

Add the needed excessive quoting,

It should not matter in these cases, but let's follow shell scripting
best practices.
parent aa4e6224
#!/bin/sh
PERSISTENCE=/live/persistence/TailsData_unlocked
MUMBLE=${PERSISTENCE}/mumble-server
MUMBLE="${PERSISTENCE}/mumble-server"
ONION=/var/lib/tor/mumble-server
CONFIG=/etc/mumble-server.ini
......@@ -17,18 +17,18 @@ apt-get --yes --quiet --quiet install mumble-server
# Generate persistent password for Mumble server
install -o mumble-server -g mumble-server -m 700 -d ${MUMBLE}
[ -f ${MUMBLE}/password ] || pwgen 32 1 > ${MUMBLE}/password
PASSWORD=$(cat ${MUMBLE}/password)
install -o mumble-server -g mumble-server -m 700 -d "${MUMBLE}"
[ -f "${MUMBLE}/password" ] || pwgen 32 1 > "${MUMBLE}/password"
PASSWORD="$(cat "${MUMBLE}/password")"
# Configure mumble-server
sed -i "s%^database=/var/lib/mumble-server/mumble-server.sqlite%database=${MUMBLE}/mumble-server.sqlite%" ${CONFIG}
sed -i "s%^serverpassword=$%serverpassword=${PASSWORD}%" ${CONFIG}
sed -i "s%^database=/var/lib/mumble-server/mumble-server.sqlite%database=${MUMBLE}/mumble-server.sqlite%" "${CONFIG}"
sed -i "s%^serverpassword=$%serverpassword=${PASSWORD}%" "${CONFIG}"
if [ -n "${MUMBLE_LISTEN_ON_LAN}" ]; then
sed -i "s%^host=%#host=%" ${CONFIG}
sed -i "s%^host=%#host=%" "${CONFIG}"
else
sed -i "s%^#host=$%host=127.0.0.1%" ${CONFIG}
sed -i "s%^#host=$%host=127.0.0.1%" "${CONFIG}"
fi
# Extract fingerprint from SQLite database
......@@ -38,15 +38,15 @@ apt-get --yes --quiet --quiet install sqlite3
systemctl start mumble-server # To generate the database
systemctl stop mumble-server # To unlock database
FINGERPRINT=$(sqlite3 ${MUMBLE}/mumble-server.sqlite "select value from config where key = 'certificate';" | openssl x509 -fingerprint | head -n 1 | cut -d '=' -f 2)
FINGERPRINT="$(sqlite3 "${MUMBLE}/mumble-server.sqlite" "select value from config where key = 'certificate';" | openssl x509 -fingerprint | head -n 1 | cut -d '=' -f 2)"
# Configure Tor hidden service
install -o debian-tor -g debian-tor -m 700 -d /var/lib/tor/mumble-server
install -o debian-tor -g debian-tor -m 700 -d ${PERSISTENCE}/tor
install -o debian-tor -g debian-tor -m 700 -d ${PERSISTENCE}/tor/mumble-server
install -o debian-tor -g debian-tor -m 700 -d "${PERSISTENCE}/tor"
install -o debian-tor -g debian-tor -m 700 -d "${PERSISTENCE}/tor/mumble-server"
grep --quiet "^/dev/mapper/TailsData_unlocked ${ONION}" /proc/mounts || mount --bind ${PERSISTENCE}/tor/mumble-server ${ONION}
grep --quiet "^/dev/mapper/TailsData_unlocked ${ONION}" /proc/mounts || mount --bind "${PERSISTENCE}/tor/mumble-server" "${ONION}"
grep --quiet "^HiddenServiceDir ${ONION}$" /etc/tor/torrc || echo "HiddenServiceDir ${ONION}" >> /etc/tor/torrc
grep --quiet "^HiddenServicePort 64738$" /etc/tor/torrc || echo "HiddenServicePort 64738" >> /etc/tor/torrc
......@@ -55,8 +55,8 @@ grep --quiet "^HiddenServicePort 64738$" /etc/tor/torrc || echo "HiddenServicePo
systemctl start mumble-server
systemctl reload tor@default
[ -e "${ONION}/hostname" ] || inotifywait -e create ${ONION}
HOSTNAME=$(cat ${ONION}/hostname)
[ -e "${ONION}/hostname" ] || inotifywait -e create "${ONION}"
HOSTNAME="$(cat "${ONION}/hostname")"
# Drop previous mumble-server firewall exceptions
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment