Permalink
Browse files

Switch us over to the new PC-BSD CDN

  • Loading branch information...
1 parent 2c8cdfc commit 9788f38c1158c8c66b3e579be6ad95ba1bad894d @kmoore134 kmoore134 committed Jun 28, 2013
@@ -46,7 +46,7 @@ download_cache_packages()
PKGREL=`uname -r | cut -d '-' -f 1-2`
# Where are the packages on our mirrors?
- pkgUrl="/packages/${PKGREL}/${ARCH}"
+ pkgUrl="/${PKGREL}/${ARCH}"
if [ ! -d "$PKG_CACHEDIR/All" ] ; then
mkdir -p ${PKG_CACHEDIR}/All
@@ -65,7 +65,7 @@ download_cache_packages()
#dSize=`ls -al `
rm ${PKG_CACHEDIR}/All/${i} ;
fi
- get_file_from_mirrors "${pkgUrl}/All/${i}" "${PKG_CACHEDIR}/All/${i}"
+ get_file_from_mirrors "${pkgUrl}/All/${i}" "${PKG_CACHEDIR}/All/${i}" "pkg"
if [ $? -ne 0 ] ; then
echo "Failed downloading: /${pkgUrl}/All/${i}"
return 1
@@ -125,23 +125,42 @@ get_aria_mirror_list()
if [ -z $1 ] ; then
exit_err "Need to supply file to grab from mirrors..."
fi
+ if [ -z $2 ] ; then
+ exit_err "Need to supply which mirror to fetch from..."
+ fi
+
+ case $2 in
+ pkg) mirrorTag="PKG_MIRROR"
+ mirrorFile="/usr/local/share/pcbsd/conf/pkg-mirror"
+ ;;
+ pbi) mirrorTag="PBI_MIRROR"
+ mirrorFile="/usr/local/share/pcbsd/conf/pbi-mirror"
+ ;;
+ iso) mirrorTag="ISO_MIRROR"
+ mirrorFile="/usr/local/share/pcbsd/conf/iso-mirror"
+ ;;
+ update) mirrorTag="UPDATE_MIRROR"
+ mirrorFile="/usr/local/share/pcbsd/conf/update-mirror"
+ ;;
+ *) exit_err "Bad mirror type!" ;;
+ esac
# Set the mirror URL
- local VAL="`cat ${PCBSD_ETCCONF} 2>/dev/null | grep 'PCBSD_MIRROR: ' | sed 's|PCBSD_MIRROR: ||g'`"
+ local VAL=`cat ${PCBSD_ETCCONF} 2>/dev/null | grep "^${mirrorTag}:" | sed "s|^${mirrorTag}: ||g"`
if [ -n "$VAL" ] ; then
echo "${VAL}${1}"
return
fi
- if [ ! -e "/usr/local/share/pcbsd/conf/pcbsd-mirrors" ] ; then
- exit_err "Missing mirror list: /usr/local/share/pcbsd/conf/pcbsd-mirrors"
+ if [ ! -e "${mirrorFile}" ] ; then
+ exit_err "Missing mirror list: ${mirrorFile}"
fi
# Build the mirror list
while read line
do
VAL="$VAL ${line}${1}"
- done < /usr/local/share/pcbsd/conf/pcbsd-mirrors
+ done < ${mirrorFile}
echo ${VAL}
}
@@ -152,6 +171,12 @@ get_file_from_mirrors()
{
_rf="${1}"
_lf="${2}"
+ _mtype="${3}"
+
+ case $_mtype in
+ iso|pbi|pkg|update) ;;
+ *) exit_err "Fixme! Missing mirror type in get_file_from_mirrors" ;;
+ esac
# Get any proxy information
. /etc/profile
@@ -175,7 +200,7 @@ get_file_from_mirrors()
touch $aStatFile
# Get mirror list
- local mirrorList="$(get_aria_mirror_list $1)"
+ local mirrorList="$(get_aria_mirror_list ${_rf} ${_mtype})"
# Running from a non GUI?
if [ "$GUI_FETCH_PARSING" != "YES" -a "$PBI_FETCH_PARSING" != "YES" -a -z "$PCFETCHGUI" ] ; then
@@ -5501,8 +5501,12 @@ pbi_update_dl() {
# Start download from repos mirror(s) in order
for _cMirror in $_mirrorList
do
- if [ "$_cMirror" = "PCBSDCDN" ] ; then
- get_file_from_mirrors "${_uFile}" "$_dl_loc"
+ if [ "$_cMirror" = "PCBSDCDN" -o "$_cMirror" = "http://pbi.cdn.pcbsd.org" ] ; then
+
+ # Strip the /PBI from the mirror URL
+ _uFile="`echo ${_uFile} | sed 's|^/PBI||g'`"
+
+ get_file_from_mirrors "${_uFile}" "$_dl_loc" "pbi"
if [ "$?" != "0" ] ; then
rm "${_dl_loc}" >/dev/null 2>/dev/null
echo "Download Failed: ${_furl}"
@@ -6948,7 +6952,7 @@ mk_chroot_file() {
for i in $dFiles
do
echo "Downloading /${SYSVER}/${ARCH}/dist/${i} ..."
- get_file_from_mirrors "/${SYSVER}/${ARCH}/dist/${i}" "${i}"
+ get_file_from_mirrors "/${SYSVER}/${ARCH}/dist/${i}" "${i}" "iso"
[ $? -ne 0 ] && exit_err "Error while downloading the freebsd world."
done
Binary file not shown.
@@ -335,7 +335,7 @@ get_file_dl()
dlOut="`basename $2`"
dlPath="$2"
fi
- get_file_from_mirrors "$dlPath" "$dlOut"
+ get_file_from_mirrors "$dlPath" "$dlOut" "iso"
exit $?
}
@@ -269,7 +269,7 @@ check_world() {
do
echo "Downloading ${MIRRORURL}/${SYSVER}/${ARCH}/dist/${i} ..."
- get_file_from_mirrors "/${SYSVER}/${ARCH}/dist/${i}" "$i"
+ get_file_from_mirrors "/${SYSVER}/${ARCH}/dist/${i}" "$i" "iso"
[ $? -ne 0 ] && exit_err "Error while downloading the freebsd world."
done
@@ -245,7 +245,7 @@ then
mkdir -p "${JAILDIR}/usr/src"
cd ${JAILDIR}
SYSVER="$(uname -r | cut -d '-' -f 1-2)"
- get_file_from_mirrors "/${SYSVER}/${ARCH}/dist/src.txz" "src.txz"
+ get_file_from_mirrors "/${SYSVER}/${ARCH}/dist/src.txz" "src.txz" "iso"
if [ $? -ne 0 ] ; then
echo "Error while downloading the freebsd world."
else
@@ -22,7 +22,7 @@ download_template_files() {
if [ -n "$TRUEOSVER" ] ; then
for f in $DFILES
do
- get_file_from_mirrors "/${TRUEOSVER}/${FBSDARCH}/dist/$f" "${JDIR}/.download/$f"
+ get_file_from_mirrors "/${TRUEOSVER}/${FBSDARCH}/dist/$f" "${JDIR}/.download/$f" "iso"
if [ $? -ne 0 ] ; then
exit_err "Failed downloading: /${TRUEOS}/${FBSDARCH}/dist/${f}"
fi
@@ -822,7 +822,7 @@ bootstrap_pkgng()
chmod 755 "${jaildir}/bootstrap-pkgng"
if [ -e "pkg.txz" ] ; then rm pkg.txz ; fi
- get_file_from_mirrors "/packages/${release}/${arch}/Latest/pkg.txz" "pkg.txz"
+ get_file_from_mirrors "/${release}/${arch}/Latest/pkg.txz" "pkg.txz" "pkg"
if [ $? -eq 0 ] ; then
chroot ${jaildir} /bootstrap-pkgng
if [ $? -eq 0 ] ; then

0 comments on commit 9788f38

Please sign in to comment.