[PC-BSD Commits] r19944 - in pcbsd/current/src-sh/pbi-manager: . repo
svn at pcbsd.org
svn at pcbsd.org
Thu Oct 25 12:18:48 PDT 2012
Author: kris
Date: 2012-10-25 19:18:48 +0000 (Thu, 25 Oct 2012)
New Revision: 19944
Modified:
pcbsd/current/src-sh/pbi-manager/pbi-manager
pcbsd/current/src-sh/pbi-manager/repo/pcbsd.rpo
Log:
Allow the pbi-manager to use the "PCBSDCDN" value for a mirror, which
will get a mirror from our servers that is fresh, and fast to your location
Modified: pcbsd/current/src-sh/pbi-manager/pbi-manager
===================================================================
--- pcbsd/current/src-sh/pbi-manager/pbi-manager 2012-10-25 19:17:38 UTC (rev 19943)
+++ pcbsd/current/src-sh/pbi-manager/pbi-manager 2012-10-25 19:18:48 UTC (rev 19944)
@@ -5444,7 +5444,13 @@
# Start download from repos mirror(s) in order
for _cMirror in $_mirrorList
do
- _furl="`echo $_cMirror | sed 's/\/*$//'`${_uFile}"
+ if [ "$_cMirror" = "PCBSDCDN" ] ; then
+ get_pcbsd_mirror
+ _furl="${VAL}${_uFile}"
+ else
+ _furl="`echo $_cMirror | sed 's/\/*$//'`${_uFile}"
+ fi
+
echo "Downloading ${_furl}"
pbi_get_file "$_furl" "$_dl_loc"
if [ "$?" != "0" ] ; then
@@ -6845,6 +6851,49 @@
}
+# Get the default PC-BSD mirror to use
+get_pcbsd_mirror() {
+
+ # Check if we already looked up a mirror we can keep using
+ if [ -n "$CACHED_PCBSD_MIRROR" ] ; then
+ VAL="$CACHED_PCBSD_MIRROR"
+ export VAL
+ return
+ fi
+
+ # Set the mirror URL
+ VAL="`cat ${PCBSD_ETCCONF} 2>/dev/null | grep 'PCBSD_MIRROR: ' | sed 's|PCBSD_MIRROR: ||g'`"
+ if [ -n "$VAL" ] ; then
+ echo "Using mirror: $VAL"
+ CACHED_PCBSD_MIRROR="$VAL"
+ export VAL CACHED_PCBSD_MIRROR
+ return
+ fi
+
+ echo "Getting regional mirror..."
+ . /etc/profile
+
+ # No URL? Lets get one from the master server
+ local mFile="${HOME}/.mirrorUrl.$$"
+ touch $mFile
+ fetch -o $mFile http://getmirror.pcbsd.org >/dev/null 2>/dev/null
+ VAL="`cat $mFile | grep 'URL: ' | sed 's|URL: ||g'`"
+ rm $mFile
+ if [ -n "$VAL" ] ; then
+ echo "Using mirror: $VAL"
+ CACHED_PCBSD_MIRROR="$VAL"
+ export VAL CACHED_PCBSD_MIRROR
+ return
+ fi
+
+ # Still no mirror? Lets try the PC-BSD FTP server...
+ VAL="ftp://ftp.pcbsd.org/pub/mirror"
+ CACHED_PCBSD_MIRROR="$VAL"
+ export VAL CACHED_PCBSD_MIRROR
+ echo "Using mirror: $VAL"
+ return
+}
+
# No chroot environment tar file exists yet, lets build or extract
mk_chroot_file() {
@@ -6854,7 +6903,8 @@
cd "$PBI_APPDIR"
# Set the mirror URL
- MIRRORURL="`sed -n 's/PCBSD_MIRROR: //p' ${PCBSD_ETCCONF}`"
+ get_pcbsd_mirror
+ MIRRORURL="$VAL"
# Get the system version we are checking for updates to
SYSVER="`pbreg get /PC-BSD/Version`" ; export SYSVER
Modified: pcbsd/current/src-sh/pbi-manager/repo/pcbsd.rpo
===================================================================
(Binary files differ)
More information about the Commits
mailing list