File: scuttle.postinst

package info (click to toggle)
scuttle 0.7.4-8.1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 1,520 kB
  • ctags: 1,956
  • sloc: php: 8,036; sh: 134; makefile: 48; sql: 43
file content (85 lines) | stat: -rw-r--r-- 2,160 bytes parent folder | download
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
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/sh

set -e

#DEBHELPER#

case "$1" in
	configure)

		# source debconf stuff
		. /usr/share/debconf/confmodule

		# permissions
		mkdir -p /var/cache/scuttle
		
		CACHE_DIR=" /var/cache/scuttle"
		CACHE_AUX=$(dpkg-statoverride --list | grep $CACHE_DIR) || true
		if [ -z "$CACHE_AUX" ]; then
			dpkg-statoverride --update --add root www-data 0774 $CACHE_DIR
		fi

		# config file debconf
		CONFIG_TEMPLATE="/usr/share/scuttle/config_debconf.inc.php"
		CONFIG_FILE="/etc/scuttle/config_debconf.inc.php"
		CONFIG_TMP="/etc/scuttle/config_debconf.inc.php.dpkg-new"

		# set admin email in config file
		ADMIN_EMAIL="\$_SERVER['SERVER_ADMIN']";
		if [ -n "$ADMIN_EMAIL" ] ; then
			sed -e "s/adminemail[^;]*/adminemail = $ADMIN_EMAIL/" $CONFIG_TEMPLATE > $CONFIG_TMP
		fi
		
		# debconf messages	
		db_get scuttle/locale || true
		LOCALE="$RET";

		# set locale in config file
		if [ -n "$LOCALE" ] ; then
			sed -e "s/locale[^;]*/locale = '$LOCALE'/" $CONFIG_TEMPLATE > $CONFIG_TMP
		fi

		ucf --debconf-ok $CONFIG_TMP $CONFIG_FILE && rm -f $CONFIG_TMP

		CONFIG_AUX=$(dpkg-statoverride --list | grep $CONFIG_FILE) || true
		if [ -z "$CONFIG_AUX" ]; then
			dpkg-statoverride --update --add root www-data 0640  $CONFIG_FILE
		fi

		# source dbconfig-common stuff
		. /usr/share/dbconfig-common/dpkg/postinst.mysql
		dbc_first_version="0.7.2"
		dbc_generate_include="php:/etc/scuttle/database.php"
		dbc_generate_include_owner="root:www-data"
		dbc_generate_include_perms="0640"
		dbc_generate_include_args="--dbserver=dbhost"
		dbc_go scuttle $@

		# debconf messages	
      		db_get scuttle/webserver || true
		WEBSERVER="$RET";

		# webserver configuration
		if $WEBSERVER; then
			if [ ! -d /etc/apache2/conf.d/ ]; then
			       	install -d -m755 /etc/apache2/conf.d/
			fi

			if [ ! -e /etc/apache2/conf.d/scuttle.conf ]; then
				ln -s /etc/scuttle/apache.conf \
					/etc/apache2/conf.d/scuttle.conf
				restart="apache2"
			fi

	        	servers="apache2"
        		. /usr/share/wwwconfig-common/restart.sh
		fi
	;;

    	abort-upgrade|abort-remove|abort-deconfigure)
	
	;;
   	 *)
		echo "postinst called with unknown argument \`$1'" >&2
	;;
esac