Merge pull request #8 from lemniskett/curl-fallback
Req #7: Add more support for other downloaders.
This commit is contained in:
commit
6166f472c2
@ -6,7 +6,9 @@ Ever since I'm running some niche distros like Void, Solus, I had a problem find
|
|||||||
### Dependencies
|
### Dependencies
|
||||||
- Bash
|
- Bash
|
||||||
- Sed
|
- Sed
|
||||||
- Wget
|
- Curl
|
||||||
|
- Wget (Optional: use ```wget``` when it's installed)
|
||||||
|
- Aria2 (Optional: use ```aria2c``` when it's installed)
|
||||||
- Tar
|
- Tar
|
||||||
- Desktop-file-utils
|
- Desktop-file-utils
|
||||||
- Xorg-xhost (Optional: allowing users in Archbox to access X server)
|
- Xorg-xhost (Optional: allowing users in Archbox to access X server)
|
||||||
|
14
archbox.bash
14
archbox.bash
@ -39,6 +39,18 @@ OPTIONS:
|
|||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fetch_tarball(){
|
||||||
|
if hash aria2c 2>/dev/null; then
|
||||||
|
aria2c -o archlinux.tar.gz $1
|
||||||
|
elif hash wget 2>/dev/null; then
|
||||||
|
wget -O archlinux.tar.gz $1
|
||||||
|
elif hash curl 2>/dev/null; then
|
||||||
|
curl -o archlinux.tar.gz $1
|
||||||
|
else
|
||||||
|
err "No supported downloader found."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
err(){
|
err(){
|
||||||
echo "$(tput bold)$(tput setaf 1)==> $@ $(tput sgr0)" 1>&2
|
echo "$(tput bold)$(tput setaf 1)==> $@ $(tput sgr0)" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
@ -57,7 +69,7 @@ case $1 in
|
|||||||
cd $INSTALL_PATH
|
cd $INSTALL_PATH
|
||||||
msg "Downloading Arch Linux tarball..."
|
msg "Downloading Arch Linux tarball..."
|
||||||
checkdep wget
|
checkdep wget
|
||||||
while true; do wget -O archlinux.tar.gz $2 && break; done
|
while true; do fetch_tarball $2 && break; done
|
||||||
msg "Extracting the tarball..."
|
msg "Extracting the tarball..."
|
||||||
checkdep tar
|
checkdep tar
|
||||||
tar xzf archlinux.tar.gz
|
tar xzf archlinux.tar.gz
|
||||||
|
Loading…
Reference in New Issue
Block a user