File: cvsweb.postinst

package info (click to toggle)
cvsweb 3%3A3.0.6-8.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 1,220 kB
  • sloc: perl: 3,398; sh: 44; makefile: 10
file content (58 lines) | stat: -rw-r--r-- 1,536 bytes parent folder | download | duplicates (5)
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
#! /bin/sh
# postinst script for cvsweb
#
# see: dh_installdeb(1)

set -e

mv_conffile() {
# syntax: prep_mv_conffile $OLDCONFFILE $NEWCONFFILE
#
# Check to make sure the old conffile still exists on the disk. If the file
# still exists, we know that there were changes to it we want to preserve
# (see preinst script). We move the new conffile as unpacked by dpkg to a
# file the user can compare it with if they wish and move the old conffile
# into the new place.

	OLDCONFFILE="$1"
	NEWCONFFILE="$2"

	if [ -e "$OLDCONFFILE" ]; then
		echo "Preserving user changes to $NEWCONFFILE ..."
		mv -f "$NEWCONFFILE" "$NEWCONFFILE".dpkg-dist
		mv -f "$OLDCONFFILE" "$NEWCONFFILE"
	fi
}

mv_custom_conffile() {
# syntax: prep_mv_conffile $OLDCONFFILE $NEWCONFFILE
#
# Check to make sure the custom conffile exists on the disk. We move the old
# conffile into the new place.

	OLDCONFFILE="$1"
	NEWCONFFILE="$2"

	if [ -e "$OLDCONFFILE" ]; then
		echo "Preserving custom config file $NEWCONFFILE ..."
		mv -f "$OLDCONFFILE" "$NEWCONFFILE"
	fi
}

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

# check for cvsweb.conf* files and move them to /etc/cvsweb.
if [ "$1" = configure ]; then
	if dpkg --compare-versions "$2" le "3:3.0.5-1"; then
		mv_conffile "/etc/cvsweb.conf" "/etc/cvsweb/cvsweb.conf"
		find /etc -maxdepth 1 -name "cvsweb.conf-*" -printf "%f\n" | while read conffile ; do
			mv_custom_conffile "/etc/$conffile" "/etc/cvsweb/$conffile"
		done
	fi
fi

exit 0