From ed1899476caa7f335d2b2ded6fcb1eaa40ac11a7 Mon Sep 17 00:00:00 2001 From: Johannes 'josch' Schauer Date: Fri, 1 Mar 2019 00:33:26 +0100 Subject: [PATCH] make_mirror.sh: annotate each line with timestamp --- make_mirror.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/make_mirror.sh b/make_mirror.sh index 98631bc..164c86a 100755 --- a/make_mirror.sh +++ b/make_mirror.sh @@ -282,14 +282,28 @@ echo 'root:root' | chpasswd mount -t 9p -o trans=virtio,access=any mmdebstrap /mnt # need to restart mini-httpd because we mounted different content into www-root systemctl restart mini-httpd + +handler () { + while IFS= read -r line || [ -n "$line" ]; do + printf "%s %s: %s\n" "$(date +%T.%3N)" "$1" "$line" + done +} + ( cd /mnt; if [ -e cover_db.img ]; then mkdir -p cover_db mount -o loop,umask=000 cover_db.img cover_db fi - sh -x ./test.sh - ret=$? + + ret=0 + { { { { { + sh -x ./test.sh 2>&1 1>&4 3>&- 4>&-; echo $? >&2; + } | handler E >&3; + } 4>&1 | handler O >&3; + } 2>&1; + } | { read xs; exit $xs; }; + } 3>&1 || ret=$? if [ -e cover_db.img ]; then df -h cover_db umount cover_db