summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2017-10-21 10:29:37 +0200
committerLudovic Pouzenc <ludovic@pouzenc.fr>2017-10-21 10:29:37 +0200
commit6fccc39524e5ad42e7519199dc091b72e6ee6963 (patch)
treeb6b9ab24716a52c98adb701f8f155a4ec3cec858
parent898703c2b7ef2b7093b8f48c47fb8dd75af33392 (diff)
downloadeficast-6fccc39524e5ad42e7519199dc091b72e6ee6963.tar.gz
eficast-6fccc39524e5ad42e7519199dc091b72e6ee6963.tar.bz2
eficast-6fccc39524e5ad42e7519199dc091b72e6ee6963.zip
figlet-center rename to "message" and working (bad busybox awk)
-rwxr-xr-xmake-boot-image.sh12
1 files changed, 8 insertions, 4 deletions
diff --git a/make-boot-image.sh b/make-boot-image.sh
index b6f9536..5f79b5b 100755
--- a/make-boot-image.sh
+++ b/make-boot-image.sh
@@ -255,6 +255,7 @@ then # When using sudo with password auth, ask and cache pass first
$ROOTCMD true
# The following compound command will suck at asking pass
$ROOTCMD dumpkeys | $ROOTCMD loadkeys -b > "$WORKDIR/initrd/etc/keys.bmap"
+ cp -a /etc/localtime "$WORKDIR/initrd/etc/"
fi
if [ ! -f "$WORKDIR/initrd/usr/sbin/partclone.restore" ]
@@ -580,12 +581,15 @@ alias sfx-success="sound 1 140 $E6 $G6 $E7 $C7 $D7 $G7"
alias sfx-failure="sound 3 100 $C5 1 3 $G4 1 3 $E4 3 0 $A4 2 0 $B4 2 0 $A4 2 0 $Ab4 3 0 $Bb4 3 0 $Ab4 3 0 $G4 6 0"
alias sfx-starting="sound 1 25 $C5 $G4 $C5 $E5 $G5 $C6 $G5 $Ab4 $C5 $Eb5 $Ab5 $Eb5 $Ab5 $C6 $Eb6 $Ab6 $Eb6 $Bb4 $D5 $F5 $Bb5 $D6 $F6 $Bb6 $F6"
EOF
-add_initrd_script "/bin/figlet-center" <<"EOF"
+add_initrd_script "/bin/message" <<"EOF"
# Output some center ASCII-art text, one line per argument
printf '\033]2;'"$*"'\033\\' # Term title (tmux)
-while [ -n "$1" ]
-do
- echo $1 | figlet -t -f mono12 | awk "{ for (i=0;i<($(tput cols)-length(\$0))/2;i++) printf \" \"; print }"
+CMDFIG="figlet -t -f mono12"
+while [ -n "$1" ]; do
+ termwidth=$(tput cols)
+ textlen=$(echo $1 | $CMDFIG | head -n1 | wc -c)
+ offset=$(( (termwidth-textlen)/2 ))
+ echo $1 | $CMDFIG | awk "{printf \"%${offset}s\"; print}"
shift
done
EOF