Fix #206: allow to customize utilities from configure
`ethercatctl` calls some utilites actually hardcoded in the script. Provide a way to customize them from configure. The default values are choosen to be backward compatible with the old behavior, but more sensible values would be preferred, e.g.: OPTION ACTUAL DEFAULT PREFERRED DEFAULT kmod-dir /sbin $sbindir ip-cmd /bin/ip $sbindir/ip In a major future release this can be changed.
This commit is contained in:
parent
90f9feb0ad
commit
b86d2163f1
26
configure.ac
26
configure.ac
|
|
@ -1397,6 +1397,32 @@ esac
|
||||||
AM_CONDITIONAL(HAVE_SYSTEMD, test "x$with_systemdsystemunitdir" != "x")
|
AM_CONDITIONAL(HAVE_SYSTEMD, test "x$with_systemdsystemunitdir" != "x")
|
||||||
AC_SUBST(systemdsystemunitdir, [$with_systemdsystemunitdir])
|
AC_SUBST(systemdsystemunitdir, [$with_systemdsystemunitdir])
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# System utilities
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
AC_ARG_WITH([kmod-dir],
|
||||||
|
AS_HELP_STRING([--with-kmod-dir=<DIR>],
|
||||||
|
[Path to kernel module utilities [default=/sbin]]),
|
||||||
|
[kmoddir=[$withval]],
|
||||||
|
[kmoddir="/sbin"]
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_MSG_CHECKING([for path to kernel modules])
|
||||||
|
AC_MSG_RESULT([$kmoddir])
|
||||||
|
AC_SUBST(kmoddir, [$kmoddir])
|
||||||
|
|
||||||
|
AC_ARG_WITH([ip-cmd],
|
||||||
|
AS_HELP_STRING([--with-ip-cmd=<CMD>],
|
||||||
|
['ip' command to use [default=/bin/ip]]),
|
||||||
|
[ipcmd=[$withval]],
|
||||||
|
[ipcmd="/bin/ip"]
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_MSG_CHECKING([for ip command])
|
||||||
|
AC_MSG_RESULT([$ipcmd])
|
||||||
|
AC_SUBST(ipcmd, [$ipcmd])
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
|
|
||||||
AC_CONFIG_FILES([
|
AC_CONFIG_FILES([
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,8 @@ endif
|
||||||
# Any precious variable used inside script_templates should appear here
|
# Any precious variable used inside script_templates should appear here
|
||||||
expand_script = $(SED) \
|
expand_script = $(SED) \
|
||||||
-e 's,[@]VERSION[@],$(VERSION),g' \
|
-e 's,[@]VERSION[@],$(VERSION),g' \
|
||||||
|
-e 's,[@]ipcmd[@],$(ipcmd),g' \
|
||||||
|
-e 's,[@]kmoddir[@],$(kmoddir),g' \
|
||||||
-e 's,[@]bindir[@],$(bindir),g' \
|
-e 's,[@]bindir[@],$(bindir),g' \
|
||||||
-e 's,[@]sbindir[@],$(sbindir),g' \
|
-e 's,[@]sbindir[@],$(sbindir),g' \
|
||||||
-e 's,[@]sysconfdir[@],$(sysconfdir),g'
|
-e 's,[@]sysconfdir[@],$(sysconfdir),g'
|
||||||
|
|
|
||||||
|
|
@ -25,13 +25,13 @@
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
LSMOD=/sbin/lsmod
|
LSMOD="@kmoddir@/lsmod"
|
||||||
MODPROBE=/sbin/modprobe
|
MODPROBE="@kmoddir@/modprobe"
|
||||||
RMMOD=/sbin/rmmod
|
RMMOD="@kmoddir@/rmmod"
|
||||||
MODINFO=/sbin/modinfo
|
MODINFO="@kmoddir@/modinfo"
|
||||||
IP=/bin/ip
|
IP="@ipcmd@"
|
||||||
|
|
||||||
ETHERCAT=@bindir@/ethercat
|
ETHERCAT="@bindir@/ethercat"
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -39,7 +39,7 @@ if [ "$1" = "-c" ]; then
|
||||||
ETHERCAT_CONFIG="$2"
|
ETHERCAT_CONFIG="$2"
|
||||||
COMMAND="$3"
|
COMMAND="$3"
|
||||||
else
|
else
|
||||||
ETHERCAT_CONFIG=@sysconfdir@/ethercat.conf
|
ETHERCAT_CONFIG="@sysconfdir@/ethercat.conf"
|
||||||
COMMAND="$1"
|
COMMAND="$1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue