From a67621e9909f24eff0bfe0c01763d7825c405ccc Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Wed, 27 Sep 2017 18:27:05 +0200 Subject: Add some helper script for use with tmux --- make-boot-image.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) 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" -- cgit v1.2.3