Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
Only check kernel version and ip command in local mode (close #540)
Browse files Browse the repository at this point in the history
  • Loading branch information
errordeveloper authored and rade committed Apr 10, 2015
1 parent 8fcd56b commit 35d32bd
Showing 1 changed file with 26 additions and 24 deletions.
50 changes: 26 additions & 24 deletions weave
Original file line number Diff line number Diff line change
Expand Up @@ -520,22 +520,6 @@ container_weave_addrs() {
ip netns exec $NETNS ip addr show dev $CONTAINER_IFNAME
}

uname -s -r | sed -n -e 's|^\([^ ]*\) \([0-9][0-9]*\)\.\([0-9][0-9]*\).*|\1 \2 \3|p' | {
if ! read sys maj min ; then
echo "ERROR: Unable to parse operating system version $(uname -s -r)" >&2
exit 1
fi

if [ "$sys" != 'Linux' ] ; then
echo "ERROR: Operating systems other than Linux are not supported (you have $(uname -s -r))" >&2
exit 1
fi

if ! [ \( "$maj" -eq 3 -a "$min" -ge 5 \) -o "$maj" -gt 3 ] ; then
echo "WARNING: Linux kernel version 3.5 or newer is required (you have ${maj}.${min})" >&2
fi
}

ask_version() {
if ! DOCKERIMAGE=$(docker inspect --format='{{.Image}}' $1 2>/dev/null) ; then
if ! DOCKERIMAGE=$(docker inspect --format='{{.Id}}' $2 2>/dev/null) ; then
Expand All @@ -545,15 +529,33 @@ ask_version() {
[ -n "$DOCKERIMAGE" ] && docker run --rm $DOCKERIMAGE --version
}

if ! command_exists ip ; then
echo "ERROR: ip utility is missing. Please install it." >&2
exit 1
fi
if [ -n "$LOCAL" ]; then
uname -s -r | sed -n -e 's|^\([^ ]*\) \([0-9][0-9]*\)\.\([0-9][0-9]*\).*|\1 \2 \3|p' | {
if ! read sys maj min ; then
echo "ERROR: Unable to parse operating system version $(uname -s -r)" >&2
exit 1
fi

if ! ip netns list >/dev/null 2>&1 ; then
echo "ERROR: $(ip -V) does not support network namespaces." >&2
echo " Please install iproute2-ss111010 or later." >&2
exit 1
if [ "$sys" != 'Linux' ] ; then
echo "ERROR: Operating systems other than Linux are not supported (you have $(uname -s -r))" >&2
exit 1
fi

if ! [ \( "$maj" -eq 3 -a "$min" -ge 5 \) -o "$maj" -gt 3 ] ; then
echo "WARNING: Linux kernel version 3.5 or newer is required (you have ${maj}.${min})" >&2
fi
}

if ! command_exists ip ; then
echo "ERROR: ip utility is missing. Please install it." >&2
exit 1
fi

if ! ip netns list >/dev/null 2>&1 ; then
echo "ERROR: $(ip -V) does not support network namespaces." >&2
echo " Please install iproute2-ss111010 or later." >&2
exit 1
fi
fi

if ! DOCKER_VERSION=$(docker -v | sed -n -e 's|^Docker version \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p') || [ -z "$DOCKER_VERSION" ] ; then
Expand Down

0 comments on commit 35d32bd

Please sign in to comment.