sbt/sbt-native-packager — pull request #326 by pcting (2014-08-19 21:38:40+00:00)
Title: Fix RPM System User Deletion on Upgrade

This is an extension to this [commit](https://github.com/sbt/sbt-native-packager/commit/f0ead4a032399f8f04dcf49bc5fa2e6331d0f18c) to fix the RPM upgrade problem.

I've been having problems with my system user being deleted on an RPM upgrade. So I dug deeper and i found this problem:

```bash
$ rpm -qp --scripts myrpm.noarch.rpm
... (stripped out unrelated stuff) ...
postuninstall scriptlet (using /bin/sh):
# Removing system user/group : bulkhead and bulkhead
echo "Try deleting system user and group [bulkhead:bulkhead]"
if getent passwd | grep -q "^bulkhead:";
then
echo "Deleting system user: bulkhead"
userdel bulkhead
fi
if getent group | grep -q "^bulkhead:" ;
then
echo "Deleting system group: bulkhead"
groupdel bulkhead
fi
```

So I copied the [postuninstall](https://github.com/sbt/sbt-native-packager/blob/8c0877d03cb42a1bcc38e2a89ec2dc6c3344fcd3/src/main/resources/com/typesafe/sbt/packager/rpm/postuninstall) into my project's /src/rpm/scriptlets/postun-rpm and the problem resolved itself.

It feels strange that there's multiple copies of the same script; I'm guessing some clean up will need to be done. Anyhow, here's a pull request that should fix the problem for the time being.

Thanks!