File 0029-Execute-netconfig-ntp-runtime-update-in-background.patch of Package sysconfig.openSUSE_12.1_Update

From 447f34e724b23048907514ca919145892fe3409b Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski <mt@suse.com>
Date: Fri, 23 Nov 2012 10:32:51 +0100
References: bnc#780644
Subject: [PATCH 11/11] Execute netconfig/ntp-runtime update in background

---
 scripts/netconfig.d/ntp-runtime |   48 +++++++++++++++++++++++----------------
 1 Datei geändert, 29 Zeilen hinzugefügt(+), 19 Zeilen entfernt(-)

diff --git a/scripts/netconfig.d/ntp-runtime b/scripts/netconfig.d/ntp-runtime
index 88b1baa..7f06b42 100755
--- a/scripts/netconfig.d/ntp-runtime
+++ b/scripts/netconfig.d/ntp-runtime
@@ -232,26 +232,36 @@ fi
 
 # here we should restart services if needed
 
-#
-# do not restart  or it may (will) block ifup
-# just try to add the server at runtime ...
-#
-NTP_CONF="/etc/ntp.conf"
-NTPDC_BIN="/usr/sbin/ntpdc"
-
-if [ -n "${NTP_SERVER_LIST[*]}" -a -f "${NTP_CONF}" ] && /etc/init.d/ntp status >/dev/null 2>/dev/null ; then
-    NTP_KEYS=$(awk '/^keys/ { print $2 }' $NTP_CONF)
-    NTP_KEYID=$(awk '/^requestkey[[:blank:]]/ { print $2 }' $NTP_CONF)
-    NTP_PASSWD=$(test -n "$NTP_KEYS" -a -n "$NTP_KEYID" -a -r "$NTP_KEYS" && awk '$0 ~ key { print $3 }' key="^[[:blank:]]*$NTP_KEYID[[:blank:]]" $NTP_KEYS)
-
-    if [ -n "$NTP_KEYS" -a -n "$NTP_PASSWD" ] ; then
-        for server in ${NTP_SERVER_LIST[*]} ; do
-            NTPDC_CMD="keyid $NTP_KEYID\npasswd $NTP_PASSWD\naddserver $server\n"
-            NTPDC_LOG=$(echo -e "${NTPDC_CMD}quit" | $NTPDC_BIN)
-            debug "$PROGNAME add-server: $server"
-        done
+do_runtime_update()
+{
+    #
+    # do not restart  or it may (will) block ifup
+    # just try to add the server at runtime ...
+    #
+    NTP_CONF="/etc/ntp.conf"
+    NTPDC_BIN="/usr/sbin/ntpdc"
+
+    if [ -n "${NTP_SERVER_LIST[*]}" -a -f "${NTP_CONF}" ] && \
+         /etc/init.d/ntp status >/dev/null 2>/dev/null ; then
+        NTP_KEYS=$(awk -- '/^keys/ { print $2 }' $NTP_CONF 2>/dev/null)
+        NTP_KEYID=$(awk -- '/^requestkey[[:blank:]]/ { print $2 }' $NTP_CONF 2>/dev/null)
+        NTP_PASSWD=$(test -n "$NTP_KEYS" -a -n "$NTP_KEYID" -a -r "$NTP_KEYS" && \
+                    awk -- '$0 ~ key { print $3 }' key="^[[:blank:]]*$NTP_KEYID[[:blank:]]" \
+                    $NTP_KEYS 2>/dev/null)
+
+        if [ -n "$NTP_KEYS" -a -n "$NTP_PASSWD" ] ; then
+            for server in ${NTP_SERVER_LIST[*]} ; do
+                NTPDC_CMD="keyid $NTP_KEYID\npasswd $NTP_PASSWD\naddserver $server\n"
+                NTPDC_LOG=$(echo -e "${NTPDC_CMD}quit" | $NTPDC_BIN 2>&1 >/dev/null)
+                debug "$PROGNAME add-server $server: $NTPDC_LOG"
+            done
+        fi
     fi
-fi
+}
+
+# runtime update always in background
+( do_runtime_update & )
+disown -a
 
 exit 0;
 
-- 
1.7.10.4

openSUSE Build Service is sponsored by