From: Jan Kiszka <[email protected]> This performs several smaller polish steps on the motd output: - ensure that the initial history content is dumped, irrespective of commands inserted into the history during runtime - print "" by using '' as quotes - wrap long command lines, but only for motd
Signed-off-by: Jan Kiszka <[email protected]> --- recipes-core/customizations/files/.bash_history-orangepi-zero | 9 +++++++-- recipes-core/customizations/files/.bash_history-qemuamd64 | 4 +++- recipes-core/customizations/files/.bash_history-qemuarm64 | 6 +++++- recipes-core/customizations/files/20-jailhouse-motd | 6 ++---- recipes-core/customizations/files/postinst-common | 8 ++++++++ 5 files changed, 25 insertions(+), 8 deletions(-) diff --git a/recipes-core/customizations/files/.bash_history-orangepi-zero b/recipes-core/customizations/files/.bash_history-orangepi-zero index 8b52c49..41c5dc3 100644 --- a/recipes-core/customizations/files/.bash_history-orangepi-zero +++ b/recipes-core/customizations/files/.bash_history-orangepi-zero @@ -1,10 +1,15 @@ jailhouse enable /etc/jailhouse/orangepi0.cell jailhouse console jailhouse cell create /etc/jailhouse/orangepi0-gic-demo.cell -jailhouse cell load orangepi0-gic-demo /usr/libexec/jailhouse/demos/gic-demo.bin -s "led-reg=0x1c20810 led-pin=17" -a 0x1000 +jailhouse cell load orangepi0-gic-demo \ + /usr/libexec/jailhouse/demos/gic-demo.bin \ + -s "led-reg=0x1c20810 led-pin=17" -a 0x1000 jailhouse cell start orangepi0-gic-demo jailhouse cell stats orangepi0-gic-demo jailhouse cell destroy orangepi0-gic-demo -jailhouse cell linux /etc/jailhouse/orangepi0-linux-demo.cell /boot/vmlinuz* -d /etc/jailhouse/dts/inmate-orangepi0.dtb -i /usr/libexec/jailhouse/demos/rootfs.cpio -c "console=ttyS0,115200 ip=192.168.19.2" +jailhouse cell linux /etc/jailhouse/orangepi0-linux-demo.cell /boot/vmlinuz* \ + -d /etc/jailhouse/dts/inmate-orangepi0.dtb \ + -i /usr/libexec/jailhouse/demos/rootfs.cpio \ + -c "console=ttyS0,115200 ip=192.168.19.2" ssh 192.168.19.2 jailhouse disable diff --git a/recipes-core/customizations/files/.bash_history-qemuamd64 b/recipes-core/customizations/files/.bash_history-qemuamd64 index 7a7d301..5fe35b3 100644 --- a/recipes-core/customizations/files/.bash_history-qemuamd64 +++ b/recipes-core/customizations/files/.bash_history-qemuamd64 @@ -5,6 +5,8 @@ jailhouse cell load apic-demo /usr/libexec/jailhouse/demos/apic-demo.bin jailhouse cell start apic-demo jailhouse cell stats apic-demo jailhouse cell destroy apic-demo -jailhouse cell linux /etc/jailhouse/linux-x86-demo.cell /boot/vmlinuz* -i /usr/libexec/jailhouse/demos/rootfs.cpio -c "console=ttyS0 8250.nr_uarts=1 ip=192.168.19.2" +jailhouse cell linux /etc/jailhouse/linux-x86-demo.cell /boot/vmlinuz* \ + -i /usr/libexec/jailhouse/demos/rootfs.cpio \ + -c "console=ttyS0 8250.nr_uarts=1 ip=192.168.19.2" ssh 192.168.19.2 jailhouse disable diff --git a/recipes-core/customizations/files/.bash_history-qemuarm64 b/recipes-core/customizations/files/.bash_history-qemuarm64 index f6b6fa3..f2e7e6c 100644 --- a/recipes-core/customizations/files/.bash_history-qemuarm64 +++ b/recipes-core/customizations/files/.bash_history-qemuarm64 @@ -5,6 +5,10 @@ jailhouse cell load gic-demo /usr/libexec/jailhouse/demos/gic-demo.bin jailhouse cell start gic-demo jailhouse cell stats gic-demo jailhouse cell destroy gic-demo -jailhouse cell linux /etc/jailhouse/qemu-arm64-linux-demo.cell /boot/vmlinuz* -d /etc/jailhouse/dts/inmate-qemu-arm64.dtb -i /usr/libexec/jailhouse/demos/rootfs.cpio -c "console=ttyAMA0 ip=192.168.19.2" +jailhouse cell linux /etc/jailhouse/qemu-arm64-linux-demo.cell \ + /boot/vmlinuz* \ + -d /etc/jailhouse/dts/inmate-qemu-arm64.dtb \ + -i /usr/libexec/jailhouse/demos/rootfs.cpio \ + -c "console=ttyAMA0 ip=192.168.19.2" ssh 192.168.19.2 jailhouse disable diff --git a/recipes-core/customizations/files/20-jailhouse-motd b/recipes-core/customizations/files/20-jailhouse-motd index 745aa96..7bc88ac 100644 --- a/recipes-core/customizations/files/20-jailhouse-motd +++ b/recipes-core/customizations/files/20-jailhouse-motd @@ -1,7 +1,5 @@ #!/bin/sh -echo " +echo -n ' For trying out Jailhouse, the following commands have been placed into the -shell history:" - -head -10 /root/.bash_history | sed 's/^/ # /' +shell history: diff --git a/recipes-core/customizations/files/postinst-common b/recipes-core/customizations/files/postinst-common index 701d53d..4f92bbe 100644 --- a/recipes-core/customizations/files/postinst-common +++ b/recipes-core/customizations/files/postinst-common @@ -1,6 +1,14 @@ #!/bin/sh echo "Jailhouse Demo Image (login: root/root)" > /etc/issue +# Store initial shell history persistently for motd use, +# prefix commands with " # ". +sed 's/^ / \0/;s/^[^ ]/ # \0/' /root/.bash_history >> /etc/update-motd.d/20-jailhouse-motd +echo "'" >> /etc/update-motd.d/20-jailhouse-motd + +# Remove any long line wrappings from commands in the shell history. +sed -i ':restart /\\$/N;s/\\\n[ ]*//;t restart' /root/.bash_history + echo "PermitRootLogin yes" >> /etc/ssh/sshd_config echo "demo" > /etc/hostname -- 2.16.4 -- You received this message because you are subscribed to the Google Groups "Jailhouse" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
