mirror of
https://gitlab.com/etherlab.org/ethercat.git
synced 2026-02-05 19:39:50 +08:00
Do not hardcode paths in scripts
Try to reuse the configured paths as much as possible. Unfortunately, to be able to fully expand some variable (e.g. `bindir`), these files must be expanded by make, not by configure. This adds some complexity: https://www.gnu.org/software/automake/manual/html_node/Scripts.html
This commit is contained in:
@@ -1149,8 +1149,6 @@ AC_CONFIG_FILES([
|
||||
master/Kbuild
|
||||
master/Makefile
|
||||
script/Makefile
|
||||
script/ethercat.service
|
||||
script/ethercatctl
|
||||
script/init.d/Makefile
|
||||
script/init.d/ethercat
|
||||
script/sysconfig/Makefile
|
||||
|
||||
@@ -37,13 +37,34 @@ sbin_SCRIPTS = ethercatctl
|
||||
|
||||
dist_sysconf_DATA = ethercat.conf
|
||||
|
||||
EXTRA_DIST = \
|
||||
script_templates = \
|
||||
ethercatctl.in \
|
||||
ethercat.service.in \
|
||||
ethercat.service.in
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(script_templates) \
|
||||
ifup-eoe.sh
|
||||
|
||||
CLEANFILES = \
|
||||
ethercatctl \
|
||||
ethercat.service
|
||||
|
||||
if HAVE_SYSTEMD
|
||||
systemdsystemunit_DATA = ethercat.service
|
||||
endif
|
||||
|
||||
|
||||
# Any precious variable used inside script_templates should appear here
|
||||
expand_script = $(SED) \
|
||||
-e 's,[@]VERSION[@],$(VERSION),g' \
|
||||
-e 's,[@]bindir[@],$(bindir),g' \
|
||||
-e 's,[@]sbindir[@],$(sbindir),g' \
|
||||
-e 's,[@]sysconfdir[@],$(sysconfdir),g'
|
||||
|
||||
ethercatctl: $(srcdir)/ethercatctl.in Makefile
|
||||
$(expand_script) < $< > $@
|
||||
|
||||
ethercat.service: $(srcdir)/ethercat.service.in Makefile
|
||||
$(expand_script) < $< > $@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@@ -22,8 +22,8 @@ Description=EtherCAT Master Kernel Modules
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
ExecStart=@prefix@/sbin/ethercatctl start
|
||||
ExecStop=@prefix@/sbin/ethercatctl stop
|
||||
ExecStart=@sbindir@/ethercatctl start
|
||||
ExecStop=@sbindir@/ethercatctl stop
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
@@ -38,11 +38,11 @@ MODPROBE=/sbin/modprobe
|
||||
RMMOD=/sbin/rmmod
|
||||
MODINFO=/sbin/modinfo
|
||||
|
||||
ETHERCAT=@prefix@/bin/ethercat
|
||||
ETHERCAT=@bindir@/ethercat
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
ETHERCAT_CONFIG=/etc/ethercat.conf
|
||||
ETHERCAT_CONFIG=@sysconfdir@/ethercat.conf
|
||||
|
||||
if [ ! -r ${ETHERCAT_CONFIG} ]; then
|
||||
echo ${ETHERCAT_CONFIG} not existing;
|
||||
|
||||
Reference in New Issue
Block a user