#!/bin/bash
sorgenti=( 'https://ufficiozero.mirror.garr.it/3rd-party-software/arubasign/24.0.2/ArubaSign-latest-LINUX.tar.bz2' \
 'https://sourceforge.net/projects/ufficiozero/files/3rd-party-software/arubasign/24.0.2/ArubaSign-latest-LINUX.tar.bz2' \ 
'https://ftp.acc.umu.se/mirror/ufficiozero.org/3rd-party-software/arubasign/24.0.2/ArubaSign-latest-LINUX.tar.bz2' \
'https://infomaniak.ufficiozero.org/3rd-party-software/arubasign/24.0.2/ArubaSign-latest-LINUX.tar.bz2' \
'https://mirror.group.one/ufficio/3rd-party-software/arubasign/24.0.2/ArubaSign-latest-LINUX.tar.bz2' \
'https://mirroronet.pl/pub/mirrors/ufficiozero/3rd-party-software/arubasign/24.0.2/ArubaSign-latest-LINUX.tar.bz2' \
'https://mirror.yandex.ru/ufficiozero/3rd-party-software/arubasign/24.0.2/ArubaSign-latest-LINUX.tar.bz2' \
'https://ftp.icm.edu.pl/pub/Linux/dist/ufficiozero/3rd-party-software/arubasign/24.0.2/ArubaSign-latest-LINUX.tar.bz2' \ 
'https://mirrors.dotsrc.org/ufficiozero/3rd-party-software/arubasign/24.0.2/ArubaSign-latest-LINUX.tar.bz2' \
'https://ftp.nluug.nl/pub/os/Linux/distr/ufficiozero/3rd-party-software/arubasign/24.0.2/ArubaSign-latest-LINUX.tar.bz2' \
'https://quantum-mirror.hu/mirrors/pub/ufficiozero/3rd-party-software/arubasign/24.0.2/ArubaSign-latest-LINUX.tar.bz2' )

if mkdir -p ~/.arubasign && cd ~/.arubasign; then
    x=0
    while [ "$x" -lt ${#sorgenti[*]} ]; do
        wget -O ArubaSign-latest-LINUX.tar.bz2 ${sorgenti[$x]} && break
        let x++
    done
    
    if [ "$x" -lt ${#sorgenti[*]} ]; then
        tar -xjvf ArubaSign-latest-LINUX.tar.bz2 &&
            chmod +x ./users/install.sh &&
            ./users/install.sh
    fi
fi
