aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2002-11-05 13:35:21 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2002-11-05 13:35:21 +0000
commit8c2427a4ca71e296e792759165232998f9dc8bee (patch)
treea6024d2c165fa640cece5c4872cbc4ae74c3c5a3
parent16fc683886435bcdfdcf994740bd75e07c09944c (diff)
downloadrpm-helper-8c2427a4ca71e296e792759165232998f9dc8bee.tar
rpm-helper-8c2427a4ca71e296e792759165232998f9dc8bee.tar.gz
rpm-helper-8c2427a4ca71e296e792759165232998f9dc8bee.tar.bz2
rpm-helper-8c2427a4ca71e296e792759165232998f9dc8bee.tar.xz
rpm-helper-8c2427a4ca71e296e792759165232998f9dc8bee.zip
add {add,del}-shell
-rwxr-xr-xadd-shell32
-rwxr-xr-xdel-shell36
2 files changed, 68 insertions, 0 deletions
diff --git a/add-shell b/add-shell
new file mode 100755
index 0000000..cd8ecb0
--- /dev/null
+++ b/add-shell
@@ -0,0 +1,32 @@
+#!/bin/sh
+#---------------------------------------------------------------
+# Project : Mandrake Linux
+# Module : rpm-helper
+# File : add-shell
+# Version : $Id$
+# Author : Thierry Vignaud
+# Created On : Tue Nov 5 13:52:20 2002
+# Purpose : helper script for rpm scriptlets to add a
+# shell from $CFG_FILE.
+#---------------------------------------------------------------
+
+if [ $# != 3 ]; then
+ echo "usage: $0 <pkg name> <number installed> <shell name>" 1>&2
+ exit 1
+fi
+
+pkg=$1 # name of the package
+num=$2 # number of packages installed
+shl=$3 # name of the shell
+
+CFG_FILE=/etc/shells
+
+# Create $CFG_FILE if needed
+if [ ! -f $CFG_FILE ]; then
+ > $CFG_FILE
+fi
+
+if [ $num = 1 ]; then
+ grep -v "^$shl$" && echo $shl >> $CFG_FILE
+fi
+
diff --git a/del-shell b/del-shell
new file mode 100755
index 0000000..fa1d4b2
--- /dev/null
+++ b/del-shell
@@ -0,0 +1,36 @@
+#!/bin/sh
+#---------------------------------------------------------------
+# Project : Mandrake Linux
+# Module : rpm-helper
+# File : del-shell
+# Version : $Id$
+# Author : Thierry Vignaud
+# Created On : Tue Nov 5 13:52:20 2002
+# Purpose : helper script for rpm scriptlets to remove a
+# shell from /etc/shells.
+#---------------------------------------------------------------
+
+if [ $# != 3 ]; then
+ echo "usage: $0 <pkg name> <number installed> <shell name>" 1>&2
+ exit 1
+fi
+
+pkg=$1 # name of the package
+num=$2 # number of packages installed
+shl=$3 # name of the shell
+
+CFG_FILE=/etc/shells
+
+# Create $CFG_FILE if needed
+if [ ! -f $CFG_FILE ]; then
+ > $CFG_FILE
+ exit 0
+fi
+
+if [ "$num" = 0 ]; then
+ if [ ! -x $shl ]; then
+ grep -v "^$shl$" < $CFG_FILE > $CFG_FILE.new
+ mv -f $CFG_FILE.new $CFG_FILE
+ fi
+fi
+