Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Nov 2013 21:38:46 +0000 (UTC)
From:      Devin Teske <dteske@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r257819 - in head/usr.sbin/bsdconfig/share: . media
Message-ID:  <201311072138.rA7Lck2Z067365@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dteske
Date: Thu Nov  7 21:38:46 2013
New Revision: 257819
URL: http://svnweb.freebsd.org/changeset/base/257819

Log:
  Use `pkg -vv' to obtain ABI for validating a chosen media server (done
  prior to diving head-long into a pkg-update(8), et. al). This should
  also be more future-proof than what was being done just before this.

Modified:
  head/usr.sbin/bsdconfig/share/common.subr
  head/usr.sbin/bsdconfig/share/media/http.subr

Modified: head/usr.sbin/bsdconfig/share/common.subr
==============================================================================
--- head/usr.sbin/bsdconfig/share/common.subr	Thu Nov  7 21:20:34 2013	(r257818)
+++ head/usr.sbin/bsdconfig/share/common.subr	Thu Nov  7 21:38:46 2013	(r257819)
@@ -62,12 +62,10 @@ export UNAME_S="$(uname -s)" # Operating
 export UNAME_P="$(uname -p)" # Processor Architecture (i.e. i386)
 export UNAME_M="$(uname -m)" # Machine platform (i.e. i386)
 export UNAME_R="$(uname -r)" # Release Level (i.e. X.Y-RELEASE)
-if [ ! "$UNAME_PKG" ]; then
-	case "$UNAME_M:$UNAME_P" in
-	  i386:i386) UNAME_PKG="x86:32" ;;
-	amd64:amd64) UNAME_PKG="x86:64" ;;
-	          *) UNAME_PKG="$UNAME_M:$UNAME_P"
-	esac
+if [ ! "${PKG_ABI+set}" ]; then
+	export PKG_ABI="$(
+		pkg -vv | awk '$1=="ABI:"{print $2;exit}' 2> /dev/null
+	)"
 fi
 
 #

Modified: head/usr.sbin/bsdconfig/share/media/http.subr
==============================================================================
--- head/usr.sbin/bsdconfig/share/media/http.subr	Thu Nov  7 21:20:34 2013	(r257818)
+++ head/usr.sbin/bsdconfig/share/media/http.subr	Thu Nov  7 21:38:46 2013	(r257819)
@@ -499,9 +499,8 @@ f_media_init_http()
 			#
 			local fdir hp
 			f_getvar $VAR_HTTP_PATH%/ hp
-			setvar $VAR_HTTP_PATH \
-				"$hp/freebsd:${UNAME_R%%.*}:$UNAME_PKG/latest"
-			if f_http_check_access; then
+			setvar $VAR_HTTP_PATH "$hp/$PKG_ABI/latest"
+			if [ "$PKG_ABI" ] && f_http_check_access; then
 				http_found=$SUCCESS
 			else
 				for fdir in $HTTP_DIRS; do



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311072138.rA7Lck2Z067365>