Last active
May 8, 2017 16:56
-
-
Save samrocketman/60d307dd8d448a080522346011e4ea41 to your computer and use it in GitHub Desktop.
Test fetch-content.sh when no download utilities are available. Ref: https://github.com/OpenRA/ra2/pull/385
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./test-fetch-content.sh | |
INFO: Preparing $PATH | |
INFO: Linked /bin/bash | |
INFO: Linked /bin/ls | |
INFO: Linked /usr/bin/7z | |
INFO: Linked /bin/mkdir | |
INFO: Linked /bin/rm | |
INFO: Linked /usr/bin/[ | |
INFO: Execute fetch-content.sh with PATH=/tmp/tmp.fWWXp8A7sN | |
+ set -e | |
++ uname | |
+ '[' 'Linux' == Darwin ']' | |
+ DIR=/home/sam/.openra/Content/ra2 | |
+ '[' '!' -d /home/sam/.openra/Content/ra2 ']' | |
+ mkdir -p /home/sam/.openra/Content/ra2 | |
+ echo 'Downloading RA2 mod content' | |
Downloading RA2 mod content | |
+ cd /home/sam/.openra/Content/ra2 | |
+ download_url http://xwis.net/downloads/Red-Alert-2-Multiplayer.exe | |
+ URL=http://xwis.net/downloads/Red-Alert-2-Multiplayer.exe | |
+ LOCAL_FILE=Red-Alert-2-Multiplayer.exe | |
++ type -p wget | |
+ '[' -x '' ']' | |
++ type -p curl | |
+ '[' -x '' ']' | |
+ echo 'No supported download method found.' | |
No supported download method found. | |
+ return 1 | |
INFO: fetch-content.sh exited with exit code: 1 | |
INFO: Deleting: /tmp/tmp.fWWXp8A7sN |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function cleanup_on() { | |
echo "INFO: Deleting: ${TMPDIR}" | |
rm -rf "${TMPDIR}" | |
} | |
trap cleanup_on EXIT | |
echo 'INFO: Preparing $PATH' | |
TMPDIR="$(mktemp -d)" | |
#create a $PATH without wget or curl | |
for x in bash ls 7z mkdir rm '[' uname; do | |
if [ -x "$(type -P "$x")" ]; then | |
ln -s "$(type -P "$x")" "${TMPDIR%/}/" | |
echo "INFO: Linked $(type -P "$x")" | |
fi | |
done | |
#execute fetch-content.sh with our custom $PATH | |
echo "INFO: Execute fetch-content.sh with PATH=${TMPDIR}" | |
PATH="${TMPDIR}" bash -x fetch-content.sh | |
echo "INFO: fetch-content.sh exited with exit code: $?" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment