preinst is in asterisk-prompt-fr-proformatique 20070706-1.4-2.
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 | #!/bin/sh
set -e
case "$1" in
upgrade)
if dpkg --compare-versions "$2" lt 20070706-1.4-1; then
# We are upgrading from a version that has the old
# symlinks and file locations.
for d in dictate digits letters phonetic; do
if [ -L "/usr/share/asterisk/sounds/${d}/fr" ] && \
[ "$(readlink "/usr/share/asterisk/sounds/${d}/fr")" = "../fr/${d}" ]; then
rm "/usr/share/asterisk/sounds/${d}/fr"
fi
done
elif dpkg --compare-versions "$2" lt 20070706-1.4-2; then
# We are upgrading from a version that may or may not have
# symlinks, and files in old or new location (because of
# how dpkg treats symlinks on upgrades).
# First, cleanup spurious empty directories some
# install/upgrade/purge scenarios leave behind.
for d in dictate digits letters phonetic; do
for e in "/usr/share/asterisk/sounds/${d}/fr" "/usr/share/asterisk/sounds/fr/${d}"; do
if ! [ -L "${e}" ] && [ -d "${e}" ]; then
rmdir --ignore-fail-on-non-empty "${e}"
fi
done
done
# Next, remove old symlinks if present and move files to
# their dpkg-known location.
for d in dictate digits letters phonetic; do
if [ -L "/usr/share/asterisk/sounds/${d}/fr" ] && \
[ "$(readlink "/usr/share/asterisk/sounds/${d}/fr")" = "../fr/${d}" ]; then
rm "/usr/share/asterisk/sounds/${d}/fr"
fi
if ! [ -e "/usr/share/asterisk/sounds/${d}/fr" ] && \
[ -d "/usr/share/asterisk/sounds/fr/${d}" ]; then
mv "/usr/share/asterisk/sounds/fr/${d}" "/usr/share/asterisk/sounds/${d}/fr"
fi
done
fi
;;
esac
exit 0
|