source: lliurex-statistics/trunk/fuentes/debian/lliurex-statistics.postinst @ 6816

Last change on this file since 6816 was 6816, checked in by mabarracus, 3 years ago

Modify postinst

File size: 2.7 KB
Line 
1#!/bin/sh
2# postinst script for lliurex-statistics
3#
4# see: dh_installdeb(1)
5
6set -e
7
8. /usr/share/debconf/confmodule
9
10# summary of how this script can be called:
11#        * <postinst> `configure' <most-recently-configured-version>
12#        * <old-postinst> `abort-upgrade' <new version>
13#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
14#          <new-version>
15#        * <postinst> `abort-remove'
16#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
17#          <failed-install-package> <version> `removing'
18#          <conflicting-package> <version>
19# for details, see http://www.debian.org/doc/debian-policy/ or
20# the debian-policy package
21
22
23case "$1" in
24    configure)
25            if [ -d /var/log/analytics ]; then
26                mv /var/log/analytics /var/log/tmp_analytics_old || true
27            fi
28            if [ -f /etc/audit/auditd.conf ]; then 
29                dpkg-divert --package lliurex-statistics --divert /etc/audit/auditd.conf.auditd-orig --rename /etc/audit/auditd.conf
30                [ \! -e /etc/audit/auditd.conf -o -L /etc/audit/auditd.conf ] && ln -f /etc/audit/auditd.analytics /etc/audit/auditd.conf
31            fi
32           
33            if [ -f /lib/systemd/system/auditd.service ]; then
34                sed -i.orig -e 's/#ExecStartPost=-\/sbin\/augenrules --load/ExecStartPost=-\/sbin\/augenrules --load/' /lib/systemd/system/auditd.service
35            fi
36           
37            if [ -f  /etc/default/auditd ]; then
38                cp /etc/default/auditd /etc/audit/default.analytics
39                sed -i -e 's/USE_AUGENRULES="no"/USE_AUGENRULES="yes"/g' /etc/audit/default.analytics
40           
41                dpkg-divert --package lliurex-statistics --divert /etc/default/auditd.auditd-orig --rename /etc/default/auditd
42                [ \! -e /etc/default/auditd -o -L /etc/default/auditd ] && ln -f /etc/audit/default.analytics /etc/default/auditd
43            fi
44           
45            update-rc.d auditd defaults 98
46            update-rc.d analytics defaults 99
47           
48            /bin/echo -e "-a exit,always -F euid>999 -S execve\n" >> /etc/audit/rules.d/analytics.rules
49            touch /etc/lliurex-analytics/status
50
51            #USELESS INTO SQUASHED FS, LOGIC INTO STARTUP SERVICE
52            # 10003 (fixed group into ldap 4 teachers)
53            #echo "setting acl's"
54            #setfacl -m g:10003:rw /etc/lliurex-analytics/status
55            #setfacl -m g:adm:rw /etc/lliurex-analytics/status
56            #getfacl /etc/lliurex-analytics/status
57           
58            # AVOID TO RESTART !! Could block ltsp's chroot builder
59            #service auditd restart
60    ;;
61   
62    abort-upgrade|abort-remove|abort-deconfigure)
63    ;;
64
65    *)
66        echo "postinst called with unknown argument \`$1'" >&2
67        exit 1
68    ;;
69esac
70
71# dh_installdeb will replace this with shell code automatically
72# generated by other debhelper scripts.
73
74#DEBHELPER#
75
76exit 0
Note: See TracBrowser for help on using the repository browser.