From 234921f76113543a9060fe29495e6ceb03f4c068 Mon Sep 17 00:00:00 2001
From: Ludovic Pouzenc <ludovic.pouzenc@mines-albi.fr>
Date: Fri, 29 Sep 2017 17:46:28 +0200
Subject: Add tmux in eficast. There is troubles with termcap's

---
 make-boot-image.sh | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/make-boot-image.sh b/make-boot-image.sh
index 6e2b153..d55a088 100755
--- a/make-boot-image.sh
+++ b/make-boot-image.sh
@@ -83,7 +83,7 @@ then	$ROOTCMD apt-get update
 	# Optionnally qemu to run the result for santity checking
 	[ "x$DEVEL_MODE" = "xy" ] && $ROOTCMD apt-get install qemu-system-x86
 	# Dependencies to put into the initrd
-	$ROOTCMD apt-get install dmidecode pciutils usbutils lshw sysstat iftop strace \
+	$ROOTCMD apt-get install dmidecode pciutils usbutils lshw sysstat iftop strace tmux \
 		ntfs-3g e2fsprogs partclone util-linux udpcast gdisk efibootmgr tcpdump pigz
 	# util-linux : fdisk, sfdisk, lsblk, setterm
 	> "$WORKDIR/apt-done"
@@ -256,7 +256,7 @@ then	(
 		# Diagnostic tools
 		mkchroot "$WORKDIR/initrd" dmidecode iftop iostat lshw lspci lsblk lsusb mpstat tcpdump
 		# Console tools and manpages display
-		mkchroot "$WORKDIR/initrd" setterm strace groff nroff troff grotty gtbl
+		mkchroot "$WORKDIR/initrd" setterm strace groff nroff troff grotty gtbl tmux
 		# Filesystem tools
 		mkchroot "$WORKDIR/initrd" mkfs mke2fs /sbin/mkfs.ext* mkntfs mkfs.ntfs mkfs.fat mkexfatfs mkfs.exfat mkfs
 		mkchroot "$WORKDIR/initrd" ntfs-3g mount.ntfs mount.fuse mount.exfat-fuse mount.exfat
@@ -283,7 +283,7 @@ fi
 
 if [ ! -d "$WORKDIR/initrd/usr/man" ]
 then	mkdir -p "$WORKDIR"/initrd/usr/man/man{1,8} "$WORKDIR"/initrd/usr/share/groff/1.22.2/font "$WORKDIR/initrd/etc/groff/"
-	cp -a /usr/share/man/man1/{iostat,mpstat,strace,udp-receiver}* "$WORKDIR/initrd/usr/man/man1/"
+	cp -a /usr/share/man/man1/{iostat,mpstat,strace,udp-receiver,tmux}* "$WORKDIR/initrd/usr/man/man1/"
 	cp -a /usr/share/man/man8/{dmidecode,partclone,efibootmgr,ntfs,mkntfs,fdisk,gdisk,iftop,tcpdump}* "$WORKDIR/initrd/usr/man/man8/"
 	# TODO add missing man pages
 	cp -ra /usr/share/groff/1.22.2/font/devascii "$WORKDIR/initrd/usr/share/groff/1.22.2/font/"
@@ -337,7 +337,7 @@ eficast_end() {
 rescue_shell() {
 	echo
 	echo_color white red "Something went wrong. Dropping to a shell."
-	PS1='\h:\w# ' /bin/busybox sh
+	PS1='\h:\w# ' HOME='/root/' /bin/busybox sh
 	eficast_end
 }
 
@@ -510,6 +510,12 @@ cd /mnt/nfs
 EOF
 chmod +x "$WORKDIR/initrd/bin/autorun.sh"
 
+cat > "$WORKDIR/initrd/etc/profile" <<"EOF"
+# tmux on qemu need this (problems with carriage return)
+stty sane
+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
-- 
cgit v1.2.3