[projects/rc-scripts] Add run_pre_up/run_pre_down

mmazur mmazur at pld-linux.org
Mon Aug 22 12:34:21 CEST 2016


commit f54465050d2c6d0b27db993e3fc2aaccb7d75051
Author: Mariusz Mazur <mmazur at axeos.com>
Date:   Mon Aug 22 10:34:00 2016 +0000

    Add run_pre_up/run_pre_down

 lib/ifdown                             |  5 +++++
 lib/ifup                               |  5 +++++
 sysconfig/interfaces/ifcfg-description | 14 ++++++++++++--
 3 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/lib/ifdown b/lib/ifdown
index 73df490..75f6e5b 100755
--- a/lib/ifdown
+++ b/lib/ifdown
@@ -3,6 +3,8 @@
 #
 PATH=/sbin:/usr/sbin:/bin:/usr/bin
 
+run_pre_down() { :; }
+
 . /etc/sysconfig/network
 . /etc/rc.d/init.d/functions
 . /lib/rc-scripts/functions.network
@@ -43,6 +45,9 @@ source_config
 # set all major variables
 setup_ip_param
 
+# anything you need done first
+run_pre_down
+
 OTHERSCRIPT="/lib/rc-scripts/ifdown-${DEVICETYPE}"
 
 # shutdown tleds software
diff --git a/lib/ifup b/lib/ifup
index c534442..cac60cf 100755
--- a/lib/ifup
+++ b/lib/ifup
@@ -3,6 +3,8 @@
 #
 PATH=/sbin:/usr/sbin:/bin:/usr/bin
 
+run_pre_up() { :; }
+
 . /etc/sysconfig/network
 . /etc/rc.d/init.d/functions
 . /lib/rc-scripts/functions.network
@@ -65,6 +67,9 @@ setup_ip_param
 
 SYSCTLDEVICE=$(echo ${DEVICE} | sed 's/\./\//g')
 
+# anything you need done first
+run_pre_up
+
 OTHERSCRIPT="/lib/rc-scripts/ifup-${DEVICETYPE}"
 
 if [ -x "$OTHERSCRIPT" ]; then
diff --git a/sysconfig/interfaces/ifcfg-description b/sysconfig/interfaces/ifcfg-description
index 3986ef9..967b51e 100644
--- a/sysconfig/interfaces/ifcfg-description
+++ b/sysconfig/interfaces/ifcfg-description
@@ -227,13 +227,23 @@ elif    DEVICE=irda* ; then     /* IrDA */
         DISCOVERY=yes|no (starts discovery of remote IrDA devices)
 fi
 
-# You can also run some other programs *after* device has been brought up or down.
-# Just create functions run_up() and run_down().
+# You can also run commands before/after a device has been brought up or down.
+# Just create functions run_up/run_pre_up/run_down/run_pre_down.
+run_pre_up()
+{
+	echo "This will be executed before device is brought up!"
+}
+
 run_up()
 {
 	echo "This will be executed after device is brought up!"
 }
 
+run_pre_down()
+{
+	echo "This will be executed before device is brought down!"
+}
+
 run_down()
 {
 	echo "This will be executed after device is brought down!"
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/rc-scripts.git/commitdiff/f54465050d2c6d0b27db993e3fc2aaccb7d75051



More information about the pld-cvs-commit mailing list