Merge branch 'dehardcode-paths' into 'stable-1.5'

Do not hardcode paths in scripts

See merge request etherlab.org/ethercat!28
This commit is contained in:
Florian Pose
2021-07-22 13:27:06 +00:00
4 changed files with 27 additions and 8 deletions

View File

@@ -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) < $< > $@
#------------------------------------------------------------------------------

View File

@@ -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

View File

@@ -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;