2023-03-20 02:56:52 -04:00
|
|
|
#!/command/with-contenv bash
|
|
|
|
# shellcheck shell=bash
|
|
|
|
|
|
|
|
set -e
|
2023-05-03 02:01:27 -04:00
|
|
|
# verbose
|
|
|
|
set -x
|
2023-03-20 02:56:52 -04:00
|
|
|
|
2023-03-29 21:19:16 -04:00
|
|
|
log_info 'Configuring npmuser ...'
|
2023-03-22 20:21:34 -04:00
|
|
|
|
2023-03-29 21:19:16 -04:00
|
|
|
if id -u npmuser; then
|
|
|
|
# user already exists
|
|
|
|
usermod -u "$PUID" npmuser || exit 1
|
|
|
|
else
|
|
|
|
# Add npmuser user
|
|
|
|
useradd -o -u "$PUID" -U -d /tmp/npmuserhome -s /bin/false npmuser || exit 1
|
2023-03-22 20:21:34 -04:00
|
|
|
fi
|
2023-03-29 21:19:16 -04:00
|
|
|
|
|
|
|
usermod -G "$PGID" npmuser || exit 1
|
|
|
|
groupmod -o -g "$PGID" npmuser || exit 1
|
|
|
|
# Home for npmuser
|
|
|
|
mkdir -p /tmp/npmuserhome
|
|
|
|
chown -R "$PUID:$PGID" /tmp/npmuserhome
|