initscripts-9.08 released
by Bill Nottingham
This updates the NetworkManager integration to work on system configurations
that don't specify a device, and fixes a typo that the normal syntax check
on dist didn't catch.
Full log attached.
Bill
14 years, 1 month
initscripts-9.07-1
by Bill Nottingham
This release includes the first cut of NetworkManager integration,
plus updated translations.
Full log attached.
Bill
14 years, 2 months
[PATCH] network-functions: add snapshot/rollback functions
by Dan Kenigsberg
When logging into a remote machine to play with its network
configurations there the fear of locking yourself out always lurks.
If this happens, you can walk to the remote machine and fix it, but it
would be easier to reboot the machine, and have it rolled back to a
known-good network configuration when it starts up.
With this patch, you can use snapshot_config() to copy the current
network configuration before changing it. The network service will use
rollback_config() when the machine is rebooted. Use commit_config() when
the current configuration is known to be good.
Comments are welcome. Specifically, what should we copy but ifcfg-* and
rule-* ?
---
rc.d/init.d/network | 6 ++++
sysconfig/network-scripts/network-functions | 41 +++++++++++++++++++++++++++
2 files changed, 47 insertions(+), 0 deletions(-)
diff --git a/rc.d/init.d/network b/rc.d/init.d/network
index 71e67ee..b789c31 100755
--- a/rc.d/init.d/network
+++ b/rc.d/init.d/network
@@ -44,6 +44,12 @@ cd /etc/sysconfig/network-scripts
. ./network-functions
+# when network starts afresh, roll back to last snapshot of network
+# configurations.
+if [ "$1" == start ]; then
+ rollback_config
+fi
+
# find all the interfaces besides loopback.
# ignore aliases, alternative configurations, and editor backup files
interfaces=$(ls ifcfg* | \
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions
index 89baeb4..6a1553e 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -361,3 +361,44 @@ change_resolv_conf ()
fi;
return $r;
}
+
+# take a snapshot of current network configuration scripts
+snapshot_config ()
+{
+ local snapshotdir
+ snapshotdir=/var/lib/initscripts/network-config
+ rm -fr "$snapshotdir"
+ mkdir -p "$snapshotdir"
+ for f in /etc/sysconfig/network-scripts/{ifcfg,rule}-*
+ do
+ [ -f "$f" ] && cp -p "$f" "$snapshotdir"
+ done
+}
+
+commit_config ()
+{
+ local snapshotdir
+ snapshotdir=/var/lib/initscripts/network-config
+ rm -fr "$snapshotdir"
+}
+
+# rollback network configuration to last snapshot (if one exists)
+rollback_config ()
+{
+ local snapshotdir rollbackdir
+ snapshotdir=/var/lib/initscripts/network-config
+ # return immediately if there is no snapshot
+ [ ! -d "$snapshotdir" ] && return 0
+
+ rollbackdir=/var/log/initscripts/rollback-`date +%Y.%m.%d-%H:%M:%S`
+ mkdir -p "$rollbackdir"
+ for f in /etc/sysconfig/network-scripts/{ifcfg,rule}-*
+ do
+ [ -f "$f" ] && mv "$f" "$rollbackdir"
+ done
+ for f in "$snapshotdir"/{ifcfg,rule}-*
+ do
+ [ -f "$f" ] && mv "$f" /etc/sysconfig/network-scripts
+ done
+}
+
--
1.6.6.1
14 years, 2 months