From ae73d756607edc8733ddb5facc7066316c34d11f Mon Sep 17 00:00:00 2001 From: Andres P Date: Sat, 22 May 2010 00:36:52 -0430 Subject: makepkg: replace unnecessary uses of grep Signed-off-by: Andres P Signed-off-by: Allan McRae Signed-off-by: Dan McGee --- scripts/makepkg.sh.in | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index dec771ee..8c0da8be 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -318,12 +318,12 @@ download_file() { local dlfile="${url##*/}" # replace %o by the temporary dlfile if it exists - if echo "$dlcmd" | grep -q "%o" ; then + if [[ $dlcmd = *%o* ]]; then dlcmd=${dlcmd//\%o/\"$file.part\"} dlfile="$file.part" fi # add the URL, either in place of %u or at the end - if echo "$dlcmd" | grep -q "%u" ; then + if [[ $dlcmd = *%u* ]]; then dlcmd=${dlcmd//\%u/\"$url\"} else dlcmd="$dlcmd \"$url\"" @@ -1107,7 +1107,7 @@ create_srcpackage() { fi done - local install_files=( $(grep "^[[:space:]]*install=" "$BUILDSCRIPT" | sed "s/install=//") ) + local install_files=( $(sed -n "s/^\([[:space:]]*\)install=/\1/p" "$BUILDSCRIPT") ) if [[ -n $install_files ]]; then local file for file in ${install_files[@]}; do @@ -1120,7 +1120,7 @@ create_srcpackage() { done fi - local changelog_files=( $(grep "^[[:space:]]*changelog=" "$BUILDSCRIPT" | sed "s/changelog=//") ) + local changelog_files=( $(sed -n "s/^\([[:space:]]*\)changelog=/\1/p" "$BUILDSCRIPT") ) if [[ -n $changelog_files ]]; then local file for file in ${changelog_files[@]}; do @@ -1250,7 +1250,7 @@ check_sanity() { fi done - local install_files=( $(grep "^[[:space:]]*install=" "$BUILDSCRIPT" | sed "s/install=//") ) + local install_files=( $(sed -n "s/^\([[:space:]]*\)install=/\1/p" "$BUILDSCRIPT") ) if [[ -n $install_files ]]; then local file for file in ${install_files[@]}; do @@ -1263,7 +1263,7 @@ check_sanity() { done fi - local changelog_files=( $(grep "^[[:space:]]*changelog=" "$BUILDSCRIPT" | sed "s/changelog=//") ) + local changelog_files=( $(sed -n "s/^\([[:space:]]*\)changelog=/\1/p" "$BUILDSCRIPT") ) if [[ -n $changelog_files ]]; then for file in ${changelog_files[@]}; do # evaluate any bash variables used @@ -1572,7 +1572,7 @@ OPT_LONG="$OPT_LONG,source,syncdeps,version,config:" # Pacman Options OPT_LONG="$OPT_LONG,noconfirm,noprogressbar" OPT_TEMP="$(parse_options $OPT_SHORT $OPT_LONG "$@" || echo 'PARSE_OPTIONS FAILED')" -if echo "$OPT_TEMP" | grep -q 'PARSE_OPTIONS FAILED'; then +if [[ $OPT_TEMP = *'PARSE_OPTIONS FAILED'* ]]; then # This is a small hack to stop the script bailing with 'set -e' echo; usage; exit 1 # E_INVALID_OPTION; fi -- cgit v1.2.3-70-g09d2