File: postinst

package info (click to toggle)
slocate 2.4-2potato1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 228 kB
  • ctags: 177
  • sloc: ansic: 1,921; sh: 294; makefile: 59
file content (44 lines) | stat: -rw-r--r-- 1,132 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
#!/bin/sh

SLOCATE_GROUP=slocate
PROG=/usr/bin/slocate
SLOCATE_DBPATH=/var/lib/slocate
PKG_NAME=slocate
SLOCATE_UPDATEDB=/etc/cron.daily/slocate

set -e

#echo "Adding group: $SLOCATE_GROUP"
# if the groups there this will fail
# ash fix thanks mstone
#groupadd $SLOCATE_GROUP 2>/dev/null || true
# system group thanks andrew@pimlott.ne.mediaone.net
groupdel $SLOCATE_GROUP 2>/dev/null || true
addgroup $SLOCATE_GROUP 2>/dev/null || true

echo "Changing permissions on: $PROG"
# thanks roland
if [ -x /usr/sbin/suidregister -a -x $PROG ]
then
	echo "suidregister -s $PKG_NAME $PROG root $SLOCATE_GROUP 2755"
	suidregister -s $PKG_NAME $PROG root $SLOCATE_GROUP 2755
else
	chown root.$SLOCATE_GROUP $PROG
	chmod g+s $PROG
fi

#echo "Changing permissions on: $SLOCATE_DBPATH"
if [ ! -d $SLOCATE_DBPATH ]
then
	mkdir -p $SLOCATE_DBPATH
fi
chown root.$SLOCATE_GROUP $SLOCATE_DBPATH

echo "Changing permissions on: $SLOCATE_DBPATH to: 0750"
chmod 0750 $SLOCATE_DBPATH

echo
echo "WARNING: You should run '$SLOCATE_UPDATEDB' as root. locate will not work properly until you do or until it is run by cron (it is daily)."
echo

#DEBHELPER#