From a314a8d37d2bc122b4ccee89c020ab607f70e2d2 Mon Sep 17 00:00:00 2001 From: "chess.griffin" Date: Thu, 20 May 2010 18:03:55 +0000 Subject: [PATCH] tweak the logic to determine ARCH; modify some evals and conditionals for ARCH (including removing an unset ARCH) in check_for_updates and info_item; thanks to slakmagik for his help and suggestions with the patch, including adding the redirects to /dev/null --- ChangeLog-current.txt | 2 ++ src/usr/sbin/sbopkg | 27 ++++++++++++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/ChangeLog-current.txt b/ChangeLog-current.txt index 35cdd7b..06195da 100644 --- a/ChangeLog-current.txt +++ b/ChangeLog-current.txt @@ -18,5 +18,7 @@ enhancements: * Added an option to print the version of sbopkg. We try not to change the meaning of flags but note that this does change what was the '-v' flag to '-V' and now uses '-v' for its customary 'version' purpose. + * Tweak the logic re determining ARCH and modify some ARCH-related + evals and conditionals in check_for_updates and info_item. +--------------------------+ diff --git a/src/usr/sbin/sbopkg b/src/usr/sbin/sbopkg index 91c9342..46c720b 100755 --- a/src/usr/sbin/sbopkg +++ b/src/usr/sbin/sbopkg @@ -704,9 +704,12 @@ check_for_updates() { # Extract the new package version if [[ ! -z $NEWSB ]]; then - unset ARCH BUILD - eval NEW$(grep -m1 ^ARCH= $NEWSB) - eval NEW$(grep -m1 ^BUILD= $NEWSB) + unset BUILD + eval NEW$(grep -m1 ^ARCH= $NEWSB) 2>/dev/null + if [[ $NEWARCH != "noarch" ]]; then + NEWARCH=$ARCH + fi + eval NEW$(grep -m1 ^BUILD= $NEWSB) 2>/dev/null [[ -z $NEWARCH ]] && NEWARCH=unknown # Step 1 - find the version expression @@ -1133,7 +1136,10 @@ info_item() { SHORTPATH=$REPO_DIR/$CATEGORY/$APP CURVERSION=$(grep VERSION $SHORTPATH/$APP.info | cut -d= -f2 | sed s/\"//g) - eval CUR$(grep -m1 ^ARCH= $SHORTPATH/$APP.SlackBuild) + eval CUR$(grep -m1 ^ARCH= $SHORTPATH/$APP.SlackBuild) 2>/dev/null + if [[ $CURARCH != "noarch" ]]; then + CURARCH=$ARCH + fi eval CUR$(grep -m1 ^BUILD= $SHORTPATH/$APP.SlackBuild) [[ -z $CURARCH ]] && CURARCH=unknown while :; do @@ -4385,9 +4391,16 @@ if [[ $(id -u) != 0 ]]; then exit 1 fi -# Set up ARCH -if [[ ! $(uname -m) =~ i.86 ]]; then - export ARCH=${ARCH:-$(uname -m)} +# Set up ARCH - borrowed from SBo SlackBuild template +# Automatically determine the architecture we're building on: +if [[ -z "$ARCH" ]]; then + case "$( uname -m )" in + i?86) export ARCH=i486 ;; + arm*) export ARCH=arm ;; + # Unless $ARCH is already set, use uname -m for all other + # archs: + *) export ARCH=$( uname -m ) ;; + esac fi # Set up BACKTITLE