Skip to content
This repository has been archived by the owner on Dec 4, 2020. It is now read-only.

Commit

Permalink
Switch us over to the new PC-BSD CDN
Browse files Browse the repository at this point in the history
  • Loading branch information
Kris Moore committed Jun 28, 2013
1 parent 2c8cdfc commit 9788f38
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 15 deletions.
39 changes: 32 additions & 7 deletions src-sh/libsh/functions.sh
Expand Up @@ -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
Expand 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
Expand Down Expand Up @@ -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}
}

Expand All @@ -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
Expand All @@ -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
Expand Down
10 changes: 7 additions & 3 deletions src-sh/pbi-manager/pbi-manager
Expand Up @@ -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}"
Expand Down Expand Up @@ -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

Expand Down
Binary file modified src-sh/pbi-manager/repo/pcbsd.rpo
Binary file not shown.
2 changes: 1 addition & 1 deletion src-sh/pc-metapkgmanager/pc-metapkgmanager
Expand Up @@ -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 $?
}

Expand Down
2 changes: 1 addition & 1 deletion src-sh/pc-thinclient/pc-thinclient
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src-sh/warden/scripts/backend/createjail.sh
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src-sh/warden/scripts/backend/createtemplate.sh
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src-sh/warden/scripts/backend/functions.sh
Expand Up @@ -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
Expand Down

0 comments on commit 9788f38

Please sign in to comment.