diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2015-07-09 16:46:27 +0300 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2015-07-09 16:47:09 +0300 |
commit | 6c7392f1287be86529e351a9a0de362fa7e5811f (patch) | |
tree | 0fbf6a7239715147ff7336aeb0c0a9ddd5362538 | |
parent | 081e495715a06ad0074ea00c1e24b828a394c70d (diff) |
pkgupdate-watch.sh: handle not yet initialized SDKs
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
-rwxr-xr-x | pkgupdate-watch.sh | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/pkgupdate-watch.sh b/pkgupdate-watch.sh index 6cca0fe..170c46f 100755 --- a/pkgupdate-watch.sh +++ b/pkgupdate-watch.sh @@ -9,25 +9,30 @@ clear while true; do echo -en "\033[0;0f" fetch_remote_targets | while read target; do ( - cd "$CACHE_DIR/sdk/$target" - log="$(find logs/ -type f -name compile.txt -printf '%C@ %h\n' 2>/dev/null | \ - sort -nr | sed -ne '1s/^[0-9.]\+ //p')" + if [ -d "$CACHE_DIR/sdk/$target" ]; then + cd "$CACHE_DIR/sdk/$target" + log="$(find logs/ -type f -name compile.txt -printf '%C@ %h\n' 2>/dev/null | \ + sort -nr | sed -ne '1s/^[0-9.]\+ //p')" - if [ -d "$log" ]; then - d1=$(date +%s) - d2=$(date +%s -r "$log/compile.txt") + if [ -d "$log" ]; then + d1=$(date +%s) + d2=$(date +%s -r "$log/compile.txt") - if [ $(($d1 - $d2)) -gt 5 ]; then - log="- idle -" - msg="" - else - msg="$(tail -n1 "$log/compile.txt")" - if [ ${#msg} -gt 80 ]; then - msg="${msg:0:80}" + if [ $(($d1 - $d2)) -gt 5 ]; then + log="- idle -" + msg="" + else + msg="$(tail -n1 "$log/compile.txt")" + if [ ${#msg} -gt 80 ]; then + msg="${msg:0:80}" + fi fi + else + log="- pending -" + msg="" fi else - log="- pending -" + log="- uninitialized -" msg="" fi |