File: preinst

package info (click to toggle)
smartlist 3.15-25
  • links: PTS
  • area: main
  • in suites: bullseye, buster, stretch
  • size: 2,192 kB
  • ctags: 1,837
  • sloc: ansic: 9,239; sh: 4,947; makefile: 145
file content (37 lines) | stat: -rw-r--r-- 938 bytes parent folder | download | duplicates (5)
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
#!/bin/sh
set -e

LISTHOME="/var/list"
LISTID=38

if ! grep -q "^list:" /etc/passwd; then
cat << FIN
Error: User \`list' does not exist.
You would have to upgrade the base-passwd package.

However, it is possible that the current base-passwd
does not automagically update /etc/passwd entries (yet).
In such case (if you know what you are doing) you may
create a new user with the following specifications:

login name: list, UID: $LISTID
group name: list, GID: $LISTID
home directory: $LISTHOME

FIN
exit 1

else
  if ! grep -q "^list:.*:$LISTID:$LISTID:" /etc/passwd; then
     echo "Error: \`list' user has not uid $LISTID and gid $LISTID"
     echo "Please, fix this before trying again."
     echo ""
     exit 1
  fi
  if ! grep -q "^list:.*:$LISTID:$LISTID:.*:$LISTHOME:" /etc/passwd; then
     echo "Error: \`list' home directory is not $LISTHOME"
     echo "Please, fix this before trying again."
     echo ""
     exit 1
  fi
fi