update to find programs from path instead of being hardcoded when build

This commit is contained in:
Blake J. Harnden 2018-03-21 23:07:34 -07:00
parent 4987019cf8
commit 987e6f4f50
3 changed files with 26 additions and 17 deletions

View file

@ -15,11 +15,11 @@ AM_INIT_AUTOMAKE([tar-ustar])
PACKAGE_DATE=m4_esyscmd_s([date +%Y%m%d]) PACKAGE_DATE=m4_esyscmd_s([date +%Y%m%d])
PACKAGE_VENDOR="CORE Developers" PACKAGE_VENDOR="CORE Developers"
PACKAGE_MAINTAINERS="$PACKAGE_VENDOR <$PACKAGE_BUGREPORT>" PACKAGE_MAINTAINERS="$PACKAGE_VENDOR <$PACKAGE_BUGREPORT>"
# core specific variables
CORE_LIB_DIR="\${prefix}/lib/core" CORE_LIB_DIR="\${prefix}/lib/core"
# TODO: hard setting path, until support by setup.py
CORE_CONF_DIR="/etc/core" CORE_CONF_DIR="/etc/core"
CORE_DATA_DIR="\${datarootdir}/core" CORE_DATA_DIR="\${datadir}/core"
# TODO: verify there is need to hard set /var
CORE_STATE_DIR="/var" CORE_STATE_DIR="/var"
AC_SUBST(PACKAGE_DATE) AC_SUBST(PACKAGE_DATE)

View file

@ -46,7 +46,7 @@ install-exec-hook:
uninstall-hook: uninstall-hook:
rm -rf $(DESTDIR)/etc/core rm -rf $(DESTDIR)/etc/core
rm -rf $(DESTDIR)/$(datadir)/core rm -rf $(DESTDIR)/$(datadir)/core
rm -f $(addprefix $(DESTDIR)/$(datadir)/man/man1/, $(MAN_FILES)) rm -f $(addprefix $(DESTDIR)/$(datarootdir)/man/man1/, $(MAN_FILES))
rm -f $(addprefix $(DESTDIR)/$(bindir)/,$(SCRIPT_FILES)) rm -f $(addprefix $(DESTDIR)/$(bindir)/,$(SCRIPT_FILES))
rm -rf $(DESTDIR)/$(pythondir)/core-$(PACKAGE_VERSION)-py$(PYTHON_VERSION).egg-info rm -rf $(DESTDIR)/$(pythondir)/core-$(PACKAGE_VERSION)-py$(PYTHON_VERSION).egg-info
rm -rf $(DESTDIR)/$(pythondir)/core rm -rf $(DESTDIR)/$(pythondir)/core

View file

@ -1,18 +1,27 @@
import os
COREDPY_VERSION = "@PACKAGE_VERSION@" COREDPY_VERSION = "@PACKAGE_VERSION@"
CORE_STATE_DIR = "@CORE_STATE_DIR@" CORE_STATE_DIR = "@CORE_STATE_DIR@"
CORE_CONF_DIR = "@CORE_CONF_DIR@" CORE_CONF_DIR = "@CORE_CONF_DIR@"
CORE_DATA_DIR = "@CORE_DATA_DIR@" CORE_DATA_DIR = "@CORE_DATA_DIR@"
CORE_LIB_DIR = "@CORE_LIB_DIR@"
VNODED_BIN = "@bindir@/vnoded"
VCMD_BIN = "@bindir@/vcmd"
BRCTL_BIN = "@brctl_path@/brctl"
SYSCTL_BIN = "@sysctl_path@/sysctl"
IP_BIN = "@ip_path@/ip"
TC_BIN = "@tc_path@/tc"
EBTABLES_BIN = "@ebtables_path@/ebtables"
QUAGGA_STATE_DIR = "@CORE_STATE_DIR@/run/quagga" QUAGGA_STATE_DIR = "@CORE_STATE_DIR@/run/quagga"
MOUNT_BIN = "@mount_path@/mount"
UMOUNT_BIN = "@umount_path@/umount"
OVS_BIN = "@ovs_vs_path@/ovs-vsctl" def which(command):
OVS_FLOW_BIN = "@ovs_of_path@/ovs-ofctl" for path in os.environ["PATH"].split(os.pathsep):
command_path = os.path.join(path, command)
if os.path.isfile(command_path) and os.access(command_path, os.X_OK):
return command_path
VNODED_BIN = which("vnoded")
VCMD_BIN = which("vcmd")
BRCTL_BIN = which("brctl")
SYSCTL_BIN = which("sysctl")
IP_BIN = which("ip")
TC_BIN = which("tc")
EBTABLES_BIN = which("ebtables")
MOUNT_BIN = which("mount")
UMOUNT_BIN = which("umount")
OVS_BIN = which("ovs-vsctl")
OVS_FLOW_BIN = which("ovs-ofctl")