diff --git a/configure.ac b/configure.ac index 2b08bd8a..a70dfb30 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/script/Makefile.am b/script/Makefile.am index 4351f9c1..fe4e8876 100644 --- a/script/Makefile.am +++ b/script/Makefile.am @@ -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) < $< > $@ + #------------------------------------------------------------------------------ diff --git a/script/ethercat.service.in b/script/ethercat.service.in index 12b09a66..b59277e9 100644 --- a/script/ethercat.service.in +++ b/script/ethercat.service.in @@ -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 diff --git a/script/ethercatctl.in b/script/ethercatctl.in index fa7b15ef..efbb9bbe 100755 --- a/script/ethercatctl.in +++ b/script/ethercatctl.in @@ -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;