ayaports/user/paperless-ngx/paperless-ngx.pre-install

26 lines
584 B
Bash
Executable file

#!/bin/sh
# It's very important to set user/group correctly.
paperless_dir='/var/lib/paperless'
if ! getent group paperless 1>/dev/null; then
echo '* Creating group paperless' 1>&2
addgroup -S paperless
fi
if ! id paperless 2>/dev/null 1>&2; then
echo '* Creating user paperless' 1>&2
adduser -DHS -G paperless -h "$paperless_dir" -s /bin/sh \
-g "added by apk for paperless" paperless
passwd -u paperless 1>/dev/null # unlock
fi
if ! id -Gn paperless | grep -Fq paperless; then
echo '* Adding user paperless to group redis' 1>&2
addgroup paperless redis
fi
exit 0