File: preinst

package info (click to toggle)
lltag 0.14.6-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 476 kB
  • ctags: 253
  • sloc: perl: 2,833; makefile: 120; sh: 17
file content (24 lines) | stat: -rwxr-xr-x 584 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh
set -e
#DEBHELPER#

# Remove the conffile unless modified
rm_unchanged_conffile() {
    CONFFILE="$1"

    if [ -e "$CONFFILE" ]; then
	md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
	old_md5sum=`dpkg-query -W -f='${Conffiles} ' lltag | grep "$CONFFILE[[:space:]]" | cut -d' ' -f3`
	if [ "$md5sum" = "$old_md5sum" ]; then
	    rm -f "$CONFFILE"
	fi
    fi
}

case "$1" in
upgrade)
    # /etc/lltag/config is installed in /usr/share/doc starting at 0.13.1-1
    if dpkg --compare-versions "$2" le "0.13.1-1"; then
	rm_unchanged_conffile "/etc/lltag/config"
    fi
esac