2018-09-06 22:10:40 +00:00
|
|
|
#/bin/bash
|
|
|
|
|
|
|
|
echo "Fixing ownership of /var/lib/mympd"
|
|
|
|
getent group mympd > /dev/null
|
|
|
|
[ "$?" = "2" ] && groupadd mympd
|
|
|
|
getent passwd mympd > /dev/null
|
2018-09-06 23:00:00 +00:00
|
|
|
[ "$?" = "2" ] && useradd mympd -g mympd-d /var/lib/mympd -s /usr/sbin/nologin
|
2018-09-06 22:10:40 +00:00
|
|
|
|
|
|
|
chown -R mympd.mympd /var/lib/mympd
|
|
|
|
|
|
|
|
echo "Trying to link musicdir to library"
|
|
|
|
if [ -f /etc/mpd.conf ]
|
|
|
|
then
|
|
|
|
LIBRARY=$(grep ^music_directory /etc/mpd.conf | awk {'print $2'} | sed -e 's/"//g')
|
|
|
|
[ "$LIBRARY" != "" ] && [ ! -e /usr/share/mympd/htdocs/library ] && ln -s "$LIBRARY" /usr/share/mympd/htdocs/library
|
|
|
|
else
|
|
|
|
echo "/etc/mpd.conf not found, you must link your music_directory manually to /usr/share/mympd/htdocs/library"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d /usr/lib/systemd/ ]
|
|
|
|
then
|
|
|
|
echo "Installing systemd service"
|
|
|
|
[ -d /usr/lib/systemd/system ] || mkdir /usr/lib/systemd/system
|
|
|
|
if [ contrib/mympd.service -nt /usr/lib/systemd/system/mympd.service ]
|
|
|
|
then
|
|
|
|
cp contrib/mympd.service /usr/lib/systemd/system/
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d /etc/mympd/ssl ]
|
|
|
|
then
|
|
|
|
echo "Certificates already created"
|
|
|
|
else
|
|
|
|
echo "Creating certificates"
|
|
|
|
sudo contrib/crcert.sh
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "myMPD installed"
|
|
|
|
echo "Edit /etc/mympd/mympd.conf before starting myMPD"
|