summaryrefslogblamecommitdiff
path: root/misc/dnetc/pkg-install
blob: 4affdc2a568a60162ff10c86b6e42a237ea0ac3a (plain) (tree)
1
2
3
4
5
6
7
8
9
10






                                  
              

                                                       
                                         







                                                                 
                                                        









                                                                    
#!/bin/sh

if [ "$2" != "PRE-INSTALL" ]; then
    exit 0
fi

CLIENTUSER=$3
CLIENTGROUP=$4

if ! pw groupshow "$CLIENTGROUP" 2>/dev/null 1>&2; then
	if pw groupadd $CLIENTGROUP; then
		echo "=> Added group \"$CLIENTGROUP\"."
	else
                echo "=> Adding group \"$CLIENTGROUP\" failed..."
                exit 1
        fi
fi

if ! pw usershow "$CLIENTUSER" 2>/dev/null 1>&2; then
        if pw useradd $CLIENTUSER -g $CLIENTGROUP -h - \
                -s "/sbin/nologin" -d "/nonexistent" \
                -c "distributed.net client and proxy pseudo-user"; \
        then
                echo "=> Added user \"$CLIENTUSER\"."
        else
                echo "=> Adding user \"$CLIENTUSER\" failed..."
                exit 1
        fi
fi
exit 0