summaryrefslogtreecommitdiffstats
path: root/net/noip/pkg-install
blob: f4efdf4b8f4668242af5fdfd1b259459a0192548 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh

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

PW=/usr/sbin/pw
ECHO=echo
USER=noip
GROUP=${USER}

if ! ${PW} groupshow "${GROUP}" 2>/dev/null 1>&2; then
	if ${PW} groupadd ${GROUP}; then
		${ECHO} "Added group \"${GROUP}\"."
	else
                ${ECHO} "Adding group \"${GROUP}\" failed..."
                exit 1
        fi
fi

if ! ${PW} usershow "${USER}" 2>/dev/null 1>&2; then
        if ${PW} useradd ${USER} -g ${GROUP} -h - \
                -s "/sbin/nologin" -d "/nonexistent" \
                -c "noip_updater pseudo-user"; \
        then
                ${ECHO} "Added user \"${USER}\"."
        else
                ${ECHO} "Adding user \"${USER}\" failed..."
                exit 1
        fi
fi
exit 0
OpenPOWER on IntegriCloud