summaryrefslogtreecommitdiff
path: root/debian/libuuid1.postinst
blob: 5336fcfdf068083dae53c374a023282f841626e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh

set -e

ADDUSERCONF='/etc/adduser.conf'

if test -f $ADDUSERCONF; then
    FIRST_SYSTEM_UID=$(sed -n "s/^[[:space:]]*FIRST_SYSTEM_UID[[:space:]]*=[[:space:]]*[\"']\?\([^\"']*\)[\"']\?/\1/p" $ADDUSERCONF)
    LAST_SYSTEM_UID=$(sed -n "s/^[[:space:]]*LAST_SYSTEM_UID[[:space:]]*=[[:space:]]*[\"']\?\([^\"']*\)[\"']\?/\1/p" $ADDUSERCONF)
    FIRST_SYSTEM_GID=$(sed -n "s/^[[:space:]]*FIRST_SYSTEM_GID[[:space:]]*=[[:space:]]*[\"']\?\([^\"']*\)[\"']\?/\1/p" $ADDUSERCONF)
    LAST_SYSTEM_GID=$(sed -n "s/^[[:space:]]*LAST_SYSTEM_GID[[:space:]]*=[[:space:]]*[\"']\?\([^\"']*\)[\"']\?/\1/p" $ADDUSERCONF)
fi

if test -z "$FIRST_SYSTEM_UID"; then
    FIRST_SYSTEM_UID=100
fi
if test -z "$LAST_SYSTEM_UID"; then
    LAST_SYSTEM_UID=999
fi
if test -z "$FIRST_SYSTEM_GID"; then
    FIRST_SYSTEM_GID=100
fi
if test -z "$LAST_SYSTEM_GID"; then
    LAST_SYSTEM_GID=999
fi

if ! getent group | grep -q libuuid; then
  groupadd -f -K GID_MIN=$FIRST_SYSTEM_GID -K GID_MAX=$LAST_SYSTEM_GID libuuid
fi
if ! getent passwd | grep -q libuuid; then
   useradd -d /var/lib/libuuid -K UID_MIN=$FIRST_SYSTEM_UID -K UID_MAX=$LAST_SYSTEM_UID -g libuuid libuuid
fi

mkdir -p /var/lib/libuuid
chown libuuid:libuuid /var/lib/libuuid
chmod 2775 /var/lib/libuuid

#DEBHELPER#

exit 0