preinst is in sidedoor 0.2.1-1.
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 | #!/bin/sh
set -e
# sidedoor 0.1.0 (unreleased) had a symlink /var/lib/sidedoor/.ssh,
# which needs to be deleted to convert it to a directory.
# dpkg-maintscript-helper symlink_to_dir would also work,
# but is not supported on wheezy.
if dpkg --compare-versions "$2" lt 0.1.1~; then
[ ! -L /var/lib/sidedoor/.ssh ] || rm /var/lib/sidedoor/.ssh
fi
# sidedoor 0.1.1-1 had authorized_keys in /etc/sidedoor,
# which has been replaced by a symlink in the reverse direction.
# Move the old symlink target in preinst so that it is not overwritten
# by the symlink in the new package.
if dpkg --compare-versions "$2" lt 0.2~; then
authorized_keys=/etc/sidedoor/authorized_keys
if [ -s "$authorized_keys" -a ! -L "$authorized_keys" ]; then
echo "Moving $authorized_keys to /var/lib/sidedoor/.ssh/authorized_keys."
mkdir -p /var/lib/sidedoor/.ssh
mv "$authorized_keys" /var/lib/sidedoor/.ssh/authorized_keys.old
fi
fi
|