File: postinst

package info (click to toggle)
systraq 0.0.20050213-8
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,380 kB
  • ctags: 2
  • sloc: sh: 747; makefile: 104
file content (120 lines) | stat: -rw-r--r-- 3,831 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#! /bin/sh
# postinst script for systraq

SYSTRAQUSER=debian-systraq
OLDSYSTRAQUSER=systraq
OLDVERSION=0.0.20050213-4
USERMISSING=0
    
if ! getent passwd $SYSTRAQUSER > /dev/null 2>&1; then
    adduser --system --disabled-password --home /var/lib/systraq \
	    --quiet --group $SYSTRAQUSER
    USERMISSING=1
fi

if getent passwd $OLDSYSTRAQUSER > /dev/null 2>&1 && [ $USERMISSING = 1 ]; then
    if dpkg --compare-versions $2 le-nl $OLDVERSION; then
	# we are upgraded from a package version where the systraq user
	# is called `systraq'.
	chown -R $SYSTRAQUSER:$SYSTRAQUSER /var/lib/systraq
	cat <<EOT
The new systraq username in the Debian package is now debian-systraq. The 
old systraq user may be safely removed after the package is configured.
EOT

    else
	cat <<EOT
You have a systraq user that was not installed by the systraq debian package.
I will not reuse this user. You might want to hand all files owned by the
systraq user over to debian-systraq; e.g. by running
    chown -R debian-systraq /var/lib/systraq
after this package is installed.
EOT
    cat <<EOT
Make sure you have a /etc/cron.d/systraq file from systraq >> $OLDVERSION.
EOT
    fi
fi

#if ! grep -qi "^debian-systraq:" /etc/aliases; then
#	echo "debian-systraq: root" >> /etc/aliases
#	newal=`which newaliases`
#	if [ -x $newal ]; then
#		newaliases > /dev/null
#	fi
#fi

test -f /var/lib/systraq/.forward || echo root > /var/lib/systraq/.forward
chown -R $SYSTRAQUSER:$SYSTRAQUSER /var/lib/systraq/.forward

# if [ "$2" = "" ]; then
	test -d /var/lib/systraq/filetraq || mkdir /var/lib/systraq/filetraq

	if ! getent group $SYSTRAQUSER > /dev/null 2>&1; then
		cat <<EOT
You do have a debian-systraq user, but not a debian-systraq group
on your system. Your systraq user was not created by the systraq Debian package.
Please make sure your systraq user is a member of the debian-systraq group.
You can make this adjustment after this package is installed.
EOT
		addgroup --system --quiet $SYSTRAQUSER
        fi

# fi

#ftraqconf="/etc/systraq/filetraq.conf"
#if ! [ -e $ftraqconf ]; then
#	# creating default filetraq.conf
#	find /etc -perm a+r -type f | sort > $ftraqconf
#	ls -l /home/*/.ssh/a* | sort >> $ftraqconf
#	cat >> $ftraqconf <<-EOF
#		/var/lib/systraq/snapshot_pub.list
#		/var/lib/systraq/snapshot_pub.homelist
#		/var/lib/systraq/snapshot_root.list
#		/var/lib/systraq/snapshot_root.homelist
#		/var/lib/systraq/filetraq.conf
#		#
#		/var/lib/systraq/snapshot_pub.stat
#		/var/lib/systraq/snapshot_root.stat
#		/var/lib/systraq/systraq.md5sums
#	EOF
#fi

# Is systraq configured ?

if ! test -f /etc/systraq/snapshot_pub.list; then
    cat <<EOT > /etc/systraq/systraq_is_unconfigured
You are probably reading this file since you got it in your mailbox
by a cronjob.  Welcome!

There are 4 different ways to get rid of this somewhat annoying hourly
message from cron:

1) RTFM and configure systraq.  Systraq documentation is likely installed
   in a location like /usr/share/doc/systraq/ .  Remove the file
   systraq_is_unconfigured (probably in /etc/systraq/) when done.
2) Purge the systraq package from your system.
3) If systraq was installed from a package for your distribution, your
   package maintainer might have supplied configuration files, specifically
   tweaked for your system.  These are likely installed in
   /usr/share/doc/systraq/examples/<distributionname>/
   snapshot_{pub,root}.{home,}list .  Copy these to /etc/systraq/ .  Remove
   the file systraq_is_unconfigured (probably in /etc/systraq/) when done.
4) Execute
    # touch /etc/systraq/i_want_a_broken_systraq
   (proper location could vary).

# $Id: systraq_is_unconfigured 211 2005-02-12 20:39:39Z joostvb $
EOT

fi


# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0