os-xenapi/os_xenapi/utils/shell_tools/install_conntrack.sh
naichuans 02e19615ac os-xenapi: Add utility to enable conntrack service
Add utility to enable conntrack service

Change-Id: I8cd77832ed90c1b7c951d36402b52d9a3e9f9d98
2018-01-22 03:14:42 +00:00

18 lines
553 B
Bash

#!/bin/bash
set -e
REPO_NAME="CentOS-Base.repo"
REPO_PATH="/etc/yum.repos.d/$REPO_NAME"
TMP_REPO_DIR="/tmp/repo/"
TMP_REPO_PATH=$TMP_REPO_DIR$REPO_NAME
PKG_NAME="conntrack-tools"
if ! yum list installed $PKG_NAME; then
mkdir -p $TMP_REPO_DIR
cp $REPO_PATH $TMP_REPO_DIR
sed -i s/#baseurl=/baseurl=/g $TMP_REPO_PATH
centos_ver=$(yum version nogroups |grep Installed | cut -d' ' -f 2 | cut -d'/' -f 1 | cut -d'-' -f 1)
yum install -y -c $TMP_REPO_PATH --enablerepo=base --releasever=$centos_ver $PKG_NAME
rm -rf $TMP_REPO_DIR
fi