iuser=riak; igroup="$iuser"; ihome="/opt/$iuser"; # arg 1: the new package version post_install() { if [ -z "`grep '^$igroup::' /etc/group`" ]; then groupadd "$igroup" >& /dev/null fi if [ -z "`grep '^$iuser:' /etc/passwd`" ]; then useradd -d "$ihome" -g "$igroup" -s /bin/sh "$iuser" fi #chown -R "root:$igroup" "$ihome" chown -R "$iuser:$igroup" "$ihome" #chmod -R g+rw "$ihome" chmod a+x "$ihome" ls /opt/riak/etc/*.pacnew &> /dev/null && cat < WARNING! Riak configuration (or even storage backend) may changed since ==> the last version, you rather check http://basho.com/ for changelog... EOS } # arg 1: the new package version # arg 2: the old package version post_upgrade() { post_install $1 } # arg 1: the old package version pre_remove() { /etc/rc.d/riak stop &>/dev/null; sleep 1; pkill -u "$iuser" pkill -9 -u "$iuser" chown -R "root:root" "$ihome" userdel "$iuser" &> /dev/null groupdel "$igroup" &> /dev/null }