File: mon.preinst

package info (click to toggle)
mon 1.2.0-9
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,860 kB
  • ctags: 538
  • sloc: perl: 15,847; ansic: 774; sh: 330; makefile: 46
file content (45 lines) | stat: -rw-r--r-- 839 bytes parent folder | download | duplicates (8)
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
41
42
43
44
45
#!/bin/sh
#
# Author: Dario Minnucci <midget@debian.org>
# Date:   Fri, 29 Jun 2007 00:28:43 +0200
#
#         'mon' user name availability is checked on install step.
#         'mon' group name availability is checked on install step.
#

set -e

#echo "----------------------------------------------"
#echo " debian/mon.preinst: $1"
#echo "----------------------------------------------"

add_user_if_needed () {

	#
	# Check if 'mon' user is already present in the system,
	# if not, then create 'mon' user and group.
	#
	if ! getent passwd mon >/dev/null; then

		echo -n "Creating user 'mon' ... "
		adduser \
			--gecos "mon daemon" \
			--quiet \
			--system \
			--group \
			--disabled-password \
			--home /var/lib/mon \
			mon
		echo "done."

	fi
}

case "$1" in
    install | upgrade)
	add_user_if_needed
	;;
esac

#DEBHELPER#