File: cvsweb.preinst

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 (38 lines) | stat: -rw-r--r-- 837 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
#! /bin/sh
# preinst script for cvsweb
#
# see: dh_installdeb(1)

set -e

prep_mv_conffile() {
# syntax: prep_mv_conffile $CONFFILE
#
# Check to make sure the conffile exists on the disk and whether the user has
# changed it or not

	CONFFILE="$1"
	
	if [ -e "$CONFFILE" ]; then
		md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
		old_md5sum="`dpkg-query -W -f='${Conffiles}' cvsweb | grep $CONFFILE | awk '{print $2}'`"
		if [ "$md5sum" = "$old_md5sum" ]; then
			rm -f "$CONFFILE"
		fi
	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" = install ] || [ "$1" = upgrade ]; then
	if dpkg --compare-versions "$2" le "3:3.0.5-1"; then
		prep_mv_conffile "/etc/cvsweb.conf"
	fi
fi

exit 0