aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog58
-rw-r--r--Makefile3
-rwxr-xr-xadd-group36
-rwxr-xr-xadd-user6
-rwxr-xr-xcreate-file31
-rwxr-xr-xdel-group24
-rw-r--r--rpm-helper.spec11
7 files changed, 165 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index e69de29..cedeaa9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -0,0 +1,58 @@
+2002-07-29 17:25 Frederic Lepied <flepied@mandrakesoft.com>
+
+ * rpm-helper.spec: 0.4-1mdk
+
+2002-07-29 17:25 Frederic Lepied <flepied@mandrakesoft.com>
+
+ * add-user: removed group management
+
+2002-07-29 17:24 Frederic Lepied <flepied@mandrakesoft.com>
+
+ * del-group: added comment
+
+2002-07-29 17:22 Frederic Lepied <flepied@mandrakesoft.com>
+
+ * add-group: corrected group argument passing
+
+2002-07-29 17:16 Frederic Lepied <flepied@mandrakesoft.com>
+
+ * Makefile: add-group del-group
+
+2002-07-29 16:15 Frederic Lepied <flepied@mandrakesoft.com>
+
+ * del-group, add-group: first version
+
+2002-07-12 17:22 Frederic Lepied <flepied@mandrakesoft.com>
+
+ * rpm-helper.spec: 0.3-1mdk
+
+2002-07-12 17:20 Frederic Lepied <flepied@mandrakesoft.com>
+
+ * add-user: added missing groupadd call
+
+2002-07-12 17:19 Frederic Lepied <flepied@mandrakesoft.com>
+
+ * add-user: added support for extended groups
+
+2002-07-10 15:12 Frederic Lepied <flepied@mandrakesoft.com>
+
+ * rpm-helper.spec: 0.2-1mdk
+
+2002-07-10 15:10 Frederic Lepied <flepied@mandrakesoft.com>
+
+ * Makefile: added create-file
+
+2002-07-10 15:08 Frederic Lepied <flepied@mandrakesoft.com>
+
+ * create-file: first version
+
+2002-07-09 17:04 Frederic Lepied <flepied@mandrakesoft.com>
+
+ * AUTHORS, COPYING, Makefile, README, README.CVS, add-service,
+ add-user, del-service, del-user, rpm-helper.spec: Initial version
+
+2002-07-09 17:04 Frederic Lepied <flepied@mandrakesoft.com>
+
+ * AUTHORS, COPYING, Makefile, README, README.CVS, add-service,
+ add-user, del-service, del-user, rpm-helper.spec: Initial revision
+
diff --git a/Makefile b/Makefile
index 9d34753..15bb21d 100644
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,8 @@ TAG := $(shell echo "V$(VERSION)_$(RELEASE)" | tr -- '-.' '__')
FILES = AUTHORS README README.CVS COPYING ChangeLog Makefile \
$(PACKAGE).spec $(SCRIPTS)
-SCRIPTS = add-user del-user add-service del-service
+SCRIPTS = add-user del-user add-service del-service create-file \
+ add-group del-group
LIBDIR=/usr/share/rpm-helper
diff --git a/add-group b/add-group
new file mode 100755
index 0000000..add2213
--- /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 $name $u > /dev/null 2>&1
+done
+
+exit 0
+
+# add-group ends here
diff --git a/add-user b/add-user
index 0a44fc8..74bbcee 100755
--- a/add-user
+++ b/add-user
@@ -10,7 +10,7 @@
# system user.
#---------------------------------------------------------------
-if [ $# != 5 ]; then
+if [ $# -lt 5 ]; then
echo "usage: $0 <pkg name> <num installed> <user name> <home dir> <shell>" 1>&2
exit 1
fi
@@ -21,6 +21,8 @@ name=$3 # name of the user
dir=$4 # home directory
shell=$5 # shell
-/usr/sbin/useradd -r -M -s $shell -d $dir -c "system user for $pkg" $name > /dev/null 2>&1 || :
+/usr/sbin/useradd -r -M -s $shell -d $dir -c "system user for $pkg" $garg $name > /dev/null 2>&1
+
+exit 0
# add-user ends here
diff --git a/create-file b/create-file
new file mode 100755
index 0000000..6dce7c1
--- /dev/null
+++ b/create-file
@@ -0,0 +1,31 @@
+#!/bin/sh
+#---------------------------------------------------------------
+# Project : Mandrake Linux
+# Module : rpm-helper
+# File : create-file
+# Version : $Id$
+# Author : Frederic Lepied
+# Created On : Wed Jul 10 15:12:29 2002
+# Purpose : helper script for rpm scriptlets to create
+# a non existent file.
+#---------------------------------------------------------------
+
+if [ $# != 6 ]; then
+ echo "usage: $0 <pkg name> <num installed> <file> <owner> <group> <mode>" 1>&2
+ exit 1
+fi
+
+pkg=$1 # name of the package
+num=$2 # number of packages installed
+file=$3 # filename
+owner=$4 # owner of the file
+group=$5 # group of the file
+mode=$6 # mode of the file
+
+if [ ! -f $file ]; then
+ touch $file
+ chown $owner.$group $file
+ chmod $mode $file
+fi
+
+# create-file ends here
diff --git a/del-group b/del-group
new file mode 100755
index 0000000..f598231
--- /dev/null
+++ b/del-group
@@ -0,0 +1,24 @@
+#!/bin/sh
+#---------------------------------------------------------------
+# Project : Mandrake Linux
+# Module : rpm-helper
+# File : del-group
+# Version : $Id$
+# Author : Frederic Lepied
+# Created On : Mon Jul 29 16:17:34 2002
+# Purpose : helper script for rpm scriptlets to remove a
+# system group.
+#---------------------------------------------------------------
+
+if [ $# -lt 3 ]; then
+ echo "usage: $0 <pkg name> <num installed> <group name>" 1>&2
+ exit 1
+fi
+
+pkg=$1 # name of the package
+num=$2 # number of packages installed
+name=$3 # name of the group
+
+exit 0
+
+# del-group ends here
diff --git a/rpm-helper.spec b/rpm-helper.spec
index 7ae5214..75b2cfa 100644
--- a/rpm-helper.spec
+++ b/rpm-helper.spec
@@ -10,7 +10,7 @@
Summary: Helper scripts for rpm scriptlets
Name: rpm-helper
-Version: 0.1
+Version: 0.4
Release: 1mdk
Source0: %{name}-%{version}.tar.bz2
License: GPL
@@ -41,6 +41,15 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/%{name}
%changelog
+* Mon Jul 29 2002 Frederic Lepied <flepied@mandrakesoft.com> 0.4-1mdk
+- added del-group and add-group
+
+* Fri Jul 12 2002 Frederic Lepied <flepied@mandrakesoft.com> 0.3-1mdk
+- extend add-user to support extended groups
+
+* Wed Jul 10 2002 Frederic Lepied <flepied@mandrakesoft.com> 0.2-1mdk
+- added create-file
+
* Tue Jul 9 2002 Frederic Lepied <flepied@mandrakesoft.com> 0.1-1mdk
- Initial version