Enhance-Add OS-CPU bit checking (#17)
encourage users to submit the output of lsb_release as an issue when that test fails, this should allow contributors not in irc at the time of the problem to see the information Add CPU and OS bit checking which can be disabled with --no-cpu-check
This commit is contained in:
parent
bded377c9a
commit
5482b1b932
|
|
@ -1,15 +1,18 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
#Process command line options
|
#Process command line options
|
||||||
OPTS=`getopt -n 'install.sh' -o h -l help,use-switch-source,use-switch-package-all,use-switch-master,use-switch-package-unofficial-arm -- "$@"`
|
ARGS=$(getopt -n 'install.sh' -o h -l help,use-switch-source,use-switch-package-all,use-switch-master,use-switch-package-unofficial-arm,no-cpu-check -- "$@")
|
||||||
eval set -- "$OPTS"
|
|
||||||
|
|
||||||
if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Failed parsing options."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
export USE_SWITCH_SOURCE=false
|
export USE_SWITCH_SOURCE=false
|
||||||
export USE_SWITCH_PACKAGE_ALL=false
|
export USE_SWITCH_PACKAGE_ALL=false
|
||||||
export USE_SWITCH_PACKAGE_UNOFFICIAL_ARM=false
|
export USE_SWITCH_PACKAGE_UNOFFICIAL_ARM=false
|
||||||
export USE_SWITCH_MASTER=false
|
export USE_SWITCH_MASTER=false
|
||||||
|
export CPU_CHECK=true
|
||||||
HELP=false
|
HELP=false
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
|
|
@ -18,6 +21,7 @@ while true; do
|
||||||
--use-switch-package-all ) export USE_SWITCH_PACKAGE_ALL=true; shift ;;
|
--use-switch-package-all ) export USE_SWITCH_PACKAGE_ALL=true; shift ;;
|
||||||
--use-switch-package-unofficial-arm ) export USE_SWITCH_PACKAGE_UNOFFICIAL_ARM=true; shift ;;
|
--use-switch-package-unofficial-arm ) export USE_SWITCH_PACKAGE_UNOFFICIAL_ARM=true; shift ;;
|
||||||
--use-switch-master ) export USE_SWITCH_MASTER=true; shift ;;
|
--use-switch-master ) export USE_SWITCH_MASTER=true; shift ;;
|
||||||
|
--no-cpu-check ) export CPU_CHECK=false; shift ;;
|
||||||
-h | --help ) HELP=true; shift ;;
|
-h | --help ) HELP=true; shift ;;
|
||||||
-- ) shift; break ;;
|
-- ) shift; break ;;
|
||||||
* ) break ;;
|
* ) break ;;
|
||||||
|
|
@ -30,9 +34,39 @@ if [ $HELP = true ]; then
|
||||||
echo " --use-switch-package-all if using packages use the meta-all package"
|
echo " --use-switch-package-all if using packages use the meta-all package"
|
||||||
echo " --use-switch-package-unofficial-arm if your system is arm and you are using packages, use the unofficial arm repo"
|
echo " --use-switch-package-unofficial-arm if your system is arm and you are using packages, use the unofficial arm repo"
|
||||||
echo " --use-switch-master will use master branch/packages instead of (default:stable)"
|
echo " --use-switch-master will use master branch/packages instead of (default:stable)"
|
||||||
|
echo " --no-cpu-check disable the cpu check (default:check)"
|
||||||
exit;
|
exit;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ $CPU_CHECK = true ]; then
|
||||||
|
#check what the CPU is
|
||||||
|
OS_bits=$(uname -m)
|
||||||
|
OS_arch=$(uname -m)
|
||||||
|
CPU_bits='i686'
|
||||||
|
if [ $(grep -o -w 'lm' /proc/cpuinfo) = 'lm' ]; then
|
||||||
|
CPU_bits='x86_64'
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $USE_SWITCH_SOURCE = false ]; then
|
||||||
|
if [ $OS_arch = 'armv7l' ]; then
|
||||||
|
if [ $USE_SWITCH_PACKAGE_UNOFFICIAL_ARM = false && OS_bits = 'i686' ]; then
|
||||||
|
echo "You are using a 32bit arm OS this is unsupported"
|
||||||
|
echo " please rerun with either --use-switch-package-unofficial-arm or --use-switch-source"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ $OS_bits = 'i686' ]; then
|
||||||
|
echo "You are using a 32bit OS this is unsupported"
|
||||||
|
if [ $CPU_bits = 'x86_64' ]; then
|
||||||
|
echo "Your CPU is 64bit you should consider reinstalling with a 64bit OS"
|
||||||
|
fi
|
||||||
|
echo " please rerun with --use-switch-source"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# removes the cd img from the /etc/apt/sources.list file (not needed after base install)
|
# removes the cd img from the /etc/apt/sources.list file (not needed after base install)
|
||||||
sed -i '/cdrom:/d' /etc/apt/sources.list
|
sed -i '/cdrom:/d' /etc/apt/sources.list
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,9 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
# Exit codes
|
||||||
|
# 1 general error
|
||||||
|
# 2 unsupported OS
|
||||||
|
# 3 unsupported CPU/OS bits
|
||||||
|
|
||||||
# check to confirm running as root.
|
# check to confirm running as root.
|
||||||
if [ "$(id -u)" -ne "0" ]; then
|
if [ "$(id -u)" -ne "0" ]; then
|
||||||
echo "$(basename "$0") must be run as root";
|
echo "$(basename "$0") must be run as root";
|
||||||
|
|
@ -9,7 +14,6 @@ echo
|
||||||
#Os/Distro Check
|
#Os/Distro Check
|
||||||
os_check=$(lsb_release -is)
|
os_check=$(lsb_release -is)
|
||||||
check_major_release=$(lsb_release -rs | cut -d. -f1)
|
check_major_release=$(lsb_release -rs | cut -d. -f1)
|
||||||
lsb_release -c | grep -i jessie > /dev/null
|
|
||||||
|
|
||||||
os_unsupported () {
|
os_unsupported () {
|
||||||
echo " Your Operating System appears to be: "
|
echo " Your Operating System appears to be: "
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue