Skip to contentSkip to conversation

udev-cache: Remove unnecessary tar read from stdin

PATCH New Ken Sharp 1 participant 2 messages Apr 21, 2015

lore
Share & tools
lore

Ken Sharp

author
#0 lore raw

PATCH 1/2 udev-cache: Remove unnecessary tar read from stdin

xargs already formats the inputs to tar correctly, so the '-T -' argument to tar is unnecessary.

---
 meta/recipes-core/udev/udev/udev-cache | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/udev/udev/udev-cache +1 -1
index df97000..12f68fb 100644
@@ -57,7 +57,7 @@ echo "Populating dev cache"
 	udevadm control --stop-exec-queue
 	sysconf_cmd > "$SYSCONF_TMP"
 	find /dev -xdev \( -type b -o -type c -o -type l \) | cut -c 2- \
-		| xargs tar cf "${DEVCACHE_TMP}" -T-
+		| xargs tar cf "${DEVCACHE_TMP}"
 	gzip < "${DEVCACHE_TMP}" > "$DEVCACHE"
 	rm -f "${DEVCACHE_TMP}"
 	mv "$SYSCONF_TMP" "$SYSCONF_CACHED"
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 2/2 udev-cache: improve error handling

If an error occurs while the udev cache is being populated, the system is left in a state where udev is stopped. Remedy this with a clean up function to restart udev and remove any intermediate files.

---
 meta/recipes-core/udev/udev/udev-cache | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
meta/recipes-core/udev/udev/udev-cache +7 -1
index 12f68fb..dcfff1c 100644
@@ -51,9 +51,15 @@ fi
 [ "${VERBOSE}" == "no" ] || echo "found."
 echo "Populating dev cache"
 
+err_cleanup () {
+        echo "udev-cache: update failed!"
+        udevadm control --start-exec-queue
+	rm -f -- "$SYSCONF_TMP" "$DEVCACHE_TMP" "$DEVCACHE" "$SYSCONF_CACHED"
+}
+
 (
 	set -e
-	trap 'echo "udev-cache: update failed!"' EXIT
+	trap 'err_cleanup' EXIT
 	udevadm control --stop-exec-queue
 	sysconf_cmd > "$SYSCONF_TMP"
 	find /dev -xdev \( -type b -o -type c -o -type l \) | cut -c 2- \
Signature · 1 line
1.9.1