enhance lsb_release detection for multi-docker
This commit is contained in:
parent
e3c6750942
commit
31f7d33d29
@ -50,12 +50,12 @@ lsb_dist=""
|
||||
# Detect the OS distro, we support ubuntu, debian, mint, centos, fedora dist
|
||||
detect_lsb() {
|
||||
case "$(uname -m)" in
|
||||
*64)
|
||||
;;
|
||||
*)
|
||||
echo "Error: We currently only support 64-bit platforms."
|
||||
exit 1
|
||||
;;
|
||||
*64)
|
||||
;;
|
||||
*)
|
||||
echo "Error: We currently only support 64-bit platforms."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if command_exists lsb_release; then
|
||||
@ -75,6 +75,15 @@ detect_lsb() {
|
||||
fi
|
||||
|
||||
lsb_dist="$(echo ${lsb_dist} | tr '[:upper:]' '[:lower:]')"
|
||||
|
||||
case "${lsb_dist}" in
|
||||
amzn|centos|debian|ubuntu)
|
||||
;;
|
||||
*)
|
||||
echo "Error: We currently only support ubuntu|debian|amzn|centos."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
@ -106,13 +115,13 @@ start_k8s(){
|
||||
source subnet.env
|
||||
|
||||
# Configure docker net settings, then restart it
|
||||
case "$lsb_dist" in
|
||||
case "${lsb_dist}" in
|
||||
amzn)
|
||||
DOCKER_CONF="/etc/sysconfig/docker"
|
||||
echo "OPTIONS=\"\$OPTIONS --mtu=${FLANNEL_MTU} --bip=${FLANNEL_SUBNET}\"" | sudo tee -a ${DOCKER_CONF}
|
||||
ifconfig docker0 down
|
||||
yum -y -q install bridge-utils && brctl delbr docker0 && service docker restart
|
||||
;;
|
||||
;;
|
||||
centos)
|
||||
DOCKER_CONF="/etc/sysconfig/docker"
|
||||
echo "OPTIONS=\"\$OPTIONS --mtu=${FLANNEL_MTU} --bip=${FLANNEL_SUBNET}\"" | sudo tee -a ${DOCKER_CONF}
|
||||
@ -121,17 +130,17 @@ start_k8s(){
|
||||
fi
|
||||
ifconfig docker0 down
|
||||
yum -y -q install bridge-utils && brctl delbr docker0 && systemctl restart docker
|
||||
;;
|
||||
;;
|
||||
ubuntu|debian)
|
||||
DOCKER_CONF="/etc/default/docker"
|
||||
echo "DOCKER_OPTS=\"\$DOCKER_OPTS --mtu=${FLANNEL_MTU} --bip=${FLANNEL_SUBNET}\"" | sudo tee -a ${DOCKER_CONF}
|
||||
ifconfig docker0 down
|
||||
apt-get install bridge-utils && brctl delbr docker0 && service docker restart
|
||||
;;
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported operations system $lsb_dist"
|
||||
echo "Unsupported operations system ${lsb_dist}"
|
||||
exit 1
|
||||
;;
|
||||
;;
|
||||
esac
|
||||
|
||||
# sleep a little bit
|
||||
|
@ -59,12 +59,12 @@ lsb_dist=""
|
||||
# Detect the OS distro, we support ubuntu, debian, mint, centos, fedora dist
|
||||
detect_lsb() {
|
||||
case "$(uname -m)" in
|
||||
*64)
|
||||
;;
|
||||
*)
|
||||
echo "Error: We currently only support 64-bit platforms."
|
||||
exit 1
|
||||
;;
|
||||
*64)
|
||||
;;
|
||||
*)
|
||||
echo "Error: We currently only support 64-bit platforms."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if command_exists lsb_release; then
|
||||
@ -84,6 +84,15 @@ detect_lsb() {
|
||||
fi
|
||||
|
||||
lsb_dist="$(echo ${lsb_dist} | tr '[:upper:]' '[:lower:]')"
|
||||
|
||||
case "${lsb_dist}" in
|
||||
amzn|centos|debian|ubuntu)
|
||||
;;
|
||||
*)
|
||||
echo "Error: We currently only support ubuntu|debian|amzn|centos."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
@ -108,7 +117,7 @@ start_k8s() {
|
||||
source subnet.env
|
||||
|
||||
# Configure docker net settings, then restart it
|
||||
case "$lsb_dist" in
|
||||
case "${lsb_dist}" in
|
||||
centos)
|
||||
DOCKER_CONF="/etc/sysconfig/docker"
|
||||
echo "OPTIONS=\"\$OPTIONS --mtu=${FLANNEL_MTU} --bip=${FLANNEL_SUBNET}\"" | sudo tee -a ${DOCKER_CONF}
|
||||
@ -117,23 +126,23 @@ start_k8s() {
|
||||
fi
|
||||
ifconfig docker0 down
|
||||
yum -y -q install bridge-utils && brctl delbr docker0 && systemctl restart docker
|
||||
;;
|
||||
;;
|
||||
amzn)
|
||||
DOCKER_CONF="/etc/sysconfig/docker"
|
||||
echo "OPTIONS=\"\$OPTIONS --mtu=${FLANNEL_MTU} --bip=${FLANNEL_SUBNET}\"" | sudo tee -a ${DOCKER_CONF}
|
||||
ifconfig docker0 down
|
||||
yum -y -q install bridge-utils && brctl delbr docker0 && service docker restart
|
||||
;;
|
||||
;;
|
||||
ubuntu|debian)
|
||||
DOCKER_CONF="/etc/default/docker"
|
||||
echo "DOCKER_OPTS=\"\$DOCKER_OPTS --mtu=${FLANNEL_MTU} --bip=${FLANNEL_SUBNET}\"" | sudo tee -a ${DOCKER_CONF}
|
||||
ifconfig docker0 down
|
||||
apt-get install bridge-utils && brctl delbr docker0 && service docker restart
|
||||
;;
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported operations system $lsb_dist"
|
||||
echo "Unsupported operations system ${lsb_dist}"
|
||||
exit 1
|
||||
;;
|
||||
;;
|
||||
esac
|
||||
|
||||
# sleep a little bit
|
||||
|
Loading…
Reference in New Issue
Block a user