From: Mariusz Mazur Date: Mon, 22 Aug 2016 10:34:00 +0000 (+0000) Subject: Add run_pre_up/run_pre_down X-Git-Tag: 0.4.16~3 X-Git-Url: http://git.pld-linux.org/gitweb.cgi?a=commitdiff_plain;h=f54465050d2c6d0b27db993e3fc2aaccb7d75051;p=projects%2Frc-scripts.git Add run_pre_up/run_pre_down --- diff --git a/lib/ifdown b/lib/ifdown index 73df4906..75f6e5b7 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 c5344423..cac60cff 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 3986ef9d..967b51ed 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!"