From e9656a146a7f374b2b485895638fe3041318f668 Mon Sep 17 00:00:00 2001 From: tavinus Date: Mon, 26 Jun 2017 00:01:25 -0300 Subject: [PATCH] v0.2.1 - fix to packs count when no updates are available --- opkg-upgrade.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/opkg-upgrade.sh b/opkg-upgrade.sh index 6e00c38..89a0139 100755 --- a/opkg-upgrade.sh +++ b/opkg-upgrade.sh @@ -16,7 +16,7 @@ ### Initialization -OPKGUPVERSION="0.2.0" +OPKGUPVERSION="0.2.1" OPKGBIN="$(which opkg 2>/dev/null)" SSMTPBIN="$(which ssmtp 2>/dev/null)" BANNERSTRING="Simple OPKG Updater v$OPKGUPVERSION" @@ -46,7 +46,7 @@ OPKGUP_LOCATION="$(readlink -f $0)" ### Execution vars, populated later PACKS="" PACKS_NAMES="" -PACKS_COUNT="" +PACKS_COUNT=0 @@ -293,11 +293,14 @@ opkg_upgradable() { PACKS="$($OPKGBIN list-upgradable)" [ $? -eq 0 ] || rt_exception $'Error when trying list upgradable packages. Permissions?\n' #PACKS="$(cat pkg-example.txt)" # testing - PACKS_NAMES="$(echo -ne "$PACKS" | awk '{ printf "%s ", $1 }')" - #echo -ne "$PACKS" | awk '{ printf "pack: %s from: %s to: %s \n", $1, $3, $5 }' - PACKS_COUNT="$(echo "$PACKS" | wc -l)" + if ! is_empty "$PACKS"; then + PACKS_NAMES="$(echo -ne "$PACKS" | awk '{ printf "%s ", $1 }')" + #echo -ne "$PACKS" | awk '{ printf "pack: %s from: %s to: %s \n", $1, $3, $5 }' + PACKS_COUNT="$(echo "$PACKS" | wc -l)" + fi message_ends is_quiet || echo "" + return $TRUE }