2018-06-21 22:15:54 +00:00
|
|
|
#/bin/sh
|
2018-06-21 21:29:49 +00:00
|
|
|
|
|
|
|
if [ -f buildtools/closure-compiler.jar ]
|
|
|
|
then
|
2018-07-11 00:01:04 +00:00
|
|
|
echo "Minifying javascript"
|
2018-06-21 21:56:39 +00:00
|
|
|
[ htdocs/js/player.js -nt htdocs/js/player.min.js ] && \
|
|
|
|
java -jar buildtools/closure-compiler.jar htdocs/js/player.js > htdocs/js/player.min.js
|
|
|
|
[ htdocs/js/mpd.js -nt htdocs/js/mpd.min.js ] && \
|
|
|
|
java -jar buildtools/closure-compiler.jar htdocs/js/mpd.js > htdocs/js/mpd.min.js
|
2018-07-16 17:33:20 +00:00
|
|
|
[ htdocs/sw.js -nt htdocs/sw.min.js ] && \
|
|
|
|
java -jar buildtools/closure-compiler.jar htdocs/sw.js > htdocs/sw.min.js
|
2018-06-21 21:56:39 +00:00
|
|
|
else
|
2018-07-11 00:01:04 +00:00
|
|
|
echo "buildtools/closure-compiler.jar not found, using non-minified files"
|
2018-06-21 22:15:54 +00:00
|
|
|
[ htdocs/js/player.js -nt htdocs/js/player.min.js ] && \
|
|
|
|
cp htdocs/js/player.js htdocs/js/player.min.js
|
|
|
|
[ htdocs/js/mpd.js -nt htdocs/js/mpd.min.js ] && \
|
|
|
|
cp htdocs/js/mpd.js htdocs/js/mpd.min.js
|
2018-07-16 17:33:20 +00:00
|
|
|
[ htdocs/sw.js -nt htdocs/sw.min.js ] && \
|
|
|
|
cp htdocs/sw.js htdocs/sw.min.js
|
2018-06-21 21:29:49 +00:00
|
|
|
fi
|
2018-07-11 00:01:04 +00:00
|
|
|
|
2018-06-21 21:29:49 +00:00
|
|
|
if [ -f buildtools/closure-stylesheets.jar ]
|
2018-07-11 00:01:04 +00:00
|
|
|
then
|
|
|
|
echo "Minifying stylesheets"
|
2018-06-21 21:56:39 +00:00
|
|
|
[ htdocs/css/mpd.css -nt htdocs/css/mpd.min.css ] && \
|
|
|
|
java -jar buildtools/closure-stylesheets.jar htdocs/css/mpd.css > htdocs/css/mpd.min.css
|
|
|
|
else
|
2018-07-11 00:01:04 +00:00
|
|
|
echo "buildtools/closure-stylesheets.jar not found, using non-minified files"
|
2018-06-21 22:15:54 +00:00
|
|
|
[ htdocs/css/mpd.css -nt htdocs/css/mpd.min.css ] && \
|
|
|
|
cp htdocs/css/mpd.css htdocs/css/mpd.min.css
|
2018-06-21 21:29:49 +00:00
|
|
|
fi
|
|
|
|
|
2018-07-11 00:01:04 +00:00
|
|
|
echo "Compiling and installing mympd"
|
2018-06-21 21:29:49 +00:00
|
|
|
[ -d release ] || mkdir release
|
|
|
|
cd release
|
|
|
|
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_BUILD_TYPE=RELEASE ..
|
|
|
|
make
|
2018-06-21 22:15:54 +00:00
|
|
|
sudo make install
|
|
|
|
cd ..
|
|
|
|
|
2018-07-11 00:01:04 +00:00
|
|
|
echo "Replacing javascript and stylesheets with minified files"
|
2018-06-21 22:15:54 +00:00
|
|
|
sudo sed -i -e 's/mpd\.css/mpd\.min\.css/' -e 's/mpd\.js/mpd\.min\.js/' /usr/share/mympd/htdocs/index.html
|
|
|
|
sudo sed -i -e 's/mpd\.css/mpd\.min\.css/' -e 's/player\.js/player\.min\.js/' /usr/share/mympd/htdocs/player.html
|
2018-07-16 17:33:20 +00:00
|
|
|
sudo sed -i -e 's/mpd\.css/mpd\.min\.css/' -e 's/mpd\.js/mpd\.min\.js/' -e 's/player\.js/player\.min\.js/' /usr/share/mympd/htdocs/sw.min.js
|
2018-06-21 22:15:54 +00:00
|
|
|
|
2018-07-11 00:01:04 +00:00
|
|
|
echo "Fixing ownership of /var/lib/mympd"
|
2018-06-21 22:15:54 +00:00
|
|
|
sudo chown nobody /var/lib/mympd
|
|
|
|
|
2018-07-11 00:01:04 +00:00
|
|
|
echo "Trying to link musicdir to library"
|
|
|
|
if [ -f /etc/mpd.conf ]
|
|
|
|
then
|
|
|
|
LIBRARY=$(grep music /etc/mpd.conf | awk {'print $2'})
|
2018-07-15 22:26:59 +00:00
|
|
|
[ "$LIBRARY" != "" ] && [ ! -e /usr/share/mympd/htdocs/library ] && ln -s $LIBRARY /usr/share/mympd/htdocs/library
|
2018-07-11 00:01:04 +00:00
|
|
|
else
|
|
|
|
echo "/etc/mpd.conf not found, you must link your musicdir manually to /usr/share/mympd/htdocs/library"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Installing systemd service"
|
|
|
|
if [ -d /etc/systemd/system ]
|
|
|
|
then
|
|
|
|
if [ contrib/mympd.service -nt /etc/systemd/system/mympd.service ]
|
|
|
|
then
|
|
|
|
sudo cp -v contrib/mympd.service /etc/systemd/system/
|
|
|
|
systemctl daemon-reload
|
|
|
|
fi
|
|
|
|
systemctl enable mympd
|
|
|
|
fi
|
2018-06-21 22:15:54 +00:00
|
|
|
|
2018-07-11 00:01:04 +00:00
|
|
|
if [ -d /etc/mympd/ssl ]
|
|
|
|
then
|
|
|
|
echo "Certificates already created"
|
|
|
|
else
|
|
|
|
echo "Creating certificates"
|
|
|
|
contrib/crcert.sh
|
|
|
|
fi
|
2018-06-21 22:15:54 +00:00
|
|
|
|
|
|
|
echo "myMPD installed"
|
2018-07-15 22:26:59 +00:00
|
|
|
echo "Edit /etc/mympd/options before starting mympd"
|