diff --git a/debian/install.sh b/debian/install.sh index 0b612f0..9565504 100755 --- a/debian/install.sh +++ b/debian/install.sh @@ -43,32 +43,83 @@ if [ $HELP = true ]; then exit; fi -if [ $CPU_CHECK = true ]; then - #check what the CPU is - OS_bits=$(uname -m) - OS_arch=$(uname -m) - CPU_bits='i686' +if [ $CPU_CHECK = true ] && [ $USE_SWITCH_SOURCE = false ]; then + #check what the CPU and OS are + OS_test=$(uname -m) + CPU_arch='unknown' + OS_bits='unknown' + CPU_bits='unknown' + if [ $OS_test = 'armv7l' ]; then + OS_bits='32' + CPU_bits='32' + # RaspberryPi 3 is actually armv8l but current Raspbian reports the cpu as armv7l and no Raspbian 64Bit has been released at this time + CPU_arch='arm' + elif [ $OS_test = 'armv8l' ]; then + # We currently have no test case for armv8l + OS_bits='unknown' + CPU_bits='64' + CPU_arch='arm' + elif [ $OS_test = 'i386' ]; then + OS_bits='32' if [ "$(grep -o -w 'lm' /proc/cpuinfo)" = 'lm' ]; then - CPU_bits='x86_64' + CPU_bits='64' + else + CPU_bits='32' + fi + CPU_arch='x86' + elif [ $OS_test = 'i686' ]; then + OS_bits='32' + if [ $(grep -o -w 'lm' /proc/cpuinfo) = 'lm' ]; then + CPU_bits='64' + else + CPU_bits='32' + fi + CPU_arch='x86' + elif [ $OS_test = 'x86_64' ]; then + OS_bits='64' + if [ $(grep -o -w 'lm' /proc/cpuinfo) = 'lm' ]; then + CPU_bits='64' + else + CPU_bits='32' + fi + CPU_arch='x86' fi - if [ $USE_SWITCH_SOURCE = false ]; then - if [ $OS_arch = 'armv7l' ]; then - if [ $USE_SWITCH_PACKAGE_UNOFFICIAL_ARM = false ] && [ OS_bits = 'i686' ]; then + if [ $CPU_arch = 'arm' ]; then + if [ $OS_bits = '32' ]; then + if [ $USE_SWITCH_PACKAGE_UNOFFICIAL_ARM = false ]; then error "You are using a 32bit arm OS this is unsupported" warning " please rerun with either --use-switch-package-unofficial-arm or --use-switch-source" exit 3 + else + verbose "Correct CPU/OS detected, using unofficial arm repo" fi + elif [ $OS_bits = '64' ]; then + error "You are using a 64bit arm OS this is unsupported" + warning " please rerun with --use-switch-source" + exit 3 else - if [ $OS_bits = 'i686' ]; then - error "You are using a 32bit OS this is unsupported" - if [ $CPU_bits = 'x86_64' ]; then - error "Your CPU is 64bit you should consider reinstalling with a 64bit OS" - fi - warning " please rerun with --use-switch-source" - exit 3 - fi + error "Unknown OS_bits $OS_bits this is unsupported" + warning " please rerun with --use-switch-source" + exit 3 fi + elif [ $CPU_arch = 'x86' ]; then + if [ $OS_bits = '32' ]; then + error "You are using a 32bit OS this is unsupported" + if [ $CPU_bits = '64' ]; then + warning " Your CPU is 64bit you should consider reinstalling with a 64bit OS" + fi + warning " please rerun with --use-switch-source" + exit 3 + elif [ $OS_bits = '64' ]; then + verbose "Correct CPU/OS detected" + else + error "Unknown OS_bits $OS_bits this is unsupported" + warning " please rerun with --use-switch-source" + exit 3 + fi + else + error "You are using a unsupported architecture $CPU_arch" fi fi diff --git a/install.sh b/install.sh index 51cdf81..a2c6ee9 100644 --- a/install.sh +++ b/install.sh @@ -45,6 +45,7 @@ chmod +x $0 #Os/Distro Check os_check=$(lsb_release -is) +real_os=$os_check check_major_release=$(lsb_release -rs | cut -d. -f1) os_unsupported () { @@ -54,6 +55,10 @@ os_unsupported () { exit 2; } +if [ $os_check = 'Raspbian' ]; then + echo "${yellow}Detected Raspbian, using Debian for compatibility${normal}" + os_check="Debian" +fi if [ $os_check = 'Debian' ]; then if [ $check_major_release -ge 8 ]; then verbose "Removing the CD image from /etc/apt/sources.list" @@ -73,7 +78,7 @@ if [ $os_check = 'Debian' ]; then cd /usr/src/fusionpbx-install.sh/debian ./install.sh $@ else - error "Although you are running Debian we require version >= 8" + error "Although you are running $real_os we require version >= 8" os_unsupported fi else