File: roundup.preinst

package info (click to toggle)
roundup 1.2.1-10%2Betch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 4,764 kB
  • ctags: 3,756
  • sloc: python: 30,296; sh: 1,497; perl: 23; makefile: 22
file content (47 lines) | stat: -rw-r--r-- 963 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/sh -e

# thanks to the nut maintainer(s)

# source the debconf library
#. /usr/share/debconf/confmodule

check_and_create_group() {
	if [ ! "`getent group roundup`" ]; then
		addgroup --quiet --system roundup
	fi
}

check_and_create_user() {
	if [ ! "`getent passwd roundup`" ]; then
		adduser --quiet --system --ingroup roundup --home /var/lib/roundup --no-create-home roundup
	fi
	groupmod -g `id -u roundup` roundup 2>/dev/null || true
	usermod -g `getent group roundup | sed -e 's/^.*x//' -e 's/://g'` roundup || true
}

case "$1" in

  install)
    # Check for existing roundup system account, and create it if needed
    check_and_create_group
    check_and_create_user
    ;;

  upgrade)
    # Check for existing roundup system account, and create it if needed
    check_and_create_group
    check_and_create_user
    ;;

  abort-upgrade)
    # do nothing
    ;;

  *)
    echo "$0: incorrect arguments: $*" >&2
    exit 1
    ;;
esac

#DEBHELPER#