-
Notifications
You must be signed in to change notification settings - Fork 116
/
groonga-server-common.postinst
executable file
·47 lines (40 loc) · 1.23 KB
/
groonga-server-common.postinst
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
#! /bin/sh
set -e
prevver="$2"
add_system_user() {
if ! getent passwd groonga >/dev/null; then
adduser --group --system --home /var/lib/groonga groonga
fi
}
fixperms() {
dpkg-statoverride --list /var/run/groonga >/dev/null || \
dpkg-statoverride --update --add groonga groonga 0755 /var/run/groonga
dpkg-statoverride --list /var/lib/groonga >/dev/null || \
dpkg-statoverride --update --add groonga groonga 0755 /var/lib/groonga
dpkg-statoverride --list /etc/groonga >/dev/null || \
dpkg-statoverride --update --add groonga groonga 0755 /etc/groonga
dpkg-statoverride --list /var/log/groonga >/dev/null || \
dpkg-statoverride --update --add groonga groonga 0755 /var/log/groonga
}
create_database() {
if [ ! -d /var/lib/groonga/db ]; then
mkdir -p /var/lib/groonga/db
groonga -n /var/lib/groonga/db/db shutdown > /dev/null
chown -R groonga:groonga /var/lib/groonga
fi
}
case "$1" in
configure)
add_system_user
create_database
fixperms
;;
abort-upgrade|abort-deconfigure|abort-remove)
:
;;
*)
echo "Called with unknown argument $1, bailing out."
exit 1
;;
esac
#DEBHELPER#