File: preinst

package info (click to toggle)
moodle 1.6.3-2%2Betch3
  • links: PTS
  • area: main
  • in suites: etch
  • size: 37,172 kB
  • ctags: 51,688
  • sloc: php: 231,916; sql: 5,631; xml: 2,688; sh: 1,185; perl: 638; makefile: 48; pascal: 36
file content (52 lines) | stat: -rw-r--r-- 1,073 bytes parent folder | download | duplicates (3)
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
#! /bin/sh -e
# preinst script for moodle 

get_config() {
    db_get moodle/webserver
    webserver="$RET"
}

uninclude() {
	. /usr/share/debconf/confmodule
	db_version 2.0

	# Read debconf and edit the config file accordingly
	get_config
	db_stop
	exec 0<&1

	# Remove include from httpd.conf when upgrading from older versions
	if [ ! -f /etc/${webserver}/conf.d/moodle ]; then
		if [ -f /etc/${webserver}/httpd.conf \
			-a -f /usr/share/wwwconfig-common/apache-uninclude_all.sh ]
		then
			includefile=/etc/moodle/apache.conf
			server="${webserver}"
			servers="apache apache-ssl apache-perl apache2"
			. /usr/share/wwwconfig-common/apache-uninclude_all.sh
		fi
	fi
}

case "$1" in
	upgrade)
		#remove old sessions when upgrading from < than 1.4.4-1
		if dpkg --compare-versions "$2" lt "1.4.4-1"; then
			find /var/lib/moodle/sessions -type f -print0 | xargs -r0 rm -f
		fi

	 	uninclude
		;;
	install)
		# if the package was not purged we are called with the version
		# as second paramter
		if [ $# -eq 2 ]
		then
			uninclude
		fi
		;;
esac

#DEBHELPER#

exit 0