postinst is in etckeeper 1.18.2-1ubuntu1.
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 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | #!/bin/sh
set -e
# source confmodule to ensure templates are loaded
. /usr/share/debconf/confmodule
# Automatically added by dhpython:
if which pycompile >/dev/null 2>&1; then
pycompile -p etckeeper
fi
# End automatically added section
# Move a conffile without triggering a dpkg question
mv_conffile() {
OLDCONFFILE="$1"
NEWCONFFILE="$2"
if [ -e "$OLDCONFFILE" ]; then
echo "Preserving user changes to $NEWCONFFILE ..."
mv -f "$NEWCONFFILE" "$NEWCONFFILE".dpkg-new
mv -f "$OLDCONFFILE" "$NEWCONFFILE"
fi
}
case "$1" in
configure)
if dpkg --compare-versions "$2" le "0.7"; then
if [ -d /etc/etckeeper/pre-apt.d ]; then
mv_conffile "/etc/etckeeper/pre-apt.d/README" \
"/etc/etckeeper/pre-install.d/README"
mv_conffile "/etc/etckeeper/pre-apt.d/50uncommitted-changes" \
"/etc/etckeeper/pre-install.d/50uncommitted-changes"
rmdir --ignore-fail-on-non-empty /etc/etckeeper/pre-apt.d
fi
if [ -d /etc/etckeeper/post-apt.d ]; then
mv_conffile "/etc/etckeeper/post-apt.d/README" \
"/etc/etckeeper/post-install.d/README"
mv_conffile "/etc/etckeeper/post-apt.d/10git-test" \
"/etc/etckeeper/post-install.d/10vcs-test"
mv_conffile "/etc/etckeeper/post-apt.d/30git-add" \
"/etc/etckeeper/post-install.d/30git-add"
mv_conffile "/etc/etckeeper/post-apt.d/40git-rm" \
"/etc/etckeeper/post-install.d/40git-rm"
mv_conffile "/etc/etckeeper/post-apt.d/50git-commit" \
"/etc/etckeeper/post-install.d/50vcs-commit"
rmdir --ignore-fail-on-non-empty /etc/etckeeper/post-apt.d
fi
mv_conffile "/etc/etckeeper/init.d/40git-init" \
"/etc/etckeeper/init.d/40vcs-init"
mv_conffile "/etc/etckeeper/init.d/50git-ignore" \
"/etc/etckeeper/init.d/50vcs-ignore"
mv_conffile "/etc/etckeeper/init.d/50git-perm" \
"/etc/etckeeper/init.d/50vcs-perm"
mv_conffile "/etc/etckeeper/init.d/50git-pre-commit-hook" \
"/etc/etckeeper/init.d/50vcs-pre-commit-hook"
mv_conffile "/etc/etckeeper/init.d/70git-add" \
"/etc/etckeeper/init.d/70git-add"
fi
if dpkg --compare-versions "$2" le "0.10"; then
for c in 10vcs-test 30git-add 30hg-addremove 40git-rm; do
mv_conffile "/etc/etckeeper/post-install.d/$c" \
"/etc/etckeeper/commit.d/$c"
done
fi
if dpkg --compare-versions "$2" le "0.13"; then
mv_conffile "/etc/etckeeper/init.d/10restore-etckeeper" \
"/etc/etckeeper/init.d/20restore-etckeeper"
mv_conffile "/etc/etckeeper/init.d/20restore-metadata" \
"/etc/etckeeper/init.d/10restore-metadata"
fi
if dpkg --compare-versions "$2" le "0.28"; then
for c in commit.d/30darcs-add init.d/60darcs-deleted-symlinks; do
if [ -e /etc/etckeeper/$c ]; then
chmod +x /etc/etckeeper/$c
fi
done
fi
if dpkg --compare-versions "$2" le "0.61"; then
# may be left over from a botched conffile removal
rm -f /etc/etckeeper/commit.d/40git-rm.dpkg-dist
fi
if [ "$2" = "" ] && [ -e "/etc/etckeeper/etckeeper.conf" ]; then
# Fresh install.
. /etc/etckeeper/etckeeper.conf || true
if [ -n "$VCS" ] && [ -x "`which $VCS 2>/dev/null`" ]; then
if etckeeper init; then
if ! etckeeper commit "Initial commit"; then
echo "etckeeper commit failed; run it by hand" >&2
fi
else
echo "etckeeper init failed; run it by hand" >&2
fi
else
echo "etckeeper init not ran as $VCS is not installed" >&2
fi
fi
# prints error and exits nonzero if the ignore file cannot be updated
etckeeper update-ignore || true
esac
|