SOURCES: rpm-user_group.sh - if [ foo == bar ] bashism kill - drop...

glen glen at pld-linux.org
Thu Jun 15 17:25:03 CEST 2006


Author: glen                         Date: Thu Jun 15 15:25:03 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- if [ foo == bar ] bashism kill
- drop sed dependency ([[ foo ]] supported by pdksh)
- drop unneccessary banner call on error

---- Files affected:
SOURCES:
   rpm-user_group.sh (1.7 -> 1.8) 

---- Diffs:

================================================================
Index: SOURCES/rpm-user_group.sh
diff -u SOURCES/rpm-user_group.sh:1.7 SOURCES/rpm-user_group.sh:1.8
--- SOURCES/rpm-user_group.sh:1.7	Wed May 10 07:44:10 2006
+++ SOURCES/rpm-user_group.sh	Thu Jun 15 17:24:58 2006
@@ -14,14 +14,14 @@
 if [ "$1" = user -o "$1" = group ]; then
 	MODE=$1
 else
-	echo ERROR | $BANNERCMD $BANNERPARA
+	echo ERROR
 	exit 2
 fi
 shift
 
 bannercmd()
 {
-	if [ "$BANNERCMD" == cat ]; then
+	if [ "$BANNERCMD" = cat ]; then
 		echo cat
 	else
 		if [ "$RPM_SCRIPTVERBOSITY" -lt 2 ]; then
@@ -63,10 +63,10 @@
 		fi
 	fi
 elif [ "$MODE" = "user" -a "$1" = "addtogroup" ]; then
-	CUSER=$2
-	CGROUP=$3
-	CGROUPS=`id -n -G $CUSER | sed -e's/^[^ ]* //;s/ /,/g'`
-	if ! echo ",$CGROUPS," | grep -q ",$CGROUP," ; then
+	CUSER="$2"
+	CGROUP="$3"
+	CGROUPS=$(id -n -G $CUSER)
+	if [[ " $CGROUPS " != *\ $CGROUP\ * ]]; then
 	    echo "Adding user $CUSER to group $CGROUP" | `bannercmd "${MODE}mod-$CUSER"`
 	    usermod -G "$CGROUPS,$CGROUP" $CUSER
 	fi
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/rpm-user_group.sh?r1=1.7&r2=1.8&f=u



More information about the pld-cvs-commit mailing list