diff --git a/gns3server/compute/docker/resources/bin/busybox b/gns3server/compute/docker/resources/bin/busybox deleted file mode 100755 index 68ebef5e..00000000 Binary files a/gns3server/compute/docker/resources/bin/busybox and /dev/null differ diff --git a/setup.py b/setup.py index 98210bd3..41dc9cdf 100644 --- a/setup.py +++ b/setup.py @@ -16,6 +16,10 @@ # along with this program. If not, see . import sys +import os +import shutil +import subprocess + from setuptools import setup, find_packages from setuptools.command.test import test as TestCommand @@ -39,6 +43,28 @@ class PyTest(TestCommand): sys.exit(errcode) +BUSYBOX_PATH = "gns3server/compute/docker/resources/bin/busybox" + + +def copy_busybox(): + if not sys.platform.startswith("linux"): + return + if os.path.isfile(BUSYBOX_PATH): + return + for bb_cmd in ("busybox-static", "busybox.static", "busybox"): + bb_path = shutil.which(bb_cmd) + if bb_path: + if subprocess.call(["ldd", bb_path], + stdin=subprocess.DEVNULL, + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL): + shutil.copy2(bb_path, BUSYBOX_PATH, follow_symlinks=True) + break + else: + raise SystemExit("No static busybox found") + + +copy_busybox() dependencies = open("requirements.txt", "r").read().splitlines() setup(