From afe8f6ad6f74fa85f782dfa3296267e2a5def8e4 Mon Sep 17 00:00:00 2001 From: JGill Date: Thu, 12 Sep 2019 13:19:43 +0930 Subject: [PATCH] Locally modify PATH variable. #231 #236 --- openpyn/__init__.py | 27 ++++++++-------------- openpyn/scripts/update-systemd-resolved.sh | 1 - 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/openpyn/__init__.py b/openpyn/__init__.py index f982b9f..25ae9ed 100644 --- a/openpyn/__init__.py +++ b/openpyn/__init__.py @@ -20,21 +20,12 @@ __data_files__ = [("/opt/etc/init.d", ["./openpyn/S23openpyn"])] -# import gc -# print("\n".join(sorted({attrname for item in gc.get_objects() for attrname in dir(item) if attrname.startswith("__")}))) -# -# print(__basefilepath__) -# print(__build_class__) -# print(__builtins__) -# print(__data_files__) -# print(__debug__) -# print(__doc__) -# print(__file__) -# print(__import__) -# print(__license__) -# print(__loader__) -# print(__name__) -# print(__package__) -# print(__path__) -# print(__spec__) -# print(__version__) +# locally modify the PATH variable, to get around issues on some distros +def add_to_path(bin_path): + # add pathseperator i.e ":" + bin_path_str = os.pathsep + bin_path + if bin_path_str not in os.environ["PATH"]: + os.environ["PATH"] += bin_path_str + +add_to_path("/usr/sbin") +add_to_path("/sbin") diff --git a/openpyn/scripts/update-systemd-resolved.sh b/openpyn/scripts/update-systemd-resolved.sh index 3017c4c..1109281 100755 --- a/openpyn/scripts/update-systemd-resolved.sh +++ b/openpyn/scripts/update-systemd-resolved.sh @@ -28,7 +28,6 @@ # Define what needs to be called via DBus DBUS_DEST="org.freedesktop.resolve1" DBUS_NODE="/org/freedesktop/resolve1" -PATH="$PATH:/usr/sbin" SCRIPT_NAME="${BASH_SOURCE[0]##*/}"