Skip to content

Instantly share code, notes, and snippets.

@SofianeHamlaoui
Created February 15, 2020 04:59
Show Gist options
  • Select an option

  • Save SofianeHamlaoui/0853b206d296c9c4a1b4255031abcc97 to your computer and use it in GitHub Desktop.

Select an option

Save SofianeHamlaoui/0853b206d296c9c4a1b4255031abcc97 to your computer and use it in GitHub Desktop.
checkPrerequisites
function checkPrerequisites(){
if ! uname -a | grep -i "x86_64" | grep -qi "Linux"; then
echo >&2 "Sorry! This installer is only compatible with Linux on x86_64. Terminating."
exit 10
fi
if ! grep -q '\<avx[^ ]*\>' /proc/cpuinfo; then
echo >&2 "Sorry! Kite only runs on processor architectures with AVX support. Exiting now."
exit 12
fi
if [ -f /etc/centos-release ] && [ $(cat /etc/centos-release | tr -dc '0-9.' | cut -d \. -f1) -lt 8 ]; then
echo >&2 "Sorry! This installer is not compatible with CentOS 7 and earlier due to incomplete systemd support."
echo >&2 "See https://bugzilla.redhat.com/show_bug.cgi?id=1173278 for details. Exiting now."
exit 10
fi
if [ -f /etc/redhat-release ] && [ $(cat /etc/redhat-release | tr -dc '0-9.' | cut -d \. -f1) -lt 8 ]; then
echo >&2 "Sorry! This installer is not compatible with RHEL 7 and earlier due to incomplete systemd support."
echo >&2 "See https://bugzilla.redhat.com/show_bug.cgi?id=1173278 for details. Exiting now."
exit 10
fi
if [ "$(id -u)" = "0" ]; then
echo >&2 "Sorry! This installer should not be run as root. Terminating."
exit 20
fi
if ! command -v systemctl &> /dev/null; then
echo >&2 "Sorry! We use systemd to setup services as part of the Kite install, and we couldn't find it on"
echo >&2 "your system. We currently don't support distributions that do not use systemd. Exiting now."
exit 30
fi
if uname -r | grep -qi "Microsoft"; then
echo >&2 "Sorry! This installer is not compatible with Windows Subsystem for Linux. Exiting now."
exit 40
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment