summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic.pouzenc@mines-albi.fr>2017-09-27 18:27:05 +0200
committerLudovic Pouzenc <ludovic.pouzenc@mines-albi.fr>2017-09-27 18:27:05 +0200
commita67621e9909f24eff0bfe0c01763d7825c405ccc (patch)
tree4e7228b0d2d16e970f63ff07fd06213b14023a1d
parentaa18bf14450688a94602523e7a934af267bc45a4 (diff)
downloadeficast-a67621e9909f24eff0bfe0c01763d7825c405ccc.tar.gz
eficast-a67621e9909f24eff0bfe0c01763d7825c405ccc.tar.bz2
eficast-a67621e9909f24eff0bfe0c01763d7825c405ccc.zip
Add some helper script for use with tmux
-rwxr-xr-xmake-boot-image.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/make-boot-image.sh b/make-boot-image.sh
index 81c6ec4..6e2b153 100755
--- a/make-boot-image.sh
+++ b/make-boot-image.sh
@@ -510,6 +510,43 @@ cd /mnt/nfs
EOF
chmod +x "$WORKDIR/initrd/bin/autorun.sh"
+cat > "$WORKDIR/initrd/bin/restore-script" <<"EOF"
+#!/bin/busybox sh
+# Dummy restore script for testing the tmux inegration
+pigz -dc testimg.partclone.gz | partclone.restore -o /dev/vg_data/lv_dst
+EOF
+chmod +x "$WORKDIR/initrd/bin/restore-script"
+
+cat > "$WORKDIR/initrd/bin/pigz-watch" <<"EOF"
+#!/bin/busybox sh
+# Emulate watch command using pipeview (pv) for a running pigz
+while true
+do
+ pid=$(pidof -s pigz)
+ [ -n "$pid" ] && pv -D5 -F "%N %b %T %t %r %a %p %I" -d $pid
+ sleep 1
+done
+EOF
+chmod +x "$WORKDIR/initrd/bin/pigz-watch"
+
+cat > "$WORKDIR/initrd/bin/toilet-center" <<"EOF"
+#!/bin/busybox sh
+# Output some center ASCII-art text, one line per argument
+while [ -n "$1" ]
+do
+ echo $1 | toilet -t -f mono12 | awk "{ for (i=0;i<($(tput cols)-length(\$0))/2;i++) printf \" \"; print }"
+ shift
+done
+EOF
+chmod +x "$WORKDIR/initrd/bin/toilet-center"
+
+cat > "$WORKDIR/initrd/bin/iostat-watch" <<"EOF"
+#!/bin/busybox sh
+# Emulates watch command with iostat (filtered info, minimal height)
+iostat -cdmz 1 | awk '$1=="avg-cpu:" { system("clear"); } length($0) > 0 { print $0; }'
+EOF
+chmod +x "$WORKDIR/initrd/bin/iostat-watch"
+
# XXX workaround, kernel makefile's cpio preseves everything and it is not so cool for us
$ROOTCMD chown -R root: "$WORKDIR/initrd"