Compare commits

..

No commits in common. "4ad24cd144dd0511d482f3b19afc742f8b05bc19" and "e61ac827618254a15e4a0e220091a9faee88fb9d" have entirely different histories.

4 changed files with 22 additions and 189 deletions

View File

@ -1,61 +1,30 @@
# Void Linux Setup for USB Sticks
# Void Linux Minecraft Setup for USB Sticks
This repository holds scripts for installing a Void Linux setup specialized to run off a USB stick.
This repository holds a bunch of scripts for installing and customizing
Void Linux to run off a USB stick.
This is only for USB sticks (thumb drives, pen drives, whatever you wanna call them).
You dont need this if you want to use a USB HDD or SSD because these devices tend to just work normally.
If you want to use a USB HDD/SSD, just download the installer for the Linux distro of your choice and
install it on that drive. Most modern distros know how to cope with external drives.
The reason this is useful for USB sticks is that most of them are a bit shit.
Trying to run an operating system off a USB drive typically results in a corrupted drive pretty quickly
(if you can get the system to install properly in the first place).
## Installation
You need the following:
- Computer (duh)
- 8G of RAM or more
- Can boot off USB (most computers made after 2003)
- USB stick (at least 8G)
- Internet connection
There are a couple manual steps to get started before the installer scripts can take over:
There are a couple manual steps to get started before this script can take over:
- Set up a Void live medium
- Download here: https://voidlinux.org/download/
- The following instructions assume you downloaded the "base" image
- Burn to CD/DVD or flash it to USB stick
- Burn to a CD/DVD or flash it to a USB stick
- Windows should have a built-in thing for burning ISOs.
- You can use something like Win32DiskImager or Rufus for USB sticks.
- This will delete whats on the stick.
- Boot into Void live and prepare things
- Things I cant help you with (sorry):
- Two things I cant help you with (sorry):
- How to boot off CD/USB depends on your computer, so youll have to find out elsewhere.
- Be aware that Void uses a US keymap until you change it. If your keyboard is different, you might need to look up an image of a US keyboard to find the right keys.
- If booting off the USB stick you want to install to, use (RAM) option
- If you are booting off the USB stick you want to install to, use the (RAM) option.
- Log in as `root`, password `voidlinux`
- If you need to use WiFi, run `void-installer`
- Set your keyboard layout (optional)
- Connect to your network
- Abort the installation (dont touch anything else)
- set your keyboard layout (optional)
- connect to your network
- abort the installation
- Download and run stage 1 of the USB installation script
- The base image doesnt come with a way to download files so you need to install that first: `xbps-install -S wget`
- If it yells at you about updating xbps, do that, then try again
- if it yells at you about updating xbps, do that, then try again
- `wget https://lostcave.ddnss.de/git/BodgeMaster/void-minecraft-usb/raw/branch/master/install-stage1.sh`
- `bash install-stage1.sh`
The scripts will take it from there, asking you for information and downloading things as needed.
## How It Works
`//TODO:` Add detailed documentation
## Files
- `install-stage1.sh`: sets up the base system and prepares for installation stage 2
- `install-stage2.sh`: continues setting up things after booting into the freshly installed base system
- `opt/grub-config`: the custom grub config generator to be installed in /opt/void-usb
- `procedure.txt`: notes to self, will disappear once finished
- `bootup.sh`: script that sets up the overlay
- `bashrc`: just a custom bashrc
- `update-squashfs.sh`: runs at shutdown, allows user to back up the system
The script will take it from there, asking you for information as needed.

View File

@ -34,10 +34,6 @@ function yesno {
done
}
function run_in_target {
xchroot /mnt/target "$@"
}
clear
echo "
This script will now download and install Void Linux on your USB stick.
@ -173,7 +169,7 @@ XBPS_ARCH="$TARGET_TYPE" xbps-install --yes --sync --rootdir /mnt/target --repos
wifi-firmware traceroute grep gzip file sed gawk less coreutils findutils \
diffutils pciutils usbutils tzdata base-files ncurses mdocml procps-ng \
kbd xbps sudo ethtool kmod eudev runit-void removed-packages nano acpid \
squashfs-tools grub grub-i386-efi grub-x86_64-efi dracut
squashfs-tools grub grub-i386-efi grub-x86_64-efi
echo "repository=$TARGET_MIRROR" > /mnt/target/etc/xbps.d/00-repository-main.conf
@ -188,7 +184,7 @@ echo "# See fstab(5).
# TODO: add script path
UUID=$(blkid --output value --match-tag UUID $TARGET_PART_BOOT) /boot f2fs defaults,nodev,nosuid 0 2
UUID=$(blkid --output value --match-tag UUID $TARGET_PART_EFI) /boot/efi vfat defaults,fmask=0077,dmask=0077 0 2
UUID=$(blkid --output value --match-tag UUID $TARGET_PART_EFI) /boot/efi vfat defaults 0 2
/container/home /home none bind 0 0
" > /mnt/target/etc/fstab
@ -266,15 +262,6 @@ done
echo "$TARGET_HOSTNAME" > /mnt/target/etc/hostname
mkdir /mnt/target/boot/efi/LOADER
echo "GRUB has been deliberately installed to a non-standard location.
This avoids default kernel hooks breaking the custom config." > /mnt/target/boot/efi/LOADER/README.TXT
# no idea if any of these are even necessary/relevant but it cant hurt...
TARGET_PRELOAD_GRUB_MODULES="usb usbms uhci ehci ohci part_gpt f2fs"
run_in_target grub-install --target=i386-pc --boot-directory=/boot/efi/LOADER --disk-module=native --modules="$TARGET_PRELOAD_GRUB_MODULES" "/dev/$TARGET_DISK"
run_in_target grub-install --target=i386-efi --boot-directory=/boot/efi/LOADER --efi-directory=/boot/efi --removable --no-nvram --modules="$TARGET_PRELOAD_GRUB_MODULES" "/dev/$TARGET_DISK"
run_in_target grub-install --target=x86_64-efi --boot-directory=/boot/efi/LOADER --efi-directory=/boot/efi --removable --no-nvram --modules="$TARGET_PRELOAD_GRUB_MODULES" "/dev/$TARGET_DISK"

View File

@ -1,102 +0,0 @@
#!/usr/bin/env bash
OS_NAME="Void Linux USB"
GRUB_PREFIX="/boot/efi/LOADER/grub"
CFG_CUSTOM_BEFORE="custom_before.cfg"
CFG_CUSTOM_AFTER="custom_after.cfg"
LINUX_CMDLINE=""
DEFAULT_LINUX=/boot/vmlinu?
if [ ! -f "$DEFAULT_LINUX" ]; then
# in cases where its a .gz or .xz or whatever
DEFAULT_LINUX=$(find /boot -type l -name "vmlinu*" 2>/dev/null | sort | head -n1)
fi
DEFAULT_INITRAMFS=/boot/initramfs.img
if [ ! -f "$DEFAULT_INITRAMFS" ]; then
# hope to find anything named initramfs or initrd
DEFAULT_INITRAMFS=$(find /boot -type l -name "init*" 2>/dev/null | sort | head -n1)
fi
function make_menuentry {
# $1 is the kernel path
# We dont want duplicate entries for /boot/vmlinuz symlink
if [ -L $1 ]; then
return 0
fi
# exclude garbage globbing results
if [ ! -f $1 ]; then
return 0
fi
LINUX="$(basename "$1")"
LINUX_VERSION="$(sed 's/^kernel//;s/^vm//;s/^linuz//;s/^linux//;s/^-//' <<< "$LINUX")"
if grep -e ".gz$" -e ".xz$" -e ".bz$" -e ".bz2$" -e ".lzma$" -e ".lz$" -e ".img$" >/dev/null 2>&1 <<< "$LINUX"; then
LINUX_VERSION="$(sed 's/[^.]*$//;s/.$//' <<< "$LINUX_VERSION")"
fi
INITRAMFS="$(basename "$(find /boot -name "init*$LINUX_VERSION*" 2>/dev/null | sort | head -n1)")"
# user output
echo " -> Found $LINUX (version $LINUX_VERSION, initramfs $INITRAMFS)"
# grub.cfg
echo "
menuentry 'Linux $LINUX_VERSION' {
echo 'Loading $LINUX...'
linux /$LINUX $LINUX_CMDLINE
echo 'Loading initial ramdisk...'
initrd /$INITRAMFS
}" >> "$GRUB_PREFIX/grub.cfg"
}
# user output
echo "Generating grub config..."
# grub.cfg
echo "# This file is auto-generated by $0.
# Changes will be overwritten automatically.
# If you want to add custom entries or other changes, add them to
# $GRUB_PREFIX/$CFG_CUSTOM_BEFORE or
# $GRUB_PREFIX/$CFG_CUSTOM_AFTER
search --fs-uuid --set=root $(blkid --output value --match-tag UUID "$(grep " /boot " /proc/mounts | sed -e 's/ .*//')")
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
timeout=5
if [ -f \${config_directory}/$CFG_CUSTOM_BEFORE ]; then
source \${config_directory}/$CFG_CUSTOM_BEFORE
elif [ -z \"\${config_directory}\" -a -f \$prefix/$CFG_CUSTOM_BEFORE ]; then
source \$prefix/$CFG_CUSTOM_BEFORE
fi
menuentry '$OS_NAME' {
echo 'Loading Linux...'
linux $DEFAULT_LINUX
echo 'Loading initial ramdisk...'
initrd $DEFAULT_INITRAMFS
}
submenu 'Choose kernel version...' {" > "$GRUB_PREFIX/grub.cfg"
for FILE in /boot/{vm,}linu{x,z}* /boot/kernel*; do
make_menuentry "$FILE"
done
# grub.cfg
echo "
}
if [ -f \${config_directory}/$CFG_CUSTOM_AFTER ]; then
source \${config_directory}/$CFG_CUSTOM_AFTER
elif [ -z \"\${config_directory}\" -a -f \$prefix/$CFG_CUSTOM_AFTER ]; then
source \$prefix/$CFG_CUSTOM_AFTER
fi" >> "$GRUB_PREFIX/grub.cfg"
# user output
echo "done"

View File

@ -1,17 +1,7 @@
TODO:
make it bootable with UEFI and BIOS?
compare sizes of glibc and musl installations
try running multiple MC versions on musl (incl ThatModPack)
try running multiple MC versions on musl
need xdg menu maker?
check if there are problems with GRUBs --disk-module=native on real USB drives on real hardware
test that the (RAM) boot option allows you to install to the stick the system booted off
adjust required USB stick and RAM size in README
musl downsides:
- no nvidia drivers
- may be janky in regards to running some Minecraft versions
musl upsides:
- ??
ideas:
use shell script for init, call real init via exec
@ -22,13 +12,11 @@ system lives on squashfs
-> fstrim (if applicable)
swap on zram
f2fs for home
tmpfs for package cache, /tmp, logs?
when backing up
- do not cross file system boundaries
- exclude /tmp, package cache, logs
- possibly only save the changes in separate squashfs images
- either until it takes up too much space or until a certain number of images exist
- consolidate when the user requests it or when exceeding the limit
Steps to install:
- (user does this:) boot Void installer
@ -61,7 +49,7 @@ Steps to install:
-> select installation type (x86_32/x86_64/aarch64, glibc/musl)
-> if musl, add that bit to repo url
-> install packages
-> linux bash shadow f2fs-tools dosfstools dbus NetworkManager iana-etc iw wpa_supplicant util-linux which tar man-pages iproute2 iputils wifi-firmware traceroute grep gzip file sed gawk less coreutils findutils diffutils pciutils usbutils tzdata base-files ncurses mdocml procps-ng kbd xbps sudo ethtool kmod eudev runit-void removed-packages nano acpid squashfs-tools grub grub-i386-efi grub-x86_64-efi
-> linux bash shadow f2fs-tools dosfstools dbus NetworkManager iana-etc iw wpa_supplicant util-linux which tar man-pages iproute2 iputils wifi-firmware traceroute grep gzip file sed gawk less coreutils findutils diffutils pciutils usbutils tzdata base-files ncurses mdocml procps-ng kbd xbps sudo ethtool kmod eudev runit-void removed-packages nano acpid squashfs-tools
-> configure XBPS mirror
-> configure sudo
-> drop a file with "%wheel ALL=(ALL:ALL) ALL" in /etc/sudoers.d/sudo_group
@ -80,18 +68,10 @@ Steps to install:
-> selection dialog?
-> symlink /etc/localtime
-> configure host name
-> install and configure bootloader
-> install GRUB for i386-pc, i386-efi, x86_64-efi
-> --removable and --no-nvram for EFI
-> --boot-directory set to /boot/loader to prevent grub-mkconfig kernel hook from running
-> state as much in a text file in there
-> add kernel hooks
-> script to run /opt/void-usb/grub-config
-> a script that updates vmlinu{z,x} and initramfs.img symlinks
-> add symlinks for newly installed kernel
-> guess best choice when removing the currently symlinked kernel
-> ask whether to run vkpurge if disk space is low
-> download grub-config and its resources and drop them in /opt/void-usb
-> configure and install bootloader
-> if x86 install for both UEFI and BIOS
-> Is there a way we can make this work with 32-bit AND 64-bit EFI at the same time?
-> if ARM install only UEFI
-> xbps-reconfigure -fa
-> prepare 2nd stage installation
-> auto login root
@ -114,7 +94,6 @@ Steps to install:
-> pipewire (pulsemixer?)
-> ask about nvidia driver
-> install if needed
-> find out when and where to set `nvidia-drm.modeset=1`
-> ask whether to use CTWM or IceWM
-> short description of up and downsides
-> if CTWM, also install