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
|
#!/bin/sh
set -e
LISTHOME="/var/list"
LISTID=38
expected_user="list $LISTID $LISTID $LISTHOME"
expected_group="list $LISTID"
actual_user=$(getent passwd list | awk -F: '{ print $1 " " $3 " " $4 " " $6 }')
actual_group=$(getent group list | awk -F: '{ print $1 " " $3 }')
if [ "$actual_user" != "$expected_user" ] || [ "$actual_group" != "$expected_group" ]; then
cat << EOF
Error: The following requirements must be met:
- User 'list' with:
* UID: $LISTID
* GID: $LISTID
* Home: $LISTHOME
- Group 'list' with:
* GID: $LISTID
Please ensure these exist before installation.
EOF
exit 1
fi
|