aboutsummaryrefslogtreecommitdiffstats
path: root/add-group
diff options
context:
space:
mode:
authorFrederic Lepied <flepied@mandriva.com>2002-07-29 14:16:11 +0000
committerFrederic Lepied <flepied@mandriva.com>2002-07-29 14:16:11 +0000
commitd45180d6fb5164aa6abb924207533b20bf7afd0f (patch)
treedd7fe0aaa1afc9f5d0346aa0594072e7a2fd8863 /add-group
parentde2d3c5b57a1be4543d240f228a873d620bfbf96 (diff)
downloadrpm-helper-d45180d6fb5164aa6abb924207533b20bf7afd0f.tar
rpm-helper-d45180d6fb5164aa6abb924207533b20bf7afd0f.tar.gz
rpm-helper-d45180d6fb5164aa6abb924207533b20bf7afd0f.tar.bz2
rpm-helper-d45180d6fb5164aa6abb924207533b20bf7afd0f.tar.xz
rpm-helper-d45180d6fb5164aa6abb924207533b20bf7afd0f.zip
first version
Diffstat (limited to 'add-group')
-rwxr-xr-xadd-group36
1 files changed, 36 insertions, 0 deletions
diff --git a/add-group b/add-group
new file mode 100755
index 0000000..365c043
--- /dev/null
+++ b/add-group
@@ -0,0 +1,36 @@
+#!/bin/sh
+#---------------------------------------------------------------
+# Project : Mandrake Linux
+# Module : rpm-helper
+# File : add-group
+# Version : $Id$
+# Author : Frederic Lepied
+# Created On : Mon Jul 29 15:07:28 2002
+# Purpose : helper script for rpm scriptlets to add a
+# system group.
+#---------------------------------------------------------------
+
+if [ $# -lt 3 ]; then
+ echo "usage: $0 <pkg name> <num installed> <group name> [<user1>,<user2>...]" 1>&2
+ exit 1
+fi
+
+pkg=$1 # name of the package
+num=$2 # number of packages installed
+name=$3 # name of the group
+users=$4 # users to add to this group
+
+SAVED_IFS="$IFS"
+export IFS="$IFS",
+set $users
+IFS="$SAVED_IFS"
+
+/usr/sbin/groupadd -r $name > /dev/null 2>&1
+
+for u in $*; do
+ /usr/sbin/usermod -G $1 $u > /dev/null 2>&1
+done
+
+exit 0
+
+# add-group ends here