preinst is in python-moinmoin 1.9.3-1ubuntu2.
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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | #!/bin/sh
set -e
rename_conffile_prepare () {
# syntax: rename_conffile_prepare old_name new_name official_md5sum ...
#
# Check a conffile "old_name" against a list of canonical MD5 checksums. If
# the file's current MD5 checksum matches one of the "official_md5sum"
# operands provided, then rename the conffile to "new_file" and create a
# flag file indicating that we have done so.
#
# We leave the flag file around until the package is configured so that we
# can roll this operation back if package installation fails.
#
# Call this function from a preinst script in the event $1 is "upgrade" or
# "install" and verify $2 to ensure the package is being upgraded from a
# version (or installed over a version removed-but-not-purged) prior to the
# one in which the conffile was renamed.
#local conffile current_checksum
# Validate arguments.
if [ $# -lt 3 ]; then
echo "$0: usage error: rename_conffile_prepare() called with wrong number of arguments (expected at least 3, got $#)." >&2
exit 2
fi
_old_conffile="$1"
shift
_new_conffile="$1"
shift
# We only have something to do if the _old_conffile exists and the
# _new_conffile doesn't.
if [ -e "$_old_conffile" ] && ! [ -e "$_new_conffile" ]; then
# Calculate _old_conffile's checksum.
_current_checksum=$(md5sum < "$_old_conffile" | sed 's/[[:space:]].*//')
# Compare it to each supplied checksum.
while [ -n "$1" ]; do
_old_checksum="$1"
shift
_old_pkgver="$1"
shift
if [ "$_current_checksum" = "$_old_checksum" ]; then
# We found a match; rename the conffile and stop looking.
echo "Found old conffile (version $_old_pkgver): Renaming from $_old_conffile to $_new_conffile." >&2
mv "$_old_conffile" "$_new_conffile" \
> "$_old_conffile.python-moinmoin.moved"
break
fi
done
fi
}
if [ "$1" = "install" ] || [ "$1" = "upgrade" ]; then
if dpkg --compare-versions "$2" lt "1.5.2"; then
rename_conffile_prepare \
/etc/moin/moinmaster.py /etc/moin/mywiki.py \
0691ca2ee1a91d81e6010f92e5eb4e62 1.3.4-3 \
53921d5995c4f8f7ee2dc75868837248 'unknown' \
342a585c1a0255e8cbfaca607d068276 1.4.99+1.5.0rc1-1
fi
fi
|