From b323dd6ac330360afa3b76febcd681ea043bfd61 Mon Sep 17 00:00:00 2001
From: Stefan Laudemann <thisco@webcake.de>
Date: Thu, 12 Feb 2015 04:01:17 +0100
Subject: [PATCH] Adds final exit status and treatment of return values from
 non-ffpb packages.

The file zz~-ffpb-upgrade will only be delete if its return value is 0.
For some reason we forgot to add an 'exit 0' at the end of the file if
everything is OK. This has been added.

To deal with invariant scripts that were not executed properly, we now
test the return value of do_component for these scripts as well. The
function do_component however may return early with a return code not
equal to 0, if a version for that package/script could not have been
determined. We now return the code 255 in this case and ignore that
state in "main", as we are not interested in non-ffpb packages.
---
 .../ffpb-node-tuning/files/etc/uci-defaults/zz~-ffpb-upgrade | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ffpb/ffpb-node-tuning/files/etc/uci-defaults/zz~-ffpb-upgrade b/ffpb/ffpb-node-tuning/files/etc/uci-defaults/zz~-ffpb-upgrade
index be13b97..f104a7d 100755
--- a/ffpb/ffpb-node-tuning/files/etc/uci-defaults/zz~-ffpb-upgrade
+++ b/ffpb/ffpb-node-tuning/files/etc/uci-defaults/zz~-ffpb-upgrade
@@ -22,7 +22,7 @@ do_dir() {
 do_component() {
 	local component="$1"
 	local version="$(version_of "$component")"
-	[ "$version" ] || return
+	[ "$version" ] || return 255
 
 	(
 		cd "$component"
@@ -44,4 +44,7 @@ cd "$UPGRADE_DIR"
 for component in *; do
 	[ "$component" != 'core' ] || continue
 	do_component "$component"
+	[ "$?" -ne "0" -o "$?" -ne "255" ] || exit 1
 done
+
+exit 0
-- 
GitLab