blob: 5336fcfdf068083dae53c374a023282f841626e8 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001#!/bin/sh
2
3set -e
4
5ADDUSERCONF='/etc/adduser.conf'
6
7if 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)
12fi
13
14if test -z "$FIRST_SYSTEM_UID"; then
15 FIRST_SYSTEM_UID=100
16fi
17if test -z "$LAST_SYSTEM_UID"; then
18 LAST_SYSTEM_UID=999
19fi
20if test -z "$FIRST_SYSTEM_GID"; then
21 FIRST_SYSTEM_GID=100
22fi
23if test -z "$LAST_SYSTEM_GID"; then
24 LAST_SYSTEM_GID=999
25fi
26
27if ! getent group | grep -q libuuid; then
28 groupadd -f -K GID_MIN=$FIRST_SYSTEM_GID -K GID_MAX=$LAST_SYSTEM_GID libuuid
29fi
30if ! 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
32fi
33
34mkdir -p /var/lib/libuuid
35chown libuuid:libuuid /var/lib/libuuid
36chmod 2775 /var/lib/libuuid
37
38#DEBHELPER#
39
40exit 0