# arg 1: the new package version
post_install() {
update-desktop-database -q
mv /usr/share/mythtv/is.xml /tmp/is.xml.tmp
sed -e '/\#Miro/,/\#Miro/d' < /tmp/is.xml.tmp > /usr/share/mythtv/is.xml
mv /usr/share/mythtv/is.xml /tmp
grep -v -e /mythmenu /tmp/is.xml > /tmp/is.xml.tmp
echo "" >> /tmp/is.xml.tmp
echo " " >> /tmp/is.xml.tmp
echo "" >> /tmp/is.xml.tmp
echo "" >> /tmp/is.xml.tmp
echo "" >> /tmp/is.xml.tmp
mv /tmp/is.xml.tmp /usr/share/mythtv/is.xml
if [ -d /myth/democracy ]
then
ln -s /myth/democracy /home/mythtv/.miro
ln -s /myth/miro/Movies /myth/video/Miro
exit 1
else
if [ -d /myth/miro ]
then
ln -s /myth/miro /home/mythtv/.miro
ln -s /myth/miro/Movies /myth/video/Miro
exit 1
else
if [ ! -d /myth/miro -o /myth/democracy ]
then
mkdir -p /myth/miro/Movies
ln -s /myth/miro /home/mythtv/.miro
ln -s /myth/miro/Movies /home/mythtv/Movies
ln -s /myth/miro/Movies /myth/video/Miro
fi
fi
fi
chown -R mythtv.mythtv /myth/miro
}
post_update() {
mv /usr/share/mythtv/is.xml /tmp/is.xml.tmp
sed -e '/\#Miro/,/\#Miro/d' < /tmp/is.xml.tmp > /usr/share/mythtv/is.xml
mv /usr/share/mythtv/is.xml /tmp/is.xml.tmp
sed -e '/\#Miro/,/\#Miro/d' < /tmp/is.xml.tmp > /usr/share/mythtv/is.xml
mv /usr/share/mythtv/is.xml /tmp
grep -v -e /mythmenu /tmp/is.xml > /tmp/is.xml.tmp
echo "" >> /tmp/is.xml.tmp
echo " " >> /tmp/is.xml.tmp
echo "" >> /tmp/is.xml.tmp
echo "" >> /tmp/is.xml.tmp
echo "" >> /tmp/is.xml.tmp
mv /tmp/is.xml.tmp /usr/share/mythtv/is.xml
}
post_remove() {
update-desktop-database -q
rm -fr /home/mythtv/.miro /myth/video/Miro /myth/miro /myth/democracy
mv /usr/share/mythtv/is.xml /tmp/is.xml.tmp
sed -e '/\#Miro/,/\#Miro/d' < /tmp/is.xml.tmp > /usr/share/mythtv/is.xml
}
op=$1
shift
$op $*