From: Michael Tremer Date: Mon, 17 Oct 2011 11:55:29 +0000 (+0200) Subject: bash: Replace grep in scriptlet. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c84c1f1a535fbd300d413fc5d6fc52f019a13a6c;p=ipfire-3.x.git bash: Replace grep in scriptlet. grep could not be correctly installed to be available for the install script. --- 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