File: preinst

package info (click to toggle)
dosemu 0.66.7-13
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 5,672 kB
  • ctags: 7,566
  • sloc: ansic: 60,209; sh: 3,965; asm: 2,219; yacc: 1,980; makefile: 831; perl: 598; lex: 506; awk: 398
file content (58 lines) | stat: -rw-r--r-- 1,589 bytes parent folder | download | duplicates (2)
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
# $Id: preinst,v 1.9 1998/03/17 09:49:00 herbert Exp $
#
# pre-install script for the Debian GNU/Linux dosemu package
#

set -e

pause() {
	echo -n "Press ENTER to continue..."
	read answer;
}

check_kernel_version() {
	KVERSION=`uname -r`
	dpkg --compare-versions $KVERSION ge 2.1.15 ||
		(dpkg --compare-versions $KVERSION lt 2.1.0 &&
		dpkg --compare-versions $KVERSION ge 2.0.28) ||
		(echo "Your kernel must be >= 2.0.28 or >= 2.1.15!";
		pause;
		exit 1)
}

check_kernel_version

case "$1" in
install | upgrade)
	if [ $1 = upgrade ] && dpkg --compare-versions "$2" lt 0.66.7-1; then
		if [ -f /var/lib/dosemu/hdimage -a ! -f /var/lib/dosemu/hdimage.first ]; then
			echo "The conffile /var/lib/dpkg/hdimage will be copied to its new"
			echo "location: /var/lib/dosemu/hdimage.first.  Please refer to"
			echo "/usr/doc/dosemu/README.debian[.gz] for more information."
			pause
			cp -p /var/lib/dosemu/hdimage /var/lib/dosemu/hdimage.first
		fi

		# Old versions of dosemu need special care.
		if dpkg --compare-versions "$2" lt 0.66 && [ -L /etc/dosemu/conf -a `ls -l /etc/dosemu/conf | sed 's/.* //'` = "dist" ]; then
			rm -f /etc/dosemu/conf
			cp -p /etc/dosemu/dist /etc/dosemu/conf
		fi

		# See if the conf is a link pointing to ../../usr/lib/dosemu/config.dist.
		if [ -L /etc/dosemu/conf -a `ls -l /etc/dosemu/conf | sed 's/.* //'` = "../../usr/lib/dosemu/config.dist" ]; then
			rm -f /etc/dosemu/conf
			cp -a /usr/lib/dosemu/config.dist /etc/dosemu/conf
		fi
	fi
	;;
abort-upgrade)
	;;
*)
	echo "$0: incorrect arguments: $*" >&2
	exit 1
	;;
esac

#DEBHELPER#