diff --git a/util/install.sh b/util/install.sh index 749accc..1ddaaf9 100755 --- a/util/install.sh +++ b/util/install.sh @@ -102,6 +102,14 @@ function version_ge { [ "$1" == "$latest" ] } +# Attempt to identify Python version +PYTHON=${PYTHON:-python} +if $PYTHON --version |& grep 'Python 2' > /dev/null; then + PYTHON_VERSION=2; PYPKG=python +else + PYTHON_VERSION=3; PYPKG=python3 +fi +echo "${PYTHON} is version ${PYTHON_VERSION}" # Kernel Deb pkg to be removed: KERNEL_IMAGE_OLD=linux-image-2.6.26-33-generic @@ -145,19 +153,19 @@ function mn_deps { $install gcc make socat psmisc xterm openssh-clients iperf \ iproute telnet python-setuptools libcgroup-tools \ ethtool help2man pyflakes pylint python-pep8 python-pexpect - elif [ "$DIST" = "SUSE LINUX" ]; then + elif [ "$DIST" = "SUSE LINUX" ]; then $install gcc make socat psmisc xterm openssh iperf \ - iproute telnet python-setuptools libcgroup-tools \ - ethtool help2man python-pyflakes python3-pylint python-pep8 python-pexpect - else + iproute telnet ${PYPKG}-setuptools libcgroup-tools \ + ethtool help2man python-pyflakes python3-pylint python-pep8 ${PYPKG}-pexpect + else # Debian/Ubuntu $install gcc make socat psmisc xterm ssh iperf iproute2 telnet \ - python-setuptools cgroup-bin ethtool help2man \ - pyflakes pylint pep8 python-pexpect + cgroup-bin ethtool help2man pyflakes pylint pep8 \ + ${PYPKG}-setuptools ${PYPKG}-pexpect fi echo "Installing Mininet core" pushd $MININET_DIR/mininet - sudo make install + sudo PYTHON=${PYTHON} make install popd }