diff options
author | Erich Eckner <git@eckner.net> | 2018-05-27 10:13:52 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-05-27 10:13:52 +0200 |
commit | 14a8f5d3c7889f2046a008b1b1dc29f485ebb359 (patch) | |
tree | 644ebb60f7155dd5c139d233857684fbcd8546e6 /manualPorts/boinc-client/pre-install | |
download | crux-ports-14a8f5d3c7889f2046a008b1b1dc29f485ebb359.tar.xz |
initial commit
Diffstat (limited to 'manualPorts/boinc-client/pre-install')
-rwxr-xr-x | manualPorts/boinc-client/pre-install | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/manualPorts/boinc-client/pre-install b/manualPorts/boinc-client/pre-install new file mode 100755 index 0000000..ca20f8e --- /dev/null +++ b/manualPorts/boinc-client/pre-install @@ -0,0 +1,42 @@ +#!/bin/sh + +# based on tor/pre-install + +GROUP=boinc +USER=boinc +USER_COMMENT="BOINC Daemon" +USER_HOME=/var/boinc +USER_SHELL=/bin/sh +ID=89 + +if [ ! $(id -u) = 0 ]; then + echo "ERROR: you need to be root to run this!" + exit 1 +fi + +if [ $GROUP ]; then + if ! getent group $GROUP > /dev/null; then + /usr/sbin/groupadd -g $ID $GROUP + if [ $? -eq 0 ]; then + echo "Group: $GROUP added." + fi + else + echo "Group: $GROUP already exists! Skipping." + fi +fi + +if ! getent passwd $USER > /dev/null; then + /usr/sbin/useradd -g $GROUP -c "$USER_COMMENT" -d $USER_HOME -u $ID -s $USER_SHELL -m $USER + if [ $? -eq 0 ]; then + echo "User: $USER added." + /usr/bin/passwd -l $USER > /dev/null + if [ $? -eq 0 ]; then + echo "Locked: $USER account." + fi + else + echo "ERROR: unable to lock $USER account." + /usr/sbin/userdel $USER + fi + else + echo "User: $USER already exists! Skipping." +fi |