diff --git a/opkg-upgrade.sh b/opkg-upgrade.sh index fd4c08f..a6465bb 100755 --- a/opkg-upgrade.sh +++ b/opkg-upgrade.sh @@ -16,7 +16,7 @@ ### Initialization -OPKGUPVERSION="0.3.0" +OPKGUPVERSION="0.3.1" OPKGBIN="$(which opkg 2>/dev/null)" SSMTPBIN="$(which ssmtp 2>/dev/null)" BANNERSTRING="Simple OPKG Updater v$OPKGUPVERSION" @@ -136,7 +136,7 @@ list_upgrades() { prettyPrintPacks() { echo -ne "$PACKS" | awk ' function rep(c, n){ s=sprintf("%" n "s",""); gsub(/ /,c,s); return s } -BEGIN{ j=1; } NR>1{ +BEGIN{ j=1; } NR>0{ l[j, 1]=($1); l[j, 2]=($3); l[j++, 3]=($5); @@ -149,7 +149,7 @@ max[3]=(max[3]>=7?max[3]:7); } function div(){ printf "+-----+%s+%s+%s+\n", rep("-", max[1]+2), rep("-", max[2]+2), rep("-", max[3]+2) } function head() { printf "| %3s | %-" max[1] "s | %-" max[2] "s | %-" max[3] "s |\n", "#", "Package", "Current", "Update" } -END {div() ; head() ; div() ; for (i=1; i1{for (i=1; i<=NF; i=i+2) max[i]=(length($i)>max[i]?length($i):max[i])} END {for (i=1; i<=NF; i=i+2) printf "%d ", max[i]}')" #echo -ne "$PACKS" | awk '{ printf "pack: %s from: %s to: %s \n", $1, $3, $5 }' PACKS_COUNT="$(echo "$PACKS" | wc -l)" fi