mirror of
https://gitlab.com/etherlab.org/ethercat.git
synced 2026-03-24 05:32:38 +08:00
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:
26
configure.ac
26
configure.ac
@@ -1397,6 +1397,32 @@ esac
|
||||
AM_CONDITIONAL(HAVE_SYSTEMD, test "x$with_systemdsystemunitdir" != "x")
|
||||
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([
|
||||
|
||||
@@ -68,6 +68,8 @@ endif
|
||||
# Any precious variable used inside script_templates should appear here
|
||||
expand_script = $(SED) \
|
||||
-e 's,[@]VERSION[@],$(VERSION),g' \
|
||||
-e 's,[@]ipcmd[@],$(ipcmd),g' \
|
||||
-e 's,[@]kmoddir[@],$(kmoddir),g' \
|
||||
-e 's,[@]bindir[@],$(bindir),g' \
|
||||
-e 's,[@]sbindir[@],$(sbindir),g' \
|
||||
-e 's,[@]sysconfdir[@],$(sysconfdir),g'
|
||||
|
||||
@@ -25,13 +25,13 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
LSMOD=/sbin/lsmod
|
||||
MODPROBE=/sbin/modprobe
|
||||
RMMOD=/sbin/rmmod
|
||||
MODINFO=/sbin/modinfo
|
||||
IP=/bin/ip
|
||||
LSMOD="@kmoddir@/lsmod"
|
||||
MODPROBE="@kmoddir@/modprobe"
|
||||
RMMOD="@kmoddir@/rmmod"
|
||||
MODINFO="@kmoddir@/modinfo"
|
||||
IP="@ipcmd@"
|
||||
|
||||
ETHERCAT=@bindir@/ethercat
|
||||
ETHERCAT="@bindir@/ethercat"
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@@ -39,7 +39,7 @@ if [ "$1" = "-c" ]; then
|
||||
ETHERCAT_CONFIG="$2"
|
||||
COMMAND="$3"
|
||||
else
|
||||
ETHERCAT_CONFIG=@sysconfdir@/ethercat.conf
|
||||
ETHERCAT_CONFIG="@sysconfdir@/ethercat.conf"
|
||||
COMMAND="$1"
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user