Add more support for other downloaders.
This commit is contained in:
parent
0baced681a
commit
3e6903ae28
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