From c84c1f1a535fbd300d413fc5d6fc52f019a13a6c Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Mon, 17 Oct 2011 13:55:29 +0200 Subject: [PATCH] bash: Replace grep in scriptlet. grep could not be correctly installed to be available for the install script. --- bash/bash.nm | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/bash/bash.nm b/bash/bash.nm index 0c57eab16..d9d33b34c 100644 --- a/bash/bash.nm +++ b/bash/bash.nm @@ -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 -- 2.39.2