Enhance - report more on error in enviroment.sh (#99)

When there is a error with the enviroment report more information
fixes for the centos script that had some parts wrong
This commit is contained in:
Mafoo
2017-09-02 16:10:37 +01:00
committed by FusionPBX
parent a33131c8be
commit d612f4c553
3 changed files with 91 additions and 60 deletions

View File

@@ -4,21 +4,22 @@
os_name=$(uname -s) os_name=$(uname -s)
os_version=$(uname -r) os_version=$(uname -r)
os_mode='unknown' os_mode='unknown'
os_test=$(uname -m)
#cpu details
cpu_name=$(uname -m)
cpu_architecture='unknown' cpu_architecture='unknown'
cpu_mode='unknown'
#check what the CPU and OS are #check what the CPU and OS are
cpu_name='unknown'
cpu_mode='unknown'
if [ .$cpu_name = .'armv7l' ]; then 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' os_mode='32'
cpu_mode='32' cpu_mode='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_architecture='arm' cpu_architecture='arm'
elif [ .$cpu_name = .'armv8l' ]; then elif [ .$cpu_name = .'armv8l' ]; then
# We currently have no test case for armv8l # We currently have no test case for armv8l
os_mode='unknown' os_mode='unknown'
cpu_name='64' cpu_mode='64'
cpu_architecture='arm' cpu_architecture='arm'
elif [ .$cpu_name = .'i386' ]; then elif [ .$cpu_name = .'i386' ]; then
os_mode='32' os_mode='32'
@@ -44,6 +45,9 @@ cpu_architecture='unknown'
os_mode='32' os_mode='32'
fi fi
cpu_architecture='x86' cpu_architecture='x86'
else
error "You are using an unsupported cpu '$cpu_name'"
exit 3
fi fi
if [ .$cpu_architecture = .'arm' ]; then if [ .$cpu_architecture = .'arm' ]; then
@@ -57,12 +61,21 @@ cpu_architecture='unknown'
fi fi
exit 3 exit 3
elif [ .$os_mode = .'64' ]; then elif [ .$os_mode = .'64' ]; then
verbose "Correct CPU/OS detected" verbose "Correct CPU and Operating System detected"
else else
error "Unknown os_mode $os_mode this is unsupported" error "Unknown Operating System mode '$os_mode' is unsupported"
warning "Detected environment was :-"
warning "os_name:'$os_name'"
warning "os_mode:'$os_mode'"
warning "cpu_name:'$cpu_name'"
warning "cpu_architecture:'$cpu_architecture'"
exit 3 exit 3
fi fi
else else
error "You are using a unsupported architecture $cpu_architecture" error "You are using an unsupported architecture '$cpu_architecture'"
fi warning "Detected environment was :-"
warning "os_name:'$os_name'"
warning "os_mode:'$os_mode'"
warning "cpu_name:'$cpu_name'"
exit 3
fi fi

View File

@@ -10,6 +10,7 @@ cpu_name=$(uname -m)
cpu_architecture='unknown' cpu_architecture='unknown'
cpu_mode='unknown' cpu_mode='unknown'
#check what the CPU and OS are
if [ .$cpu_name = .'armv7l' ]; then 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 # 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' os_mode='32'
@@ -44,6 +45,9 @@ elif [ .$cpu_name = .'x86_64' ]; then
cpu_mode='32' cpu_mode='32'
fi fi
cpu_architecture='x86' cpu_architecture='x86'
else
error "You are using an unsupported cpu '$cpu_name'"
exit 3
fi fi
if [ .$cpu_architecture = .'arm' ]; then if [ .$cpu_architecture = .'arm' ]; then
@@ -69,11 +73,16 @@ elif [ .$cpu_architecture = .'x86' ]; then
elif [ .$os_mode = .'64' ]; then elif [ .$os_mode = .'64' ]; then
verbose "Correct CPU and Operating System detected" verbose "Correct CPU and Operating System detected"
else else
error "Unknown Operating System mode $os_mode is unsupported" error "Unknown Operating System mode '$os_mode' is unsupported"
switch_source=true switch_source=true
switch_package=false switch_package=false
fi fi
else else
error "You are using a unsupported architecture $cpu_architecture" error "You are using an unsupported architecture '$cpu_architecture'"
warning "Detected environment was :-"
warning "os_name:'$os_name'"
warning "os_codename:'$os_codename'"
warning "os_mode:'$os_mode'"
warning "cpu_name:'$cpu_name'"
exit 3 exit 3
fi fi

View File

@@ -10,6 +10,7 @@ cpu_name=$(uname -m)
cpu_architecture='unknown' cpu_architecture='unknown'
cpu_mode='unknown' cpu_mode='unknown'
#check what the CPU and OS are
if [ .$cpu_name = .'armv7l' ]; then 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 # 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' os_mode='32'
@@ -44,6 +45,9 @@ elif [ .$cpu_name = .'x86_64' ]; then
cpu_mode='32' cpu_mode='32'
fi fi
cpu_architecture='x86' cpu_architecture='x86'
else
error "You are using an unsupported cpu '$cpu_name'"
exit 3
fi fi
if [ .$cpu_architecture = .'arm' ]; then if [ .$cpu_architecture = .'arm' ]; then
@@ -69,11 +73,16 @@ elif [ .$cpu_architecture = .'x86' ]; then
elif [ .$os_mode = .'64' ]; then elif [ .$os_mode = .'64' ]; then
verbose "Correct CPU and Operating System detected" verbose "Correct CPU and Operating System detected"
else else
error "Unknown Operating System mode $os_mode is unsupported" error "Unknown Operating System mode '$os_mode' is unsupported"
switch_source=true switch_source=true
switch_package=false switch_package=false
fi fi
else else
error "You are using a unsupported architecture $cpu_architecture" error "You are using an unsupported architecture '$cpu_architecture'"
warning "Detected environment was :-"
warning "os_name:'$os_name'"
warning "os_codename:'$os_codename'"
warning "os_mode:'$os_mode'"
warning "cpu_name:'$cpu_name'"
exit 3 exit 3
fi fi