fusionpbx-install.sh/debian/resources/environment.sh

80 lines
2.0 KiB
Bash
Raw Normal View History

2017-03-04 23:09:21 +01:00
#!/bin/sh
2017-03-05 19:01:37 +01:00
#operating system details
os_name=$(lsb_release -is)
os_codename=$(lsb_release -cs)
2017-03-05 19:05:17 +01:00
os_mode='unknown'
2017-03-05 19:01:37 +01:00
#cpu details
2017-03-04 23:09:21 +01:00
cpu_name=$(uname -m)
cpu_architecture='unknown'
cpu_mode='unknown'
if [ .$cpu_name = .'armv7l' ]; then
# RaspberryPi 3 is actually armv8l but current Raspbian reports the cpu as armv7l and no Raspbian 64Bit has been released at this time
os_mode='32'
cpu_mode='32'
cpu_architecture='arm'
elif [ .$cpu_name = .'armv8l' ]; then
# No test case for armv8l
os_mode='unknown'
cpu_mode='64'
cpu_architecture='arm'
elif [ .$cpu_name = .'i386' ]; then
os_mode='32'
if [ .$(grep -o -w 'lm' /proc/cpuinfo | head -n 1) = .'lm' ]; then
cpu_mode='64'
else
cpu_mode='32'
fi
cpu_architecture='x86'
elif [ .$cpu_name = .'i686' ]; then
os_mode='32'
if [ .$(grep -o -w 'lm' /proc/cpuinfo | head -n 1) = .'lm' ]; then
cpu_mode='64'
else
cpu_mode='32'
fi
cpu_architecture='x86'
elif [ .$cpu_name = .'x86_64' ]; then
os_mode='64'
if [ .$(grep -o -w 'lm' /proc/cpuinfo | head -n 1) = .'lm' ]; then
cpu_mode='64'
else
cpu_mode='32'
fi
cpu_architecture='x86'
fi
if [ .$cpu_architecture = .'arm' ]; then
if [ .$os_mode = .'32' ]; then
2017-03-04 23:20:28 +01:00
verbose "Correct CPU and Operating System detected, using the ARM repo"
2017-03-04 23:09:21 +01:00
elif [ .$os_mode = .'64' ]; then
error "You are using a 64bit arm OS this is unsupported"
2017-03-04 23:20:28 +01:00
switch_source=true
switch_package=false
2017-03-04 23:09:21 +01:00
else
2017-03-04 23:20:28 +01:00
error "Unknown OS mode $os_mode this is unsupported"
switch_source=true
switch_package=false
2017-03-04 23:09:21 +01:00
fi
elif [ .$cpu_architecture = .'x86' ]; then
if [ .$os_mode = .'32' ]; then
error "You are using a 32bit OS this is unsupported"
if [ .$cpu_mode = .'64' ]; then
warning " Your CPU is 64bit you should consider reinstalling with a 64bit OS"
fi
2017-03-04 23:20:28 +01:00
switch_source=true
switch_package=false
2017-03-04 23:09:21 +01:00
elif [ .$os_mode = .'64' ]; then
2017-03-04 23:20:28 +01:00
verbose "Correct CPU and Operating System detected"
2017-03-04 23:09:21 +01:00
else
2017-03-04 23:20:28 +01:00
error "Unknown Operating System mode $os_mode is unsupported"
switch_source=true
switch_package=false
2017-03-04 23:09:21 +01:00
fi
else
error "You are using a unsupported architecture $cpu_architecture"
2017-03-04 23:20:28 +01:00
exit 3
2017-03-04 23:09:21 +01:00
fi