2023-03-20 06:56:52 +00:00
|
|
|
#!/command/with-contenv bash
|
|
|
|
# shellcheck shell=bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2023-03-29 23:04:37 +00:00
|
|
|
if [ "$PUID" = '0' ]; then
|
|
|
|
log_info 'Skipping npmuser configuration'
|
|
|
|
else
|
|
|
|
log_info 'Configuring npmuser ...'
|
|
|
|
groupmod -g 1000 users || exit 1
|
2023-03-20 06:56:52 +00:00
|
|
|
|
2023-03-29 23:04:37 +00:00
|
|
|
if id -u npmuser; then
|
|
|
|
# user already exists
|
|
|
|
usermod -u "$PUID" npmuser || exit 1
|
|
|
|
else
|
|
|
|
# Add npmuser user
|
|
|
|
useradd -u "$PUID" -U -d /tmp/npmuserhome -s /bin/false npmuser || exit 1
|
|
|
|
fi
|
2023-03-23 00:21:34 +00:00
|
|
|
|
2023-03-29 23:04:37 +00:00
|
|
|
usermod -G users npmuser || exit 1
|
|
|
|
groupmod -o -g "$PGID" npmuser || exit 1
|
|
|
|
# Home for npmuser
|
|
|
|
mkdir -p /tmp/npmuserhome
|
2023-03-30 00:20:20 +00:00
|
|
|
chown -R "$PUID:$PGID" /tmp/npmuserhome
|
2023-03-23 00:21:34 +00:00
|
|
|
fi
|