3 [ -f /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm
4 [ -z "$RPM_SCRIPTVERBOSITY" ] && RPM_SCRIPTVERBOSITY=5
6 if [ -x /usr/bin/banner.sh ]; then
7 BANNERCMD="/usr/bin/banner.sh "
8 BANNERPARA="-s -M user-group.error"
14 if [ "$1" = user -o "$1" = group ]; then
17 echo ERROR | $BANNERCMD $BANNERPARA
24 if [ "$BANNERCMD" == cat ]; then
27 if [ "$RPM_SCRIPTVERBOSITY" -lt 2 ]; then
28 echo "$BANNERCMD -M $1"
30 echo "$BANNERCMD -s -M $1"
37 [ "$RPM_USERDEL" != yes ] && return 1
38 [ -z "$1" ] && return 2
39 rpm -q --whatprovides "${MODE}($1)" >/dev/null 2>&1
40 # no package Provides it (strange)
41 [ $? -ne 0 ] && return 0
42 # only current package Provides it
43 [ `rpm -q --whatprovides "${MODE}($1)" | wc -l` -lt 2 ] && return 0
47 if [ "$1" = "testrm" ]; then
50 elif [ "$1" = del ]; then
52 echo "Removing $MODE $2" | `bannercmd "${MODE}del-$2"`
53 /usr/sbin/${MODE}del $2 || :
55 elif [ "$MODE" = "user" -a "$1" = "addtogroup" ]; then
58 GROUPS=`id -n -G $USER | sed -e's/^[^ ]* //;s/ /,/g'`
59 if ! echo ",$GROUPS," | grep -q ",$GROUP," ; then
60 echo "Adding user $USER to group $GROUP" | `bannercmd "${MODE}mod-$USER"`
61 usermod -G "$GROUPS,$GROUP" $USER