PKGBUILDs/aur/sickbeard-git/sickbeard.install
Kevin Mihelich e37cdd8d55 aur updates
2013-01-12 00:24:04 +00:00

60 lines
2.5 KiB
Text

## arg 1: the new package version
post_install() {
if grep -q "^sickbeard" /etc/group &> /dev/null ; then
groupmod -n sickbeard sickbeard &> /dev/null
else
groupadd -r sickbeard &> /dev/null
fi
if grep -q "^sickbeard:" /etc/passwd 2> /dev/null ; then
usermod -s /bin/false -c "Sickbeard user" -d /opt/sickbeard -g sickbeard sickbeard &> /dev/null
else
useradd -s /bin/false -c "Sickbeard user" -d /opt/sickbeard -g sickbeard -r sickbeard &> /dev/null
fi
groupadd sickbeard &> /dev/null
useradd -g sickbeard -d /opt/sickbeard -s /bin/false sickbeard &> /dev/null
chgrp -R sickbeard /opt/sickbeard
# sed -i 's/^if isinstance(sys.version_info, tuple):$/if isinstance(sys.version_info[:], tuple):/g' "/usr/lib/python2.7/site-packages/Cheetah/Template.py"
# Create a directory in /run if it does not exist
if [ ! -d /run/sickbeard ]; then
mkdir /run/sickbeard
chown sickbeard:sickbeard /run/sickbeard
chmod 775 /run/sickbeard
fi
echo "You can now run sickbeard as a user service with 'systemctl --user start sickbeard'."
echo "To make this work, first run 'mkdir ~/.sickbeard'. This will run sickbeard as your user."
echo "The system service will run it as the sickbeard user."
echo "If you have a previous install and want to keep the same show database, cache, etc., you can"
echo "run 'cp -r /opt/sickbeard/{Logs,cache,cache.db,config.ini,sickbeard.db} ~/.sickbeard'."
}
## arg 1: the new package version
## arg 2: the old package version
post_upgrade() {
chgrp -R sickbeard /opt/sickbeard
sed -i 's/^if isinstance(sys.version_info, tuple):$/if isinstance(sys.version_info[:], tuple):/g' "/usr/lib/python2.7/site-packages/Cheetah/Template.py"
# Create a directory in /run if it does not exist
if [ ! -d /run/sickbeard ]; then
mkdir /run/sickbeard
chown sickbeard:sickbeard /run/sickbeard
chmod 775 /run/sickbeard
fi
echo "You can now run sickbeard as a user service with 'systemctl --user start sickbeard'."
echo "To make this work, first run 'mkdir ~/.sickbeard'. This will run sickbeard as your user."
echo "The system service will run it as the sickbeard user."
echo "If you have a previous install and want to keep the same show database, cache, etc., you can"
echo "run 'cp -r /opt/sickbeard/{Logs,cache,cache.db,config.ini,sickbeard.db} ~/.sickbeard'."
}
## arg 1: the old package version
pre_remove() {
userdel sickbeard &> /dev/null
}
post_remove() {
echo 'Some files have not been removed because they are created by sickbeard itself, e.g. the show database.'
}