Nice script ..
but this script installs only x86 version.
you can find which architecture the os is and then download the respective file
example :
PHP Code: 

if $(uname -grep 'x86_64'); then
wget http
://example.com/example_x86_64.zip