]> git.ipfire.org Git - people/ms/ipfire-3.x.git/commitdiff
bash: Replace grep in scriptlet.
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 17 Oct 2011 11:55:29 +0000 (13:55 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 17 Oct 2011 11:55:29 +0000 (13:55 +0200)
grep could not be correctly installed to be available for the
install script.

bash/bash.nm

index 0c57eab1615720183c7c66a69bcbba9f0a257761..d9d33b34cf015b14b8ddba78138d50600049f5ec 100644 (file)
@@ -5,7 +5,7 @@
 
 name       = bash
 version    = 4.2
-release    = 3
+release    = 4
 
 groups     = Base Build System/Tools
 url        = http://www.gnu.org/software/bash/
@@ -67,17 +67,28 @@ end
 
 packages
        package %{name}
+               prerequires = coreutils
                requires = /etc/bashrc /etc/profile
 
                script postin
                        # Create /etc/shells, if it does not exist.
                        [ -f "/etc/shells" ] || touch /etc/shells
 
-                       if ! grep -q "/bin/bash" /etc/shells; then
+                       found_sh=0
+                       found_bash=0
+                       while read line; do
+                               if [ "/bin/bash" = "${line}" ]; then
+                                       found_bash=1
+                               elif [ "/bin/sh" = "${line}" ]; then
+                                       found_sh=1
+                               fi
+                       done < /etc/shells
+
+                       if [ "${found_bash}" = "0" ]; then
                                echo "/bin/bash" >> /etc/shells
                        fi
 
-                       if ! grep -q "/bin/sh" /etc/shells; then
+                       if [ "${found_sh}" = "0" ]; then
                                echo "/bin/sh" >> /etc/shells
                        fi
                end
@@ -87,9 +98,9 @@ packages
 
                        # Remove /bin/bash and /bin/sh from /etc/shells.
                        while read line; do
-                               if [[ $line =~ ^/bin/sh ]]; then
+                               if [ "/bin/bash" = "${line}" ]; then
                                        continue
-                               elif [[ $line =~ ^/bin/bash ]]; then
+                               elif [ "/bin/sh" = "${line}" ]; then
                                        continue
                                fi