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