preinst is in diaspora-installer 0.5.7.1+debian2.
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 | #! /bin/sh
set -e
diaspora_home=/usr/share/diaspora
# Fix bin symlink set by earlier versions
if test -L ${diaspora_home}/bin
then
rm -rf ${diaspora_home}/bin
fi
# Backup the previous version
# Just keep the config and vendor/bundle
backup() {
cp -r ${diaspora_home}/config ${diaspora_home}-config
cp -r ${diaspora_home}/vendor/bundle ${diaspora_home}-vendor-bundle
cp -r ${diaspora_home}/.bundle ${diaspora_home}.bundle
mv ${diaspora_home} ${diaspora_home}-backup.`openssl rand -hex 4`
mkdir ${diaspora_home}
mkdir ${diaspora_home}/vendor
mv ${diaspora_home}-config ${diaspora_home}/config
mv ${diaspora_home}-vendor-bundle ${diaspora_home}/vendor/bundle
mv ${diaspora_home}.bundle ${diaspora_home}/.bundle
chown ${diaspora_user}: -R ${diaspora_home}
}
case "$1" in
upgrade)
echo "Stopping diaspora..."
invoke-rc.d diaspora stop
echo "Making a backup of ${diaspora_home}..."
backup || true
;;
abort-upgrade|install)
;;
*)
echo "preinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
exit 0
|