Debian Codegraph @

debian/bsdmainutils.postinst

raw
1 #!/bin/sh
2
3 set -e
4
5 mvverbose=-v
6
7 # from dpkg-maintscript-helper, modified
8 ensure_package_owns_file() {
9 local PACKAGE="$1"
10 local FILE="$2"
11
12 dpkg-query -L "$PACKAGE" | grep -F -q -x "$FILE"
13 }
14
15 # from dpkg-maintscript-helper, modified
16 finish_mv_conffile() {
17 local CONFFILE="$1"
18 local NEWCONFFILE="$2"
19 local PACKAGE="$3"
20
21 rm $mvverbose -f "$CONFFILE.dpkg-remove"
22
23 [ -e "$CONFFILE.dpkg-backup" ] || return 0
24 ensure_package_owns_file "$PACKAGE" "$NEWCONFFILE" || return 0
25
26 echo "Preserving user changes to $NEWCONFFILE (now owned by $PACKAGE)..."
27 if [ -e "$NEWCONFFILE" ]; then
28 mv $mvverbose -f "$NEWCONFFILE" "$NEWCONFFILE.dpkg-new"
29 fi
30 mv $mvverbose -f "$CONFFILE.dpkg-backup" "$NEWCONFFILE"
31 }
32
33 if [ "$1" = configure ] && [ -n "$2" ] && dpkg --compare-versions "$2" lt 12.1.6; then
34 finish_mv_conffile /etc/default/bsdmainutils /etc/default/calendar calendar
35 finish_mv_conffile /etc/cron-daily/bsdmainutils /etc/cron.daily/calendar calendar
36 fi
37
38 #DEBHELPER#
39