File: torrus-common.postinst

package info (click to toggle)
torrus 3.00-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 4,548 kB
  • sloc: perl: 34,614; xml: 20,934; sh: 3,650; makefile: 713
file content (53 lines) | stat: -rw-r--r-- 1,732 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
#!/bin/sh
set -e

configure_user_group() {
#   Create the user/group. It only returns non-zero if there is some real
#   error, so in that case it's better to bail out anyway.
    adduser --quiet --system --no-create-home --home /nonexistent \
            --force-badname --group Debian-torrus > /dev/null 2>&1
}

fix_owner_perm() {
    chown Debian-torrus:Debian-torrus /var/lib/torrus /var/log/torrus
    chmod g+w /var/log/torrus
    chmod g+w /var/lib/torrus/session_data/lock /var/lib/torrus/session_data/store
    if [ -d /var/cache/torrus ]; then
	    chown Debian-torrus:Debian-torrus /var/cache/torrus
	    chmod g+w /var/cache/torrus
    fi
    # zap /var/lib/torrus/db, we don't have berkeley-db any more
    rm -rf /var/lib/torrus/db
    adduser www-data Debian-torrus > /dev/null 2>&1
}

dpkg-maintscript-helper rm_conffile /etc/logrotate.d/torrus-common 2.01-3 -- "$@"

# Remove torrus-apache2.conf symlink that used to be installed in
# the now dropped package torrus-apache2 ... it has mod_perl configuration
# statements that break apache2 restarts until the configuration has been
# purged (if libapache2-mod-perl has been autoremoved in the meantime)
test -L /etc/apache2/conf.d/torrus-apache2.conf && rm /etc/apache2/conf.d/torrus-apache2.conf

case "$1" in
    configure)	
	configure_user_group
	fix_owner_perm
	# torrus clearcache has vanished in torrus 3.0. It is currently unclear
	# whether this was intended upstream, so we're keeping the call
	# conditionally for the time being
	if [ -x '/usr/share/torrus/bin/clearcache' ]; then
		torrus clearcache
	fi
	;;
    abort-upgrade|abort-remove|abort-deconfigure)
	;;
    *)
	echo "${0} called with unknown argument ${1}"
	exit 1
	;;
esac

#DEBHELPER#

exit 0