Merge remote-tracking branch 'origin/ryansquared/add-tmux'

This commit is contained in:
Anton Livaja 2025-06-30 12:50:11 -07:00
commit b3af1c89b8
Signed by: anton
GPG Key ID: 44A86CFF1FDF0E85
5 changed files with 78 additions and 2 deletions

View File

@ -71,6 +71,9 @@ FROM stagex/user-usbmuxd@sha256:90f687d2368328b76141badc382a21873a5b44d4ddccf851
FROM stagex/user-socat@sha256:990a70ae13462d8ba0a925fe959dd83070cbecdb3f91ff145caca5232171f3b8 AS user-socat
FROM stagex/user-dhcpcd@sha256:60bd86d9e2fcb6341c1efaeda5d786b63ff92e9d0c729cd8f634a20ff54ee71e AS user-dhcpcd
FROM stagex/user-guestctl@sha256:95ad9e34a003c7d1d01f5d427b5f79d2430f6e6634debde8e54f9a6f08749704 AS user-guestctl
FROM stagex/core-ncurses@sha256:6602a073bf9a408d1ed7c20ccc98fca974cd307fb8d1da6381fbca684a08169c AS core-ncurses
FROM stagex/user-libevent@sha256:1ba6f006f49cc327a5da84caeb0de7088da844f8021c5902fe387cd379732aec AS user-libevent
FROM stagex/user-tmux@sha256:57b63a27169a333edb073f1c6646a37ec6a9eee02ffdbc494a52bd6d670fc576 AS user-tmux
FROM scratch AS base
ARG VERSION development
@ -247,6 +250,9 @@ COPY --from=user-libzbar . initramfs
COPY --from=user-keyfork . initramfs
COPY --from=user-icepick . initramfs
COPY --from=user-guestctl . initramfs
COPY --from=user-libevent . initramfs
COPY --from=core-ncurses . initramfs
COPY --from=user-tmux . initramfs
COPY src/host/rootfs/ initramfs
COPY <<-EOF initramfs/etc/environment
export VERSION="$VERSION"

View File

@ -4,6 +4,7 @@ GIT_AUTHOR := $(shell git log -1 --format=%an)
GIT_PUBKEY := $(shell git log -1 --format=%GK)
GIT_TIMESTAMP := $(shell git log -1 --format=%cd --date=iso)
EFI := false
GUI := false
,:=,
export
@ -51,6 +52,32 @@ out/dev-shell.digest: Containerfile | out
shell: out/dev-shell.digest
docker run -it $(shell cat $<) /bin/sh
.PHONY: system-vm
system-vm:
qemu-system-x86_64 \
-m 4G \
-machine q35,kernel-irqchip=split \
-usb \
-device sdhci-pci \
-device sd-card,drive=external \
-drive id=external,if=none,format=raw,file=out/sdcard.img \
-device usb-storage,drive=usbdrive \
-device intel-iommu,intremap=on \
-netdev user,id=net0 \
-device e1000,netdev=net0 \
-chardev socket,path=out/qga.sock,server=on,wait=off,id=qga0 \
-device virtio-serial \
-device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 \
$(if $(filter $(EFI),true) ,\
-bios /usr/share/ovmf/OVMF.fd \
-drive id=boot$(,)if=virtio$(,)format=raw$(,)file=out/airgap.iso \
,\
-drive id=usbdrive,if=none,format=raw,file=out/airgap.iso \
-boot order=c \
) \
$(if (,$(wildcard /dev/kvm)),-cpu host --accel kvm,) \
$(if $(filter $(GUI),true),,-nographic)
.PHONY: vm
vm: out/dev-shell.digest out/airgap.iso out/sdcard.img
docker run -it -v ./out:/out $(shell cat $<) sh -c "\

View File

@ -10,6 +10,7 @@
# Startup the system
::sysinit:/bin/mount -t devtmpfs devtmpfs /dev
::sysinit:/bin/mkdir -p /proc /run /dev/pts /dev/shm /sys
::sysinit:/bin/mount -t devpts devpts /dev/pts
::sysinit:/bin/mount -t sysfs sysfs /sys
::sysinit:/bin/mount -t proc proc /proc
::sysinit:/bin/mount -o remount,rw /
@ -21,8 +22,8 @@ null::sysinit:/bin/ln -sf /proc/self/fd/2 /dev/stderr
# now run any rc scripts
::sysinit:/etc/init.d/rcS
# Put shells on the serial terminal and console
console::respawn:-/bin/bash
# Put a shell on serial and tmux on console
console::respawn:-/bin/bash -l -c /bin/tmux
ttyS0::respawn:-/bin/bash
# Stuff to do for the 3-finger salute

View File

@ -1,4 +1,10 @@
case "$TERM" in
linux|linux-*)
export TERM=linux-16color
;;
esac
export EDITOR=/bin/vi
export SHELL=/bin/bash
export PATH="/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin"
export PS1="[\h \t] \\$ "
export GNUPGHOME=/.gnupg

View File

@ -0,0 +1,36 @@
# Zero-based indexing is sure great in programming languages,
# but not so much in terminal multiplexers where that zero is
# all the way on the other side of the keyboard.
set-option -g base-index 1
set-option -g status on
set-option -g status-interval 1
# We should not have more than one session, but it's still possible.
# Therefore...
set-option -g status-left "[#S] "
# Just so we can use `-ag` properly later
set-option -g status-right ""
# The current power battery level
set-option -ag status-right '#(test -d /sys/class/power_supply/BAT0 && printf " [%%s%%%%]" "$(cat /sys/class/power_supply/BAT0/capacity)")'
# Current date and time, in case it's relevant, and has drifted
set-option -ag status-right " [%Y-%m-%d %H:%M:%S]"
# because cyan on black is cool, and pops out
set-option -g status-style "bg=color0 fg=color6"
set-option -g status-position bottom
# we don't have much screen space, let's limit what's displayed
set-window-option -g window-status-bell-style "bold"
set-window-option -g window-status-current-format "#I:#W"
set-window-option -g window-status-format "#I:#W"
# our "focused" window and pane is the brighter one
set-window-option -g window-status-style "fg=color6"
set-window-option -g window-status-current-style "fg=color14"
set-option -g pane-border-style "fg=color6"
set-option -g pane-active-border-style "fg=color14"
set-option -g message-style "fg=color6 bg=color0"