fix shellcheck failures of test/e2e_node/environment/setup_host.sh

k3s-v1.15.3
SataQiu 2019-04-22 22:08:26 +08:00
parent 75d45bdfc9
commit c892beca8b
2 changed files with 8 additions and 13 deletions

View File

@ -69,6 +69,5 @@
./test/cmd/template-output.sh ./test/cmd/template-output.sh
./test/cmd/version.sh ./test/cmd/version.sh
./test/e2e_node/conformance/run_test.sh ./test/e2e_node/conformance/run_test.sh
./test/e2e_node/environment/setup_host.sh
./test/e2e_node/gubernator.sh ./test/e2e_node/gubernator.sh
./test/images/image-util.sh ./test/images/image-util.sh

View File

@ -42,38 +42,35 @@ EOF
fi fi
# For coreos, disable updates # For coreos, disable updates
if $(sudo systemctl status update-engine &>/dev/null); then if sudo systemctl status update-engine &>/dev/null; then
sudo systemctl mask update-engine locksmithd sudo systemctl mask update-engine locksmithd
fi fi
# Fixup sudoers require tty # Fixup sudoers require tty
sudo grep -q "# Defaults requiretty" /etc/sudoers if ! sudo grep -q "# Defaults requiretty" /etc/sudoers; then
if [ $? -ne 0 ] ; then
sudo sed -i 's/Defaults requiretty/# Defaults requiretty/' /etc/sudoers sudo sed -i 's/Defaults requiretty/# Defaults requiretty/' /etc/sudoers
fi fi
# Install nsenter for ubuntu images # Install nsenter for ubuntu images
cat /etc/*-release | grep "ID=ubuntu" if cat /etc/*-release | grep "ID=ubuntu"; then
if [ $? -eq 0 ]; then
if ! which nsenter > /dev/null; then if ! which nsenter > /dev/null; then
echo "Do not find nsenter. Install it." echo "Do not find nsenter. Install it."
NSENTER_BUILD_DIR=$(mktemp -d /tmp/nsenter-build-XXXXXX) NSENTER_BUILD_DIR=$(mktemp -d /tmp/nsenter-build-XXXXXX)
cd $NSENTER_BUILD_DIR cd "$NSENTER_BUILD_DIR" || exit 1
curl https://www.kernel.org/pub/linux/utils/util-linux/v2.31/util-linux-2.31.tar.gz | tar -zxf- curl https://www.kernel.org/pub/linux/utils/util-linux/v2.31/util-linux-2.31.tar.gz | tar -zxf-
sudo apt-get update sudo apt-get update
sudo apt-get --yes install make sudo apt-get --yes install make
sudo apt-get --yes install gcc sudo apt-get --yes install gcc
cd util-linux-2.31 cd util-linux-2.31 || exit 1
./configure --without-ncurses ./configure --without-ncurses
make nsenter make nsenter
sudo cp nsenter /usr/local/bin sudo cp nsenter /usr/local/bin
rm -rf $NSENTER_BUILD_DIR rm -rf "$NSENTER_BUILD_DIR"
fi fi
fi fi
# Install docker # Install docker
hash docker 2>/dev/null if ! hash docker 2>/dev/null; then
if [ $? -ne 0 ]; then
# RHEL platforms should always install from RHEL repository # RHEL platforms should always install from RHEL repository
# This will install the latest supported stable docker platform on RHEL # This will install the latest supported stable docker platform on RHEL
if [ $OS_RHEL -eq 0 ]; then if [ $OS_RHEL -eq 0 ]; then
@ -93,8 +90,7 @@ id jenkins || sudo useradd jenkins -m
sudo usermod -a -G docker jenkins sudo usermod -a -G docker jenkins
# install lxc # install lxc
cat /etc/*-release | grep "ID=debian" if ! cat /etc/*-release | grep "ID=debian"; then
if [ $? -ne 0 ]; then
hash apt-get 2>/dev/null hash apt-get 2>/dev/null
if [ $? -ne 1 ]; then if [ $? -ne 1 ]; then
sudo apt-get install lxc -y sudo apt-get install lxc -y