File: preinst

package info (click to toggle)
smartlist 3.15-28
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,308 kB
  • sloc: ansic: 9,238; sh: 4,901; makefile: 118
file content (27 lines) | stat: -rw-r--r-- 604 bytes parent folder | download
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