lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | #!/bin/sh |
| 2 | |
| 3 | set -e |
| 4 | |
| 5 | ADDUSERCONF='/etc/adduser.conf' |
| 6 | |
| 7 | if test -f $ADDUSERCONF; then |
| 8 | FIRST_SYSTEM_UID=$(sed -n "s/^[[:space:]]*FIRST_SYSTEM_UID[[:space:]]*=[[:space:]]*[\"']\?\([^\"']*\)[\"']\?/\1/p" $ADDUSERCONF) |
| 9 | LAST_SYSTEM_UID=$(sed -n "s/^[[:space:]]*LAST_SYSTEM_UID[[:space:]]*=[[:space:]]*[\"']\?\([^\"']*\)[\"']\?/\1/p" $ADDUSERCONF) |
| 10 | FIRST_SYSTEM_GID=$(sed -n "s/^[[:space:]]*FIRST_SYSTEM_GID[[:space:]]*=[[:space:]]*[\"']\?\([^\"']*\)[\"']\?/\1/p" $ADDUSERCONF) |
| 11 | LAST_SYSTEM_GID=$(sed -n "s/^[[:space:]]*LAST_SYSTEM_GID[[:space:]]*=[[:space:]]*[\"']\?\([^\"']*\)[\"']\?/\1/p" $ADDUSERCONF) |
| 12 | fi |
| 13 | |
| 14 | if test -z "$FIRST_SYSTEM_UID"; then |
| 15 | FIRST_SYSTEM_UID=100 |
| 16 | fi |
| 17 | if test -z "$LAST_SYSTEM_UID"; then |
| 18 | LAST_SYSTEM_UID=999 |
| 19 | fi |
| 20 | if test -z "$FIRST_SYSTEM_GID"; then |
| 21 | FIRST_SYSTEM_GID=100 |
| 22 | fi |
| 23 | if test -z "$LAST_SYSTEM_GID"; then |
| 24 | LAST_SYSTEM_GID=999 |
| 25 | fi |
| 26 | |
| 27 | if ! getent group | grep -q libuuid; then |
| 28 | groupadd -f -K GID_MIN=$FIRST_SYSTEM_GID -K GID_MAX=$LAST_SYSTEM_GID libuuid |
| 29 | fi |
| 30 | if ! getent passwd | grep -q libuuid; then |
| 31 | useradd -d /var/lib/libuuid -K UID_MIN=$FIRST_SYSTEM_UID -K UID_MAX=$LAST_SYSTEM_UID -g libuuid libuuid |
| 32 | fi |
| 33 | |
| 34 | mkdir -p /var/lib/libuuid |
| 35 | chown libuuid:libuuid /var/lib/libuuid |
| 36 | chmod 2775 /var/lib/libuuid |
| 37 | |
| 38 | #DEBHELPER# |
| 39 | |
| 40 | exit 0 |