[PC-BSD Commits] r8041 - in pcbsd/current/src-sh/pbi-manager: . etc man repo

svn at pcbsd.org svn at pcbsd.org
Thu Nov 18 10:54:32 PST 2010


Author: kris
Date: 2010-11-18 10:54:31 -0800 (Thu, 18 Nov 2010)
New Revision: 8041

Added:
   pcbsd/current/src-sh/pbi-manager/repo/
   pcbsd/current/src-sh/pbi-manager/repo/pcbsd.rpo
Removed:
   pcbsd/current/src-sh/pbi-manager/keys/
Modified:
   pcbsd/current/src-sh/pbi-manager/etc/pbi.conf
   pcbsd/current/src-sh/pbi-manager/install.sh
   pcbsd/current/src-sh/pbi-manager/man/pbi.conf.1
   pcbsd/current/src-sh/pbi-manager/man/pbi_listrepo.1
   pcbsd/current/src-sh/pbi-manager/man/pbi_makerepo.1
   pcbsd/current/src-sh/pbi-manager/pbi-manager
Log:

Update to pbi-manager:

* Added Mirror URL to the repo, which can be changed by user
* PBIs now are associated to specific repos for update checking
* Cleaned up pbi.conf
* Added default repo which is installed on fresh sytems
* Added new flag to makerepo for the default mirror URL



Modified: pcbsd/current/src-sh/pbi-manager/etc/pbi.conf
===================================================================
--- pcbsd/current/src-sh/pbi-manager/etc/pbi.conf	2010-11-17 20:34:35 UTC (rev 8040)
+++ pcbsd/current/src-sh/pbi-manager/etc/pbi.conf	2010-11-18 18:54:31 UTC (rev 8041)
@@ -1,7 +1,3 @@
 # PBI Configuration Defaults
-
-# Default PBI Update Server
-PBI_UPDATEURL: https://update.pbidir.com/
-
-# Default PC-BSD Mirror for PBI / System Updates / Meta-Pkgs
-PBI_MIRROR: ftp://ftp.pcbsd.org/pub/snapshots
+# This file is normally empty, except when using a PROXY
+# See the manpage for pbi.conf for more details

Modified: pcbsd/current/src-sh/pbi-manager/install.sh
===================================================================
--- pcbsd/current/src-sh/pbi-manager/install.sh	2010-11-17 20:34:35 UTC (rev 8040)
+++ pcbsd/current/src-sh/pbi-manager/install.sh	2010-11-18 18:54:31 UTC (rev 8041)
@@ -50,10 +50,12 @@
 cp ${DIR}/icons/default.png ${LB}/share/pbi-manager/icons
 cp ${DIR}/icons/patch.png ${LB}/share/pbi-manager/icons
 
-mkdir -p /var/db/pbi/keys >/dev/null 2>/dev/null
+# If this is a new install, add the PC-BSD master repo
+if [ ! -d "/var/db/pbi/keys" ] ; then
+	rehash
+	pbi_addrepo ${DIR}/repo/pcbsd.rpo
+fi
 chmod 755 /var/db/pbi/keys
-cp ${DIR}/keys/*.ssl /var/db/pbi/keys/
-chmod 755 /var/db/pbi/keys/*.ssl
 
 # Copy the ldconfig script / pbi.conf
 #mkdir -p ${LB}/etc/rc.d >/dev/null 2>/dev/null

Modified: pcbsd/current/src-sh/pbi-manager/man/pbi.conf.1
===================================================================
--- pcbsd/current/src-sh/pbi-manager/man/pbi.conf.1	2010-11-17 20:34:35 UTC (rev 8040)
+++ pcbsd/current/src-sh/pbi-manager/man/pbi.conf.1	2010-11-18 18:54:31 UTC (rev 8041)
@@ -1,4 +1,4 @@
-.Dd Aug 18, 2010
+.Dd Nov 18, 2010
 .Dt PBI.CONF 1
 .Os
 .Sh NAME
@@ -12,15 +12,6 @@
 .Pp
 .Sh OPTIONS
 .Bl -tag -width indent
-.It PBI_UPDATEURL:
-The default update server to query for PBI updates, and check if application an exists for
-download with 'pbi_add -r'.
-.It PBI_PUBKEYS:
-This value provides a space-seperated list of public SSL keys we can use to verify the
-digital signature of signed PBI files. 
-.It PBI_MIRROR:
-The default mirror server to download PBI files / updates, relative to the path
-returned by the update server at PBI_UPDATEURL. 
 .It PBI_PROXYURL:
 Proxy server address to use for proxy communication via CURL.
 .It PBI_PROXYPORT:

Modified: pcbsd/current/src-sh/pbi-manager/man/pbi_listrepo.1
===================================================================
--- pcbsd/current/src-sh/pbi-manager/man/pbi_listrepo.1	2010-11-17 20:34:35 UTC (rev 8040)
+++ pcbsd/current/src-sh/pbi-manager/man/pbi_listrepo.1	2010-11-18 18:54:31 UTC (rev 8041)
@@ -7,6 +7,7 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl -down
+.Op Fl -mirror Ar url
 .Op Fl -up
 .Op Ar repoid
 .Sh DESCRIPTION
@@ -19,6 +20,8 @@
 .Bl -tag -width indent
 .It Fl -down
 Move the targeted repoid down a single number in priority
+.It Fl -mirror Ar url
+Change the specific repoid's mirror URL
 .It Fl -up 
 Move the targeted repoid up a single number in priority
 .El

Modified: pcbsd/current/src-sh/pbi-manager/man/pbi_makerepo.1
===================================================================
--- pcbsd/current/src-sh/pbi-manager/man/pbi_makerepo.1	2010-11-17 20:34:35 UTC (rev 8040)
+++ pcbsd/current/src-sh/pbi-manager/man/pbi_makerepo.1	2010-11-18 18:54:31 UTC (rev 8041)
@@ -8,7 +8,8 @@
 .Nm
 .Op Fl -desc Ar description
 .Op Fl -key Ar keyfile
-.Op Fl -url Ar url
+.Op Fl -mirror Ar mirrorurl
+.Op Fl -url Ar indexurl
 .Op Ar outdir
 .Sh DESCRIPTION
 The utility,
@@ -26,7 +27,10 @@
 with the openssl command below:
 # openssl genrsa -out privkey.pem 4056
 # openssl rsa -in privkey.pem -pubout 
-.It Fl -url Ar url
+.It Fl -mirror Ar mirrorurl
+(Required) The url you wish this repo to use when downloading PBIs and updates found
+in the repo's index file. 
+.It Fl -url Ar indexurl
 (Required) The url you wish this repo to use when trying to download the master
 INDEX files of PBIs available. I.E. "http://update.pbidir.com", will be expanded
 to "http://update.pbidir.com/pbi-index-<major freebsd version>"

Modified: pcbsd/current/src-sh/pbi-manager/pbi-manager
===================================================================
--- pcbsd/current/src-sh/pbi-manager/pbi-manager	2010-11-17 20:34:35 UTC (rev 8040)
+++ pcbsd/current/src-sh/pbi-manager/pbi-manager	2010-11-18 18:54:31 UTC (rev 8041)
@@ -42,6 +42,7 @@
   --no-checksum  -- Skip the checksum verification during installation
   --no-checksig  -- Ignore signature verification and force install
   --no-hash      -- Disable using shared hash folder for PBI
+  --repo repoid  -- Used with -r to specify the specific repo to pull from
 
 EOF
         exit_trap
@@ -183,6 +184,7 @@
                 
 Options:
   --down   	-- Move the specified repoid down in priority
+  --mirror url 	-- Change the target repoid's mirror url
   --up  	-- Move the specified repoid up in priority
 
 EOF
@@ -349,6 +351,9 @@
                 case "$1" in
               --up)     PBI_LISTREPO_UP="YES" ;; 
             --down)     PBI_LISTREPO_DOWN="YES" ;; 
+          --mirror)	if [ $# -eq 1  ]; then usage_listrepo_pbi; fi
+                       	shift; PBI_LISTREPO_MIRROR="$1"
+			;;
                  *)	if [ $# -gt 1  ]; then usage_listrepo_pbi; fi
                        	PBI_LISTREPO_ID="$1"
                         ;;
@@ -365,6 +370,9 @@
 	if [ "${PBI_LISTREPO_DOWN}" = "YES" -a -z "${PBI_LISTREPO_ID}" ]; then
 		exit_err "Missing Repo ID to move down in priority."
 	fi
+	if [ ! -z "${PBI_LISTREPO_MIRROR}" -a -z "${PBI_LISTREPO_ID}" ]; then
+		exit_err "Missing Repo ID to change a specific mirror URL."
+	fi
 
 	if [ ! -z "${PBI_LISTREPO_ID}" ] ; then
 		ls ${PBI_DBREPODIR}/${PBI_LISTREPO_ID}.* >/dev/null 2>/dev/null
@@ -423,6 +431,9 @@
             --desc)     if [ $# -eq 1 ]; then usage_makerepo_pbi; fi
                         shift; PBI_MKREPO_DESC="$1"
                         ;;
+          --mirror)     if [ $# -eq 1 ]; then usage_makerepo_pbi; fi
+                        shift; PBI_MKREPO_MIRROR="$1"
+                        ;;
                  *)	if [ $# -gt 1  ]; then usage_makerepo_pbi; fi
                        	PBI_MKREPO_OUTDIR="$1"
                         ;;
@@ -430,9 +441,10 @@
                 shift
         done
 
+        if [ -z "${PBI_MKREPO_DESC}" ]; then usage_makerepo_pbi ; fi
         if [ -z "${PBI_MKREPO_KEY}" ]; then usage_makerepo_pbi ; fi
+        if [ -z "${PBI_MKREPO_MIRROR}" ]; then usage_makerepo_pbi ; fi
         if [ -z "${PBI_MKREPO_URL}" ]; then usage_makerepo_pbi ; fi
-        if [ -z "${PBI_MKREPO_DESC}" ]; then usage_makerepo_pbi ; fi
         if [ -z "${PBI_MKREPO_OUTDIR}" ]; then PBI_MKREPO_OUTDIR="${HOME}"; fi
         if [ ! -f "${PBI_MKREPO_KEY}" ]; then exit_err "The key file ${PBI_MKREPO_KEY} does not exist." ; fi
 
@@ -824,6 +836,7 @@
 	if [ ! -d "${PBI_HASHDIR}" ] ; then mkdir -p ${PBI_HASHDIR} >/dev/null 2>/dev/null ; fi
 	if [ ! -d "${PBI_DBAPPDIR}" ] ; then mkdir -p ${PBI_DBAPPDIR} >/dev/null 2>/dev/null ; fi
 	if [ ! -d "${PBI_DBKEYDIR}" ] ; then mkdir -p ${PBI_DBKEYDIR} >/dev/null 2>/dev/null ; fi
+	if [ ! -d "${PBI_DBMIRRORDIR}" ] ; then mkdir -p ${PBI_DBMIRRORDIR} >/dev/null 2>/dev/null ; fi
 	if [ ! -d "${PBI_DBINDEXDIR}" ] ; then mkdir -p ${PBI_DBINDEXDIR} >/dev/null 2>/dev/null ; fi
 	if [ ! -d "${PBI_DBREPODIR}" ] ; then mkdir -p ${PBI_DBREPODIR} >/dev/null 2>/dev/null ; fi
 	if [ ! -d "${PBI_DBHASHQUEUEDIR}" ] ; then mkdir -p ${PBI_DBHASHQUEUEDIR} >/dev/null 2>/dev/null ; fi
@@ -899,6 +912,9 @@
 	PBI_INS_MENUSCRIPT="install-menu-icons.sh"
 	PBI_INS_MIMESCRIPT="install-mime.sh"
 	PBI_INS_PATHSCRIPT="install-pathlinks.sh"
+	PBI_LISTREPO_UP=""
+	PBI_LISTREPO_DOWN=""
+	PBI_LISTREPO_MIRROR=""
 	PBI_LICAGREE="NO"
 	PBI_LICENSEFILE="LICENSE"
 	PBI_PATCHVERSION=""
@@ -949,6 +965,7 @@
 	PBI_DBHASHQUEUEDIR="${PBI_DBDIR}/.hashqueue"
 	PBI_DBINDEXDIR="${PBI_DBDIR}/index"
 	PBI_DBKEYDIR="${PBI_DBDIR}/keys"
+	PBI_DBMIRRORDIR="${PBI_DBDIR}/mirrors"
 	PBI_DBREPODIR="${PBI_DBDIR}/repos"
 	PBI_DISABLEHASHDIR="NO"
 	PBI_GUITOPBANNER="gui_banner.png"
@@ -1232,10 +1249,16 @@
 	else
 		echo "Warning: ${_md5}.ssl does not exist in the keys database."
 	fi
+	if [ -e "${PBI_DBMIRRORDIR}/${_md5}" ] ; then
+		rm "${PBI_DBMIRRORDIR}/${_md5}"
+	else
+		echo "Warning: ${_md5} does not exist in the mirror database."
+	fi
 	
 	# See if we need to remove a downloaded index file
 	if [ -e "${PBI_DBINDEXDIR}/${_md5}-index" ] ; then
 		rm "${PBI_DBINDEXDIR}/${_md5}-index"
+		rm "${PBI_DBINDEXDIR}/${_md5}-index.time"
 	fi
 
 	# Make sure we renumber the repos
@@ -1279,7 +1302,7 @@
 	if [ "$?" != "0" ] ; then
 		exit_err "Failed to read ${PBI_ADDREPO_FILE}"
 	fi
-	if [ ! -f "${PBI_TMPDIR}/repokey.ssl" -o ! -f "${PBI_TMPDIR}/repo-url" -o ! -f "${PBI_TMPDIR}/repo-desc" ] ; then
+	if [ ! -f "${PBI_TMPDIR}/repokey.ssl" -o ! -f "${PBI_TMPDIR}/repo-url" -o ! -f "${PBI_TMPDIR}/repo-desc" -o ! -f "${PBI_TMPDIR}/repo-mirror" ] ; then
 		exit_err "Improperly packaged repo file!"
 	fi
 
@@ -1289,9 +1312,12 @@
 	_md5=`md5 -q ${PBI_TMPDIR}/repo-url`
 	_url=`cat ${PBI_TMPDIR}/repo-url`
 	_desc=`cat ${PBI_TMPDIR}/repo-desc`
+	_mirror=`cat ${PBI_TMPDIR}/repo-mirror`
 	echo "URL: ${_url}" > ${PBI_DBREPODIR}/${_rNum}.${_md5}
 	echo "Desc: ${_desc}" >> ${PBI_DBREPODIR}/${_rNum}.${_md5}
+	echo "${_mirror}" >> ${PBI_DBMIRRORDIR}/${_md5}
 	cp "${PBI_TMPDIR}/repokey.ssl" "${PBI_DBKEYDIR}/${_md5}.ssl"
+	chmod 755 "${PBI_DBKEYDIR}/${_md5}.ssl"
 	
 	rm_tmpdir
 
@@ -1334,6 +1360,7 @@
 	mkdir ${PBI_TMPDIR}/.mkrepo
 	cp ${PBI_MKREPO_KEY} ${PBI_TMPDIR}/.mkrepo/repokey.ssl
 	echo "${PBI_MKREPO_URL}" >  ${PBI_TMPDIR}/.mkrepo/repo-url
+	echo "${PBI_MKREPO_MIRROR}" >  ${PBI_TMPDIR}/.mkrepo/repo-mirror
 	echo "${PBI_MKREPO_DESC}" >  ${PBI_TMPDIR}/.mkrepo/repo-desc
 	tar cvzf ${PBI_MKREPO_OUTDIR}/pbi-repo.rpo -C ${PBI_TMPDIR}/.mkrepo . >/dev/null 2>/dev/null
 	echo "New PBI Repo created: ${PBI_MKREPO_OUTDIR}/pbi-repo.rpo"
@@ -1356,12 +1383,21 @@
 		elif [ ! -z "${PBI_LISTREPO_DOWN}" ] ; then
 			move_repo_down "${PBI_LISTREPO_ID}"
 			list_all_pbi_repo
+		elif [ ! -z "${PBI_LISTREPO_MIRROR}" ] ; then
+			change_repo_mirror "${PBI_LISTREPO_ID}"
+			listrepo_details "${PBI_LISTREPO_ID}"
 		else
 			listrepo_details "${PBI_LISTREPO_ID}"
 		fi
 	fi
 }
 
+# Function to change a specific repos mirror URL
+change_repo_mirror() {
+	local _rMd5=`ls ${PBI_DBREPODIR}/${1}.* | cut -d '.' -f 2`
+	echo "$PBI_LISTREPO_MIRROR" > "${PBI_DBMIRRORDIR}/${_rMd5}"
+}
+
 # Move a repo down in priority
 move_repo_down() {
 	_rFile=`ls ${PBI_DBREPODIR}/${1}.*`
@@ -1403,11 +1439,14 @@
 # List all PBI repos
 listrepo_details() {
 	_rFile=`ls ${PBI_DBREPODIR}/${1}.*`
+	_md5=`ls ${PBI_DBREPODIR}/${1}.* | cut -d '.' -f 2`
 	_desc=`cat ${_rFile} | grep "Desc: " | sed "s|Desc: ||g"` 
 	_url=`cat ${_rFile} | grep "URL: " | sed "s|URL: ||g"` 
+	_mirror=`cat ${PBI_DBMIRRORDIR}/$_md5` 
 	echo "Repo ID: ${1}"
 	echo "Description: ${_desc}"
-	echo "URL: ${_url}"
+	echo "IndexURL: ${_url}"
+	echo "MirrorURL: ${_mirror}"
 }
 
 # List all PBI repos
@@ -1765,6 +1804,11 @@
 		*) echo "Signature: <Unknown>" ;;
 	esac
 
+	if [ ! -z "${PBI_REPO}" ] ; then
+		local _rDesc=`cat ${PBI_DBREPODIR}/*.${PBI_REPO} | grep "Desc:" | sed 's|Desc: ||g'`
+		echo "Associated Repo: ${_rDesc}"
+	fi
+
 	# See if we have any XDG stuff
 	if [ -e "${PBI_ORIGPROGDIRPATH}/.xdg-desktop/install-desktop-icons.sh" ] ; then
 		echo "DesktopIcons: YES"
@@ -1888,20 +1932,21 @@
 	do
 		if [ ! -e "${1}/${f}" ] ; then echo "Warning: Missing file: ${f}" ; fi
 	done
+        PBI_APPARCH=""
+        PBI_APPCREATEVER=""
+        PBI_ARCHIVE_CHECKSUM=""
+        PBI_ARCHIVE_COUNT=""
+        PBI_FBSDVER=""
 	PBI_ORIGPROGDIRPATH=""
+	PBI_PATCHVERSION=""
+	PBI_PATCHTARGET=""
 	PBI_PROGNAME=""
         PBI_PROGVERSION=""
         PBI_PROGAUTHOR=""
         PBI_PROGMDATE=""
         PBI_PROGWEB=""
-        PBI_APPARCH=""
-        PBI_FBSDVER=""
-        PBI_APPCREATEVER=""
-        PBI_ARCHIVE_COUNT=""
-        PBI_ARCHIVE_CHECKSUM=""
+	PBI_REPO=""
 	PBI_SIGVALID=""
-	PBI_PATCHVERSION=""
-	PBI_PATCHTARGET=""
 
 	PBI_ORIGPROGDIRPATH="`cat ${1}/pbi_defaultpath`"
         PBI_PROGNAME="`cat ${1}/pbi_name`"
@@ -1920,6 +1965,11 @@
         	PBI_PATCHVERSION=`cat ${1}/pbi_patchfile | cut -d ':' -f 2`
 		PBI_PATCHTARGET=`cat ${1}/pbi_patchfile | cut -d ':' -f 1`
 	fi
+	
+	# Check if this associates with a particular repo
+	if [ -e "${1}/pbi_repo" ] ; then
+        	PBI_REPO=`cat ${1}/pbi_repo`
+	fi
 
 	# See if this PBI was signed
 	if [ -e "${1}/pbi_archivesum.sha1" ] ; then
@@ -2075,6 +2125,13 @@
 
 	echo "${PBI_PROGDIRPATH}" >${dir}/pbi_installedpath
 
+	# See which repo / key this PBI associates to, if any
+	check_valid_sigs "${dir}"
+	if [ ! -z "$PBI_VALIDKEYSIG" ] ; then
+		_rMd5="`echo ${PBI_VALIDKEYSIG} | cut -d '.' -f 1`"
+		echo "$_rMd5" | sed "s|${PBI_DBKEYDIR}/||g" > ${dir}/pbi_repo
+	fi
+
 	# Dont need any patch version info
 	if [ -e "${dir}/pbi_patchfile" ] ; then
 		rm "${dir}/pbi_patchfile"
@@ -2140,6 +2197,7 @@
 
 # Check if we have valid signatures, and return "0" if success, "1" if failure
 check_valid_sigs() {
+	PBI_VALIDKEYSIG=""
 	_sf="${1}/pbi_archivesum ${1}/${MOD_PREINS} ${1}/${MOD_POSTINS} ${1}/${MOD_PREREM}"
         for _ts in $_sf
         do
@@ -2151,6 +2209,7 @@
                         -signature ${_ts}.sha1 \
                         ${_ts} >/dev/null 2>/dev/null
 			if [ "$?" = "0" ] ; then
+				PBI_VALIDKEYSIG="$_pk"
 				good="true" ; break
 			fi
 		done
@@ -3463,6 +3522,17 @@
 	do_pbi_update
 }
 
+# Function which checks the digital signature of a PBI to match it to a particular repo
+pbi_checksig_repomatch() {
+
+        # See which repo / key this PBI associates to, if any
+	check_valid_sigs "${1}"
+	if [ "$?" = "0" -a ! -z "$PBI_VALIDKEYSIG" ] ; then
+		_rMd5="`echo ${PBI_VALIDKEYSIG} | cut -d '.' -f 1`"
+		echo "$_rMd5" | sed "s|${PBI_DBKEYDIR}/||g" > ${1}/pbi_repo
+	fi
+}
+
 # See if we are checking for updates and do it
 start_update_checks() {
 	if [ "${PBI_UPCHECK}" != "YES" -a "${PBI_UPCHECK}" != "ALL" ]; then return 0; fi
@@ -3472,18 +3542,36 @@
 
 	if [ "${PBI_UPCHECK}" = "YES" ] ; then
 		load_info_from_dir "${PBI_DBAPPDIR}/${PBI_UPDATEAPP}"
+		if [ -z "${PBI_REPO}" ]; then
+			pbi_checksig_repomatch "${PBI_DBAPPDIR}/${PBI_UPDATEAPP}"
+		fi
+		if [ -z "${PBI_REPO}" ]; then
+			return
+		else
+			local _repoID=`ls ${PBI_DBREPODIR}/*.${PBI_REPO} | cut -d '.' -f 1 | sed "s|${PBI_DBREPODIR}/||g"`
+		fi
+
 		check_pbi_update "$PBI_UPDATEAPP" "display" \
 	 	 "$PBI_PROGNAME" "current" \
-	 	 "$PBI_FBSDVER" "$PBI_APPARCH"
+	 	 "$PBI_FBSDVER" "$PBI_APPARCH" "$_repoID"
 	else
 		# Loop and check all PBIs for updates
 		for i in `ls ${PBI_DBAPPDIR}/ 2>/dev/null`
                 do
                         if [ -e "${PBI_DBAPPDIR}/${i}/pbi_name" ] ; then
 				load_info_from_dir "${PBI_DBAPPDIR}/${i}"
+				if [ -z "${PBI_REPO}" ]; then
+					pbi_checksig_repomatch "${PBI_DBAPPDIR}/${i}"
+				fi
+				if [ -z "${PBI_REPO}" ]; then
+					continue
+				else
+					local _repoID=`ls ${PBI_DBREPODIR}/*.${PBI_REPO} | cut -d '.' -f 1 | sed "s|${PBI_DBREPODIR}/||g"`
+				fi
+
 				check_pbi_update "$i" "display" \
 				 "$PBI_PROGNAME" "current" \
-				 "$PBI_FBSDVER" "$PBI_APPARCH"
+				 "$PBI_FBSDVER" "$PBI_APPARCH" "$_repoID"
                         fi
                 done
 	fi
@@ -3527,9 +3615,9 @@
 	_tmp2=`expr $_tmp - 1`
 	_lastC=`echo ${_tmp} | cut -c ${_tmp2}-${_tmp}`
 	if [ "${_lastC}" = "/" ] ; then
-		_upURL="`echo ${PBI_UPDATEURL} | sed 's|\(.*\).|\1|'`"
+		_upURL="`echo ${_rURL} | sed 's|\(.*\).|\1|'`"
 	else
-		_upURL="${PBI_UPDATEURL}"
+		_upURL="${_rURL}"
 	fi
 
 	fetch -o "${_tmpPbiIndex}.bz2" "${_upURL}/${PBI_INDEXUPFILE}.bz2" >/dev/null 2>/dev/null
@@ -3554,7 +3642,6 @@
 
 # Check a specific PBI for updates
 check_pbi_update() {
-	if [ -z "${PBI_UPDATEURL}" ] ; then return ; fi
 
 	# Init the tmpdir
 	init_tmpdir
@@ -3575,6 +3662,7 @@
 	PBI_UPPATCHES=""
 	PBI_UPCSUM=""
 	PBI_UPMDATE=""
+	PBI_UPREPO=""
 
 	# If we are looking for the current app, set _uver accordingly
 	if [ "$_uver" = "current" ] ; then
@@ -3589,6 +3677,7 @@
 
 		if [ "$_urepo" = "AUTO" ] ; then
 			_pbiIndex="${PBI_DBINDEXDIR}/${_repo}"
+			_rMd5="`echo ${_repo} | sed 's|-index||g'`"
 		else
 			_rMd5=`ls ${PBI_DBREPODIR}/${_urepo}.* | cut -d '.' -f 2`
 			_pbiIndex="${PBI_DBINDEXDIR}/${_rMd5}-index"
@@ -3602,6 +3691,8 @@
 		PBI_UPPATCHES="`echo $_upLine | cut -d ':' -f 8`"
 		PBI_UPCSUM="`echo $_upLine | cut -d ':' -f 4`"
 		PBI_UPMDATE="`echo $_upLine | cut -d ':' -f 5`"
+		PBI_UPMIRROR="`cat ${PBI_DBMIRRORDIR}/${_rMd5}`"
+		PBI_UPREPO="${_rMd5}"
 
 		if [ ! -z "${PBI_UPNVER}" ] ; then break; fi
 		if [ "${_urepo}" != "AUTO" ] ; then break; fi
@@ -3654,7 +3745,7 @@
 	 "$_rtar" "$_rVer" \
 	 "`uname -r`" "$_rArch" "${PBI_ADDREPO_ID}"
 	if [ "$?" != "0" ] ; then 
-		exit_err "Could not find \"$_rtar\" in $PBI_INDEXUPFILE"
+		exit_err "Could not find \"$_rtar\" in any indexes" 
 	fi
 
 	# We've gotten this far, now download the updated PBI
@@ -3674,9 +3765,18 @@
 
 	# Check for update to this app, and exit or return if not available
 	load_info_from_dir "${PBI_DBAPPDIR}/${PBI_UPDATEAPP}"
+	if [ -z "${PBI_REPO}" ]; then
+		pbi_checksig_repomatch "${PBI_DBAPPDIR}/${PBI_UPDATEAPP}"
+	fi
+	if [ -z "${PBI_REPO}" ]; then
+		return
+	else
+		local _repoID=`ls ${PBI_DBREPODIR}/*.${PBI_REPO} | cut -d '.' -f 1 | sed "s|${PBI_DBREPODIR}/||g"`
+	fi
+
 	check_pbi_update "$PBI_UPDATEAPP" "nodisplay" \
 	 "$PBI_PROGNAME" "current" \
-	 "$PBI_FBSDVER" "$PBI_APPARCH"
+	 "$PBI_FBSDVER" "$PBI_APPARCH" "$_repoID"
 	if [ "$?" != "0" ] ; then 
 		if [ "$_upact" = "single" ] ; then
 			exit_err "$PBI_UPDATEAPP - no update available!"
@@ -3751,54 +3851,21 @@
 		_uFile="${PBI_UPFILE}"
 	fi
 
-	if [ ! -z "$PBI_MIRROR" ] ; then
-		# Start download from default mirror
-		_furl="`echo $PBI_MIRROR | sed 's/\/*$//'`${_uFile}"
-		echo "Downloading ${_furl}"
-		pbi_get_file "$_furl" "$_dl_loc"
-		if [ "$?" != "0" ]  ; then 
-			rm "${_dl_loc}" >/dev/null 2>/dev/null
-			echo "Download Failed: ${_furl}"
-			return 1
-		fi
-		_upcsum=`sha256 -q "$_dl_loc"`
-		if [ "$_upcsum" != "$PBI_UPCSUM" ] ; then
-			rm "${_dl_loc}" >/dev/null 2>/dev/null
-			echo "Download Failed: ${_furl}"
-			return 1
-		fi
-
-	else
-		# Loop through the provided mirrors until we get a good dl or fail
-		_upattempt="1"
-		_gooddl="no"
-		while [ "$_upattempt" -lt 4 ]
-		do
-			# Do download from updater mirrors
-			case $_upattempt in
-				1) _furl="`echo $PBI_PBIMIRROR2 | sed 's/\/*$//'`${_uFile}" ;;
-				2) _furl="`echo $PBI_PBIMIRROR3 | sed 's/\/*$//'`${_uFile}" ;;
-				3) _furl="`echo $PBI_PBIMIRROR4 | sed 's/\/*$//'`${_uFile}" ;;
-			esac
-			echo "Downloading ${_furl}"
-			pbi_get_file "$_furl" "$_dl_loc"
-			if [ "$?" != "0" ]  ; then 
-				rm "${_dl_loc}" >/dev/null 2>/dev/null
-			fi
-			_upcsum=`sha256 -q "$_dl_loc"`
-			if [ "$_upcsum" != "$PBI_UPCSUM" ] ; then
-				rm "${_dl_loc}" >/dev/null 2>/dev/null
-			else
-				_gooddl="yes"
-				break
-			fi
-			_upattempt="`expr $_upattempt + 1`"
-		done
-		if [ "$_gooddl" != "yes" ] ; then
-			echo "Download Failed: ${_furl}"
-			return 1
-		fi
+	# Start download from repos default mirror
+	_furl="`echo $PBI_UPMIRROR | sed 's/\/*$//'`${_uFile}"
+	echo "Downloading ${_furl}"
+	pbi_get_file "$_furl" "$_dl_loc"
+	if [ "$?" != "0" ]  ; then 
+		rm "${_dl_loc}" >/dev/null 2>/dev/null
+		echo "Download Failed: ${_furl}"
+		return 1
 	fi
+	_upcsum=`sha256 -q "$_dl_loc"`
+	if [ "$_upcsum" != "$PBI_UPCSUM" ] ; then
+		rm "${_dl_loc}" >/dev/null 2>/dev/null
+		echo "Download Failed: ${_furl}"
+		return 1
+	fi
 
 	# If we get this far, we have a good file!
 	PBI_UPDLFILE="$_dl_loc"


Property changes on: pcbsd/current/src-sh/pbi-manager/repo/pcbsd.rpo
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream



More information about the Commits mailing list