#!/bin/bash
# Copyright (C) 2008 - 2015 x-stream.org
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#

systemctl stop squeezeboxserver.service

rpm -e --nodeps logitechmediaserver
rpm -e --nodeps logitechmediaserver-CPAN
rpm -e --nodeps logitechmediaserver-vendor

rm -rf /var/lib/squeezeboxserver
rm -rf /usr/share/squeezeboxserver
rm -rf /etc/squeezeboxserver
rm -rf /var/log/squeezeboxserver

dnf clean all
rm -rf /var/cache/yum/*
rm -rf /var/lib/yum/yumdb/*
dnf -y --skip-broken install logitechmediaserver

systemctl stop squeezeboxserver.service

echo "ignoreInImageScan:" >> /etc/squeezeboxserver/server.conf
echo "- /storage/music/flac" >> /etc/squeezeboxserver/server.conf
echo "ignoreInVideoScan:" >> /etc/squeezeboxserver/server.conf
echo "- /storage/music/flac" >> /etc/squeezeboxserver/server.conf
echo "mediadirs:" >> /etc/squeezeboxserver/server.conf
echo "- /storage/music/flac" >> /etc/squeezeboxserver/server.conf
echo "mDNSname:" >> /etc/squeezeboxserver/server.conf
echo "playlistdir: /storage/music/playlist" >> /etc/squeezeboxserver/server.conf
echo "wizardDone: 1" >> /etc/squeezeboxserver/server.conf

systemctl start squeezeboxserver.service