File: gnumed-common.config

package info (click to toggle)
gnumed-client 0.2.2a-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 3,448 kB
  • ctags: 3,620
  • sloc: python: 32,178; sh: 231; makefile: 97
file content (75 lines) | stat: -rw-r--r-- 1,979 bytes parent folder | download | duplicates (2)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/sh
set -e

PROG=gnumed
GROUP=${PROG}
PROGUSERS=""

DEBCONF_DEBUG=developer

. /usr/share/debconf/confmodule
db_version 2.0

## Add group ${PROG} if not existent

## This returns the group including the members of the group which are needed later
TESTGROUP=`getent group ${GROUP}` || true
if [ -z "${TESTGROUP}" ] ; then
	/usr/sbin/addgroup --system "${GROUP}" >/dev/null
	# if the group was just created it can not have any users ...
	PROGUSERS="none"
fi

# store user info in TMPFILE
TMPFILE=`tempfile`

[ -s /etc/adduser.conf ] && . /etc/adduser.conf
if [ _"$FIRST_UID" = _"" ] ; then
	FIRST_UID=1000
fi

(IFS=":"
    while read user pass uid gid name rest ; do
	if [ $uid -ge $FIRST_UID ] ; then
	    if [ ! "$user" = "nobody" ] ; then
		name=`echo $name | sed "s/,.*//"`
		echo "$user ($name)" >> ${TMPFILE}
	    fi
	fi
    done < /etc/passwd
)

# Login names of all users of the system as comma separated list
USERS=`sort -u "${TMPFILE}" | tr '\n' ',' | sed 's/,/&\ /g' | sed 's/, *$//g'`

# "login (Real Name)" of group "${PROG}" as comma separated list
if [ "$PROGUSERS" != "none" ] ; then
    PROGUSERS=`echo "${TESTGROUP}" | sed "s/.*:\([^:]*\)/\1/" | tr ',' '\n'`
    # check whether the TESTGROUP contains any user or is just empty
    if [  _"$PROGUSERS" != _"" ] ; then
	TMPFILE2=`tempfile`
	for user in "${PROGUSERS}" ; do
	    # add "|| true" because of -e option which would cause an exit otherwise
	    grep -w "$user" "$TMPFILE" >> "$TMPFILE2" || true
	done
	mv "$TMPFILE2" "$TMPFILE"
	PROGUSERS=`sort -u "${TMPFILE}" | tr '\n' ',' | sed 's/,/&\ /g' | sed 's/, *$//g'`
    fi
else
    PROGUSERS=""
fi
rm -rf "${TMPFILE}"

# Check for system users who just belong to group ${PROG}
if [ ! _"$PROGUSERS" = _"" ] ; then
    db_set ${GROUP}/group "$PROGUSERS" || true
fi

# Initialize List of Systemusers for debconf question
db_subst ${GROUP}/group users "$USERS" || true
   
db_get ${GROUP}/group || true

db_input low ${GROUP}/group || true

db_go || true