dusr=diaspora
dhome=/usr/share/webapps/diaspora
dlog=/var/log/diaspora.log

post_install() {
  getent passwd $dusr &>/dev/null || useradd -r -d $dhome -s /bin/bash $dusr &>/dev/null
  chown -R $dusr:$dusr $dhome &>/dev/null
  [[ -f $dlog ]] && chown $dusr:$dusr $dlog
}

pre_upgrade(){
  etc/rc.d/diaspora stop &>/dev/null
  return 0
}

post_upgrade(){
  post_install $1
}

pre_remove(){
  pre_upgrade $1
}

post_remove(){
  getent passwd $dusr &>/dev/null && userdel -f $dusr
  return 0
}