postinst is in forked-daapd 0.19gcd-3build1.
This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | #!/bin/sh
set -e
DBDIR="/var/cache/forked-daapd"
DBDEFAULT="songs3.db"
do_db_backup ()
{
[ -f "$DBDIR/$DBDEFAULT" ] || return 0
DBBAK="$DBDIR/backups"
if [ ! -d "$DBBAK" ]; then
mkdir -p "$DBBAK"
fi
DBBAK="$DBBAK/$DBDEFAULT.$1"
[ -e "$DBBAK" ] && return 0
cp "$DBDIR/$DBDEFAULT" "$DBBAK"
}
if [ "$1" = "configure" ] || [ "$1" = "reconfigure" ]; then
if ! getent passwd daapd > /dev/null 2>&1; then
adduser --quiet --system --no-create-home --home /var/cache/forked-daapd daapd
fi
if ! dpkg-statoverride --list /var/cache/forked-daapd > /dev/null 2>&1; then
dpkg-statoverride --update --add daapd root 0755 /var/cache/forked-daapd
fi
# Backup database before a database upgrade
DBPATH=$(awk '/^[\t ]+db_path[\t ]*=/{ $0 = $3; gsub(/^[\t "]|[\t "]$/, ""); print};' /etc/forked-daapd.conf)
if [ -z "$DBPATH" ] || [ "$DBPATH" = "$DBDIR/$DBDEFAULT" ]; then
# v0.14: schema v11 -> v12
if dpkg --compare-versions "$2" lt-nl "0.14"; then
do_db_backup prev12
fi
else
echo "Database not in the default location; no automatic backup made"
fi
fi
# Automatically added by dh_installinit
if [ -x "/etc/init.d/forked-daapd" ] || [ -e "/etc/init/forked-daapd.conf" ]; then
if [ ! -e "/etc/init/forked-daapd.conf" ]; then
update-rc.d forked-daapd defaults 25 >/dev/null
fi
invoke-rc.d forked-daapd start || exit $?
fi
# End automatically added section
|