Simple menu

Szymon Karpiński 7 years ago
parent cc13b249d5
commit 739ce24c47
  1. 2
      .gitignore
  2. 10
      linux/Makefile
  3. 14
      linux/src/scripts/menu.sh
  4. 4
      linux/src/scripts/shell.sh

2
.gitignore vendored

@ -0,0 +1,2 @@
linux/build/
syslinux/

@ -1,18 +1,24 @@
CHROOT_CMD := chroot build/rootfs /bin/bash -c
FILES = $(shell find src/ -type f -print | sed -e 's|^src/|build/rootfs/|')
FILES_SRC = $(shell find src/ -type f -print)
all: build/rootfs $(FILES) build/rootfs/initrd.img
all: build/rootfs $(FILES) menu build/rootfs/initrd.img
clean:
rm -rf build/rootfs
menu: $(FILES)
$(CHROOT_CMD) "apt install dialog"
$(CHROOT_CMD) "chmod +x /scripts/menu.sh"
$(CHROOT_CMD) "usermod -s /scripts/menu.sh root"
build/rootfs/initrd.img: $(FILES)
chmod +x build/rootfs/etc/initramfs-tools/scripts/local-top/download.sh
$(CHROOT_CMD) "apt update && apt install -y linux-image-4.19.0-6-amd64"
$(CHROOT_CMD) "update-initramfs -c -kall"
build/rootfs/%:
$(FILES): $(FILES_SRC)
mkdir -p $(@D)
cp $(shell echo $@ | sed -e 's|^build/rootfs/|src/|') $@

@ -0,0 +1,14 @@
#!/bin/bash
sleep 1
dialog --menu " " 10 80 5 \
recv_fsa "Receive and write fsarchiver's archive (to /dev/sda1)" \
recv_sfd "Receive and write sfdisk's partition table" \
shell "Run root shell" 2>/tmp/menu \
if [ "$?" != "0" ]; then CHOICE="shell"; else CHOICE=$(cat /tmp/menu); fi
if ! [ -f "$CHOICE" ]; then CHOICE="shell"; fi
bash $(dirname "$0")/$CHOICE.sh

@ -0,0 +1,4 @@
#!/bin/bash
clear
bash
Loading…
Cancel
Save