Dear ethercat developers,

a trivial patch to use the full path for lsmod in init scripts
to avoid depending on user's PATH variable.

best regards,
--
Sebastien BLANCHET
diff -r af21f0bdc7c9 script/ethercatctl.in
--- a/script/ethercatctl.in	Thu Sep 06 14:21:02 2012 +0200
+++ b/script/ethercatctl.in	Fri Jul 04 15:09:21 2014 +0200
@@ -33,6 +33,7 @@
 #
 #------------------------------------------------------------------------------
 
+LSMOD=/sbin/lsmod
 MODPROBE=/sbin/modprobe
 RMMOD=/sbin/rmmod
 MODINFO=/sbin/modinfo
@@ -109,7 +110,7 @@
 
         if [ ${MODULE} != "generic" ]; then
             # try to unload standard module
-            if lsmod | grep "^${MODULE} " > /dev/null; then
+            if ${LSMOD} | grep "^${MODULE} " > /dev/null; then
                 if ! ${RMMOD} ${MODULE}; then
                     ${RMMOD} ${LOADED_MODULES}
                     exit 1
@@ -137,7 +138,7 @@
     # unload EtherCAT device modules
     for MODULE in ${DEVICE_MODULES} master; do
         ECMODULE=ec_${MODULE}
-        if ! lsmod | grep -q "^${ECMODULE} "; then
+        if ! ${LSMOD} | grep -q "^${ECMODULE} "; then
             continue # ec_* module not loaded
         fi
         if ! ${RMMOD} ${ECMODULE}; then
diff -r af21f0bdc7c9 script/init.d/ethercat.in
--- a/script/init.d/ethercat.in	Thu Sep 06 14:21:02 2012 +0200
+++ b/script/init.d/ethercat.in	Fri Jul 04 15:09:21 2014 +0200
@@ -24,7 +24,7 @@
 #  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #
 #  ---
-#  
+#
 #  The license mentioned above concerns the source code only. Using the EtherCAT
 #  technology and brand is only permitted in compliance with the industrial
 #  property and similar rights of Beckhoff Automation GmbH.
@@ -47,6 +47,7 @@
 
 #------------------------------------------------------------------------------
 
+LSMOD=/sbin/lsmod
 MODPROBE=/sbin/modprobe
 RMMOD=/sbin/rmmod
 MODINFO=/sbin/modinfo
@@ -126,7 +127,7 @@
     else
         echo Invalid MAC address \"${1}\" in ${ETHERCAT_CONFIG}
         exit_fail
-    fi 
+    fi
 }
 
 #------------------------------------------------------------------------------
@@ -157,7 +158,7 @@
 
         parse_mac_address ${DEVICE}
         DEVICES=${DEVICES}${MAC}
-        
+
         parse_mac_address ${BACKUP}
         BACKUPS=${BACKUPS}${MAC}
 
@@ -177,7 +178,7 @@
             continue # ec_* module not found
         fi
         if [ ${MODULE} != "generic" ]; then
-            if lsmod | grep "^${MODULE} " > /dev/null; then
+            if ${LSMOD} | grep "^${MODULE} " > /dev/null; then
                 if ! ${RMMOD} ${MODULE}; then
                     exit_fail
                 fi
@@ -200,7 +201,7 @@
     # unload EtherCAT device modules
     for MODULE in ${DEVICE_MODULES} master; do
         ECMODULE=ec_${MODULE}
-        if ! lsmod | grep -q "^${ECMODULE} "; then
+        if ! ${LSMOD} | grep -q "^${ECMODULE} "; then
             continue # ec_* module not loaded
         fi
         if ! ${RMMOD} ${ECMODULE}; then
@@ -243,7 +244,7 @@
 
     for i in `seq 0 $(expr ${MASTER_COUNT} - 1)`; do
         echo -n "Master${i} "
-        
+
         # Check if the master is in idle or operation phase
         ${ETHERCAT} master --master ${i} 2>/dev/null | \
             grep -qE 'Phase:[[:space:]]*Idle|Phase:[[:space:]]*Operation'
_______________________________________________
etherlab-dev mailing list
etherlab-dev@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-dev

Reply via email to