Commit | Line | Data |
---|---|---|
209feeb0 H |
1 | iuser=riak; |
2 | igroup="$iuser"; | |
3 | ihome="/opt/$iuser"; | |
209feeb0 H |
4 | |
5 | # arg 1: the new package version | |
6 | post_install() { | |
7 | if [ -z "`grep '^$igroup::' /etc/group`" ]; then | |
8 | groupadd "$igroup" >& /dev/null | |
9 | fi | |
10 | if [ -z "`grep '^$iuser:' /etc/passwd`" ]; then | |
11 | useradd -d "$ihome" -g "$igroup" -s /bin/sh "$iuser" | |
12 | fi | |
13 | ||
14 | #chown -R "root:$igroup" "$ihome" | |
15 | chown -R "$iuser:$igroup" "$ihome" | |
16 | #chmod -R g+rw "$ihome" | |
17 | chmod a+x "$ihome" | |
dcf6fafd H |
18 | |
19 | ls /opt/riak/etc/*.pacnew &> /dev/null && cat <<EOS | |
20 | ==> WARNING! Riak configuration (or even storage backend) may changed since | |
21 | ==> the last version, you rather check http://basho.com/ for changelog... | |
22 | EOS | |
209feeb0 H |
23 | } |
24 | ||
25 | # arg 1: the new package version | |
26 | # arg 2: the old package version | |
27 | post_upgrade() { | |
28 | post_install $1 | |
29 | } | |
30 | ||
31 | # arg 1: the old package version | |
32 | pre_remove() { | |
33 | /etc/rc.d/riak stop &>/dev/null; sleep 1; | |
34 | pkill -u "$iuser" | |
35 | pkill -9 -u "$iuser" | |
36 | ||
37 | chown -R "root:root" "$ihome" | |
38 | ||
39 | userdel "$iuser" &> /dev/null | |
40 | groupdel "$igroup" &> /dev/null | |
41 | } |