mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-21 17:10:35 +00:00
We have recently fixed the ami init scripts to mark i3 as a supported instance. However, the code to detect whether or not the instance is supported is duplicated, and called from multiple locations. That means that when the user logs in, it will see the instance as not supported - as the test is coming from a different source. This patch moves it to the scylla_lib.sh utilities script, so we can share it, and make sure it is right for all locations. Signed-off-by: Glauber Costa <glauber@scylladb.com> Message-Id: <20170406201137.8921-1-glauber@scylladb.com>
42 lines
770 B
Bash
42 lines
770 B
Bash
#
|
|
# Copyright (C) 2016 ScyllaDB
|
|
|
|
is_debian_variant() {
|
|
[ -f /etc/debian_version ]
|
|
}
|
|
|
|
is_redhat_variant() {
|
|
[ -f /etc/redhat-release ]
|
|
}
|
|
|
|
is_systemd() {
|
|
grep -q '^systemd$' /proc/1/comm
|
|
}
|
|
|
|
is_ec2() {
|
|
[ -f /sys/hypervisor/uuid ] && [ "$(head -c 3 /sys/hypervisor/uuid)" = "ec2" ]
|
|
}
|
|
|
|
ec2_is_supported_instance_type() {
|
|
TYPE=`curl -s http://169.254.169.254/latest/meta-data/instance-type|cut -d . -f 1`
|
|
case $TYPE in
|
|
"m3"|"c3"|"i2"|"i3") echo 1;;
|
|
*) echo 0;;
|
|
esac
|
|
}
|
|
|
|
. /etc/os-release
|
|
if is_debian_variant; then
|
|
SYSCONFIG=/etc/default
|
|
else
|
|
SYSCONFIG=/etc/sysconfig
|
|
fi
|
|
. $SYSCONFIG/scylla-server
|
|
|
|
for i in /etc/scylla.d/*.conf; do
|
|
if [ "$i" = "/etc/scylla.d/*.conf" ]; then
|
|
break
|
|
fi
|
|
. "$i"
|
|
done
|