mirror of
https://github.com/tpoechtrager/osxcross.git
synced 2024-08-17 20:40:28 +03:00
osxcross-macports: Let the user choose between 4 mirrors
This commit is contained in:
parent
1e1c8facb7
commit
8bb70733d2
@ -92,6 +92,9 @@ osxcross-macports [...]
|
||||
* upgrade
|
||||
* Reinstalls the latest version of every package.
|
||||
|
||||
* select-mirror
|
||||
* Switch to a different mirror.
|
||||
|
||||
Useful flags:
|
||||
|
||||
* '-v', '--verbose':
|
||||
|
@ -11,12 +11,6 @@ set -e
|
||||
export LC_ALL=C
|
||||
pushd "${0%/*}" &>/dev/null
|
||||
|
||||
MIRROR="$OSXCROSS_MACPORTS_MIRROR"
|
||||
|
||||
if [ -z "$MIRROR" ]; then
|
||||
MIRROR="http://packages.macports.org"
|
||||
fi
|
||||
|
||||
PUBKEYURL="https://svn.macports.org/repository/"
|
||||
PUBKEYURL+="macports/trunk/base/macports-pubkey.pem"
|
||||
|
||||
@ -31,10 +25,6 @@ if [ $PLATFORM == "FreeBSD" ]; then
|
||||
WGETOPTS+="/usr/local/share/certs/ca-root-nss.crt"
|
||||
fi
|
||||
|
||||
if [ -n "$OSXCROSS_MACPORTS_ENABLE_HTTPS" ]; then
|
||||
MIRROR=$(echo $MIRROR | sed 's/http:/https:/g')
|
||||
fi
|
||||
|
||||
if [ -z "$BASHPID" ]; then
|
||||
BASHPID=$(sh -c 'echo $PPID')
|
||||
fi
|
||||
@ -70,8 +60,8 @@ require()
|
||||
}
|
||||
|
||||
if [ -z "$MACOSX_DEPLOYMENT_TARGET" ]; then
|
||||
errorMsg "You must set MACOSX_DEPLOYMENT_TARGET first."
|
||||
errorMsg "Please see README.MACPORTS."
|
||||
errorMsg "you must set MACOSX_DEPLOYMENT_TARGET first."
|
||||
errorMsg "please see README.MACPORTS."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -113,6 +103,7 @@ fi
|
||||
|
||||
PUBKEY="$ROOT/mp-pubkey.pem"
|
||||
INSTALLDB="$ROOT/INSTALLED"
|
||||
SELECTEDMIRROR="$ROOT/MIRROR"
|
||||
CACHE="$ROOT/cache"
|
||||
INSTALL="$ROOT/pkgs"
|
||||
TMP="$ROOT/tmp"
|
||||
@ -150,6 +141,45 @@ createDir "cache" $CACHE
|
||||
createDir "install" $INSTALL
|
||||
createDir "tmp" $TMP
|
||||
|
||||
selectMirror()
|
||||
{
|
||||
echo "available mirrors:"
|
||||
echo ""
|
||||
echo "1: packages.macports.org (United States)"
|
||||
echo "2: mirrorservice.org (United Kingdom)"
|
||||
echo "3: nue.de.packages.macports.org (Germany)"
|
||||
echo "4: lil.fr.packages.macports.org (France)"
|
||||
echo ""
|
||||
|
||||
local OK=0
|
||||
local mirrorNumber
|
||||
|
||||
while [ $OK -ne 1 ]; do
|
||||
echo -n "please enter the number of the mirror you want to use: "
|
||||
|
||||
if [ -n "$UNATTENDED" ]; then
|
||||
echo "1"
|
||||
mirrorNumber=1
|
||||
else
|
||||
read mirrorNumber
|
||||
fi
|
||||
|
||||
case $mirrorNumber in
|
||||
1) echo -n "http://packages.macports.org" > \
|
||||
$SELECTEDMIRROR && OK=1 ;;
|
||||
2) echo -n "http://www.mirrorservice.org/sites/packages.macports.org" > \
|
||||
$SELECTEDMIRROR && OK=1 ;;
|
||||
3) echo -n "http://nue.de.packages.macports.org/macports/packages" > \
|
||||
$SELECTEDMIRROR && OK=1 ;;
|
||||
4) echo -n "http://lil.fr.packages.macports.org" > \
|
||||
$SELECTEDMIRROR && OK=1 ;;
|
||||
*) echo "please enter a number between 1 and 4..." 1>&2 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
MIRROR=$(cat $SELECTEDMIRROR)
|
||||
}
|
||||
|
||||
getFileStdout()
|
||||
{
|
||||
verbosePlaceHolder
|
||||
@ -190,7 +220,7 @@ verifyFileIntegrity()
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "verifying file integrity of $file"
|
||||
echo "verifying file integrity of $file ..."
|
||||
|
||||
set +e
|
||||
|
||||
@ -477,7 +507,7 @@ removeDylibs()
|
||||
|
||||
showHelpText()
|
||||
{
|
||||
errorMsg "Please see README.MACPORTS"
|
||||
errorMsg "please see README.MACPORTS"
|
||||
}
|
||||
|
||||
main()
|
||||
@ -485,6 +515,16 @@ main()
|
||||
local args
|
||||
local cmd
|
||||
|
||||
MIRROR="$OSXCROSS_MACPORTS_MIRROR"
|
||||
|
||||
if [ -z "$MIRROR" ] && [ -f "$SELECTEDMIRROR" ]; then
|
||||
MIRROR=$(cat $SELECTEDMIRROR | head -n1)
|
||||
fi
|
||||
|
||||
if [ -z "$MIRROR" ]; then
|
||||
selectMirror
|
||||
fi
|
||||
|
||||
for opt in $@; do
|
||||
if [[ $opt == -* ]]; then
|
||||
if [ $opt == "-v" -o $opt == "--verbose" ]; then
|
||||
@ -500,6 +540,9 @@ main()
|
||||
elif [ $opt == "-l" -o $opt == "--ldflags" ]; then
|
||||
showLDFLAGS $2
|
||||
exit
|
||||
elif [ $opt == "-sm" -o $opt == "--select-mirror" ]; then
|
||||
selectMirror
|
||||
exit
|
||||
elif [ $opt == "-h" -o $opt == "--help" ]; then
|
||||
showHelpText
|
||||
exit
|
||||
@ -544,6 +587,7 @@ main()
|
||||
echo "done"
|
||||
exit
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
local packages="$args"
|
||||
|
Loading…
Reference in New Issue
Block a user