File: phpbb2.postinst

package info (click to toggle)
phpbb2 2.0.21-6
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 4,224 kB
  • ctags: 12
  • sloc: sh: 476; makefile: 108; perl: 29; php: 21
file content (72 lines) | stat: -rw-r--r-- 1,970 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/sh
# postinst script for phpbb2
# By Jeroen van Wolffelaar <jeroen@wolffelaar.nl>

set -e

#export DEBCONF_DEBUG=developer

. /usr/share/debconf/confmodule

db_version 2.0

# /usr/share/phpbb2/site/templates used to be a dir, should be a symlink now
if ! [ -L /usr/share/phpbb2/site/templates ]; then
	if [ -d /usr/share/phpbb2/site/templates ] && \
		! rmdir /usr/share/phpbb2/site/templates; then

		echo 
		echo "Error: /usr/share/phpbb2/site/templates is not empty. Its"
		echo "contents need to be moved to /etc/phpbb2/templates, the new"
		echo "location of custom templates."
		echo
		echo "Please move your custom templates to /etc/phpbb2/templates, and"
		echo "try 'apt-get -f install' or 'dpkg --configure --pending' to"
		echo "reconfigure/reinstall the phpbb2 package."
		echo
		echo "Aborting now."
		echo
		exit 1
	fi

	if ! [ -e /usr/share/phpbb2/site/templates ]; then
		ln -s /etc/phpbb2/templates /usr/share/phpbb2/site/templates
	fi

	if ! [ -L /usr/share/phpbb2/site/templates ]; then
		echo
		echo "Error: /usr/share/phpbb2/site/templates must be a symlink"
		echo "pointing to /etc/phpbb2/templates. Something weird is going on,"
		echo "I give up. Try reinstalling phpbb2 and/or fixing this manually."
		echo 
		exit 1
	fi
fi

#TODO
# walk though supported apache's, and warn if they are configured but
# shouldn't anymore

# Maybe store the apache.conf's in the /etc/$apache/conf.d dirs itself, so the
# user can have distinct configs and such?

# Following lend from phpmyadmin's postinst
db_get phpbb2/httpd
webservers="$RET"

for webserver in $webservers; do
	webserver=${webserver%,}
	if [ -e /etc/$webserver/httpd.conf ] && [ ! -e /etc/$webserver/phpbb2.conf ]; then
		mkdir -p /etc/$webserver/conf.d
		ln -sf /etc/phpbb2/apache.conf /etc/$webserver/conf.d/phpbb2.conf
		if [ -h /etc/$webserver/conf.d/phpbb2 ]; then
			rm -f /etc/$webserver/conf.d/phpbb2
		fi
	fi
done

# Offer to reload the changed ones?

# Debhelper

#DEBHELPER#