add support for curl
parent
98060c4bc9
commit
7f48a7b023
|
@ -14,16 +14,36 @@ NO_UI=
|
|||
GIT_PROTOCOL=${GIT_PROTOCOL:="git"}
|
||||
GIT_URL=${GIT_URL:=$GIT_PROTOCOL"://factorcode.org/git/factor.git"}
|
||||
|
||||
test_program_installed() {
|
||||
if ! [[ -n `type -p $1` ]] ; then
|
||||
return 0;
|
||||
fi
|
||||
return 1;
|
||||
}
|
||||
|
||||
ensure_program_installed() {
|
||||
echo -n "Checking for $1..."
|
||||
result=`type -p $1`
|
||||
if ! [[ -n $result ]] ; then
|
||||
echo "not found!"
|
||||
echo "Install $1 and try again."
|
||||
exit 1
|
||||
fi
|
||||
echo "found!"
|
||||
installed=0;
|
||||
for i in $* ;
|
||||
do
|
||||
echo -n "Checking for $i..."
|
||||
test_program_installed $1
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo -n "not "
|
||||
else
|
||||
installed=$(( $installed + 1 ))
|
||||
fi
|
||||
echo "found!"
|
||||
done
|
||||
if [[ $installed -eq 0 ]] ; then
|
||||
echo -n "Install "
|
||||
if [[ $# -eq 1 ]] ; then
|
||||
echo -n $1
|
||||
else
|
||||
echo -n "any of [ $* ]"
|
||||
fi
|
||||
echo " and try again."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_ret() {
|
||||
|
@ -47,11 +67,20 @@ check_gcc_version() {
|
|||
echo "ok."
|
||||
}
|
||||
|
||||
set_downloader() {
|
||||
test_program_installed wget
|
||||
if [[ $? -ne 0 ]] ; then
|
||||
DOWNLOAD=wget
|
||||
else
|
||||
DOWNLOAD="curl -O"
|
||||
fi
|
||||
}
|
||||
|
||||
check_installed_programs() {
|
||||
ensure_program_installed chmod
|
||||
ensure_program_installed uname
|
||||
ensure_program_installed git
|
||||
ensure_program_installed wget
|
||||
ensure_program_installed wget curl
|
||||
ensure_program_installed gcc
|
||||
ensure_program_installed make
|
||||
case $OS in
|
||||
|
@ -238,32 +267,33 @@ delete_boot_images() {
|
|||
echo "Deleting old images..."
|
||||
rm $BOOT_IMAGE > /dev/null 2>&1
|
||||
rm $BOOT_IMAGE.* > /dev/null 2>&1
|
||||
rm staging.*.image > /dev/null 2>&1
|
||||
rm staging.*.image > /dev/null 2>&1
|
||||
}
|
||||
|
||||
get_boot_image() {
|
||||
wget http://factorcode.org/images/latest/$BOOT_IMAGE
|
||||
check_ret wget
|
||||
get_url http://factorcode.org/images/latest/$BOOT_IMAGE
|
||||
}
|
||||
|
||||
get_url() {
|
||||
if [[ $DOWNLOAD -eq "" ]] ; then
|
||||
set_downloader;
|
||||
fi
|
||||
echo "HI"
|
||||
echo $DOWNLOAD $1 ;
|
||||
$DOWNLOAD $1
|
||||
check_ret $DOWNLOAD
|
||||
}
|
||||
|
||||
maybe_download_dlls() {
|
||||
if [[ $OS == winnt ]] ; then
|
||||
wget http://factorcode.org/dlls/freetype6.dll
|
||||
check_ret wget
|
||||
wget http://factorcode.org/dlls/zlib1.dll
|
||||
check_ret wget
|
||||
wget http://factorcode.org/dlls/OpenAL32.dll
|
||||
check_ret wget
|
||||
wget http://factorcode.org/dlls/alut.dll
|
||||
check_ret wget
|
||||
wget http://factorcode.org/dlls/ogg.dll
|
||||
check_ret wget
|
||||
wget http://factorcode.org/dlls/theora.dll
|
||||
check_ret wget
|
||||
wget http://factorcode.org/dlls/vorbis.dll
|
||||
check_ret wget
|
||||
wget http://factorcode.org/dlls/sqlite3.dll
|
||||
check_ret wget
|
||||
get_url http://factorcode.org/dlls/freetype6.dll
|
||||
get_url http://factorcode.org/dlls/zlib1.dll
|
||||
get_url http://factorcode.org/dlls/OpenAL32.dll
|
||||
get_url http://factorcode.org/dlls/alut.dll
|
||||
get_url http://factorcode.org/dlls/ogg.dll
|
||||
get_url http://factorcode.org/dlls/theora.dll
|
||||
get_url http://factorcode.org/dlls/vorbis.dll
|
||||
get_url http://factorcode.org/dlls/sqlite3.dll
|
||||
chmod 777 *.dll
|
||||
check_ret chmod
|
||||
fi
|
||||
|
@ -321,7 +351,7 @@ install_libraries() {
|
|||
}
|
||||
|
||||
usage() {
|
||||
echo "usage: $0 install|install-x11|self-update|quick-update|update|bootstrap|wget-bootstrap"
|
||||
echo "usage: $0 install|install-x11|self-update|quick-update|update|bootstrap|net-bootstrap"
|
||||
echo "If you are behind a firewall, invoke as:"
|
||||
echo "env GIT_PROTOCOL=http $0 <command>"
|
||||
}
|
||||
|
@ -333,6 +363,6 @@ case "$1" in
|
|||
quick-update) update; refresh_image ;;
|
||||
update) update; update_bootstrap ;;
|
||||
bootstrap) get_config_info; bootstrap ;;
|
||||
wget-bootstrap) get_config_info; delete_boot_images; get_boot_image; bootstrap ;;
|
||||
net-bootstrap) get_config_info; delete_boot_images; get_boot_image; bootstrap ;;
|
||||
*) usage ;;
|
||||
esac
|
||||
|
|
Loading…
Reference in New Issue