Skip to content

Commit

Permalink
add limine menu
Browse files Browse the repository at this point in the history
  • Loading branch information
YukariChiba committed Jul 19, 2024
1 parent 1a4b535 commit 906c81a
Show file tree
Hide file tree
Showing 8 changed files with 96 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- `subprofiles/{subprofile}/`: (Optional) subprofile directory
- `config.sh`: (Optional) config script in chroot
- `files/`: (Optional) files to be used in subprofile level `config.sh`, installed to `/.files/` before `config.sh`
- `title.txt`: (Optional) title to be used in limine menu, which defaults to be subprofile name
- `default_subprofile.txt`: (Optional) default subprofile
- `config`:
- `common`: common config script in chroot
Expand Down Expand Up @@ -49,6 +50,8 @@
- copy files to be used in subprofile config hooks (if any)
- executes subprofile config hooks (in `profiles/{profile}/subprofiles/{subprofile}/config.sh`)
- clean used files by config hooks
- `utils/limine_menu.sh`: (if liveimage and any subprofile)
- generate and override limine config
- `utils/collect_tarball.sh`: compress tarball and make checksum (if tarball)
- `utils/collect_liveimage.sh`: (if liveimage)
- make squashfs for each layer
Expand Down
1 change: 1 addition & 0 deletions gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ trap errorhandler ERR
# layered subprofiles only in liveimages
if [[ $PROFILE == liveimage* ]] && [ -d profiles/$PROFILE/subprofiles ]; then
. utils/hooks-subprofiles.sh
. utils/limine_menu.sh
fi
case "$PROFILE" in
tarball*) . utils/collect_tarball.sh ;;
Expand Down
1 change: 1 addition & 0 deletions profiles/liveimage-desktop/subprofiles/cli-fb/title.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Live CLI with Framebuffer Term
1 change: 1 addition & 0 deletions profiles/liveimage-desktop/subprofiles/cli/title.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Live CLI
1 change: 1 addition & 0 deletions profiles/liveimage-desktop/subprofiles/desktop/title.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Live Desktop
4 changes: 3 additions & 1 deletion utils/hooks-subprofiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,6 @@ else
DEFAULT_SUBPROFILE=`ls profiles/$PROFILE/subprofiles | head -n 1`
fi

cp ./tmpdir/isofs/live/${DEFAULT_SUBPROFILE}.list ./tmpdir/isofs/live/live.list
if [ -f ./tmpdir/isofs/live/${DEFAULT_SUBPROFILE}.list ]; then
cp ./tmpdir/isofs/live/${DEFAULT_SUBPROFILE}.list ./tmpdir/isofs/live/live.list
fi
2 changes: 1 addition & 1 deletion utils/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ _logtxt "#### bootstrapping base system"

mount_overlay base

$RUNAS pacstrap -G -M -c -C ./pacman.ewe.conf ./tmpdir/rootfs base linux linux-firmware
$RUNAS pacstrap -G -M -c -C ./pacman.ewe.conf ./tmpdir/rootfs base

umount_overlay

Expand Down
85 changes: 85 additions & 0 deletions utils/limine_menu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#!/bin/bash

count=`ls profiles/$PROFILE/subprofiles | wc -l`
CFGOUT=./tmpdir/isofs/limine.cfg
sudo rm $CFGOUT || true
# TODO: multiple kernel
kernel_file=`ls ./tmpdir/isofs/ | grep vmlinuz- | head -n 1`
initrd_file=`ls ./tmpdir/isofs/ | grep initramfs- | head -n 1`

function limine_menu_render_subprofile() {
title="$1"
subprofile_id="$2"
cat <<EOF | $RUNAS tee -a $CFGOUT
:eweOS $TARGET_ARCH ($title)
PROTOCOL=linux
KERNEL_PATH=boot:///${kernel_file}
KERNEL_CMDLINE=live=${subprofile_id} quiet splash
MODULE_PATH=boot:///${initrd_file}
EOF
}

function limine_menu_render_subprofile_adv() {
title="$1"
subtitle="$2"
subprofile_id="$3"
cmdline="$4"
cat <<EOF | $RUNAS tee -a $CFGOUT
::eweOS $TARGET_ARCH ($title, $subtitle)
PROTOCOL=linux
KERNEL_PATH=boot:///${kernel_file}
KERNEL_CMDLINE=live=${subprofile_id} $cmdline
MODULE_PATH=boot:///${initrd_file}
EOF
}

# only process if more than 1 subprofiles
if [ "$count" -gt "1" ]; then

cat <<EOF | $RUNAS tee -a $CFGOUT
TERM_WALLPAPER=boot:///bg.jpg
TERM_MARGIN=0
EOF

if [ -f "profiles/$PROFILE/subprofiles/$DEFAULT_SUBPROFILE/title.txt" ]; then
DEFAULT_SUBPROFILE_NAME=`cat profiles/$PROFILE/subprofiles/$DEFAULT_SUBPROFILE/title.txt`
else
DEFAULT_SUBPROFILE_NAME=$DEFAULT_SUBPROFILE
fi

limine_menu_render_subprofile "$DEFAULT_SUBPROFILE_NAME" $DEFAULT_SUBPROFILE

for subprofile in $(ls profiles/$PROFILE/subprofiles); do
if [ "$subprofile" != "$DEFAULT_SUBPROFILE" ]; then
if [ -f "profiles/$PROFILE/subprofiles/$subprofile/title.txt" ]; then
subprofile_name=`cat profiles/$PROFILE/subprofiles/$subprofile/title.txt`
else
subprofile_name=$subprofile
fi
limine_menu_render_subprofile "$subprofile_name" $subprofile
fi
done

cat <<EOF | $RUNAS tee -a $CFGOUT
:eweOS $TARGET_ARCH [Advanced Boot Options]
EOF

for subprofile in $(ls profiles/$PROFILE/subprofiles); do
if [ -f "profiles/$PROFILE/subprofiles/$subprofile/title.txt" ]; then
subprofile_name=`cat profiles/$PROFILE/subprofiles/$subprofile/title.txt`
else
subprofile_name=$subprofile
fi
limine_menu_render_subprofile_adv "$subprofile_name" "recovery mode" $subprofile "nosplash -- single"
done

cat <<EOF | $RUNAS tee -a $CFGOUT
:Resume Default Boot Sequence
PROTOCOL=chainload_next
EOF

fi

0 comments on commit 906c81a

Please sign in to comment.