From d170454b99044716b684f395c922765d9761e91e Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Sat, 24 Dec 2016 15:42:01 +0100 Subject: sinkdo : no stdout pollution (ncurses). uftp : no tmp dir. --- make-boot-image.sh | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/make-boot-image.sh b/make-boot-image.sh index c1a31c7..8e32311 100755 --- a/make-boot-image.sh +++ b/make-boot-image.sh @@ -365,9 +365,9 @@ network_show() { } start_uftpd() { - # -I workaround bug "address already in use" - uftpd -q -B 2097152 -x2 -F /run/uftpd.csv -L /run/uftpd.log -T /tmp -D /run/uftpd -M ff02::42 -I 2/6 - [ $? -eq 0 ] && netstat -nlu | grep -q ':1044 ' && echo -e '\033[42m' ----- UFTPD ready ----- '\033[40m' + # FIXME : -I is there as a bug workaround "address already in use" + uftpd -q -B 2097152 -x2 -F /run/uftpd.csv -L /run/uftpd.log -t -D /run/uftpd -M ff02::42 -I 2/6 + [ $? -eq 0 ] && netstat -nlu | grep -q ':1044 ' && echo -e '\033[42m' ----- UFTPD ready ----- '\033[0m' } EOF @@ -440,15 +440,15 @@ fi while true do - f=$(ls | head -n1) + f=$(ls | grep -v '~' | head -n1) if [ -n "$f" ] then if [ -f "$f" -a -r "$f" ] then size=$(stat -c'%s' -- "$f") # Do the actual work on the following line - cat -- "$f" && rm -v -- "$f" >&2 + cat -- "$f" && rm -- "$f" >&2 # Normal exit condition if [ $size -eq 0 ] - then cd / && rmdir -v -- "$SINKDIR" >&2 + then cd / && rmdir -- "$SINKDIR" >&2 exit 0 fi else echo "'$SINKDIR/$f' is not a readable file" >&2 @@ -477,7 +477,7 @@ cd "$LANDDIR" || exit 2 curtask="(start)" while true do - f=$(ls | head -n1) + f=$(ls | grep -v '~' | head -n1) if [ -z "$f" ] then sleep 1 continue @@ -490,7 +490,7 @@ do task=${f:0:2} if [ "$curtask" == "$task" ] then # Next file of an already started task - mv "$f" "$SINKDIR/" + mv -- "$f" "$SINKDIR/" else # Switch to the next task if [ -d "$SINKDIR" ] then # Inform sinkcat about end-of-data @@ -506,15 +506,14 @@ do curtask=$task if [ "$task" == "99" ] then # Normal exit condition - rm -v "$f" >&2 - # reset # Usefull if ncurses on bg, anoying when destroying useful messages - echo "All task completed sucessfully" >&2 + rm -- "$f" >&2 + echo "All tasks completed sucessfully" >&2 exit 0 else # Start a new task chmod +x -- "$f" # XXX Checks on $f (is a script ?) sinkcat $SINKDIR | "./$f" & while [ ! -d "$SINKDIR" ]; do sleep 1; done - rm -v "$f" >&2 + rm -- "$f" >&2 fi fi done -- cgit v1.2.3