Compare commits

..

No commits in common. "f67c214ba7c11b12f0c448544f4c92fabf3212fc" and "c8ce034f93a6ece9e2b45b0f6b7f4ac7f3622340" have entirely different histories.

9 changed files with 64 additions and 133 deletions

View File

@ -1,15 +1,5 @@
# Void Linux Setup for USB Sticks
```
_________________________
.*¯ _ _ __ ___ /|_______
/ | |//,·¯¯*. / // _ \ // // /|
| | '// ( ) ;/ // // / // _¯ ///
| |_/ '.__.*/_//___.* // // ///
\*·…_____________________/://
*·…_____________________|;'*
```
This repository holds scripts for installing a Void Linux setup specialized to run off a USB stick.
This is only for USB sticks (thumb drives, pen drives, whatever you wanna call them).
@ -58,18 +48,15 @@ The scripts will take it from there, asking you for information and downloading
## How It Works
`//TODO:` Add detailed documentation of how the thing works, changes to the boot up process, and whatever other scripts are in here
`//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/`: contains files to be installed in /opt/void-usb/
- `grub-config`: custom grub config generator (probably not necessary but at this point I dont wanna dig into the default one)
- `backup-fs`: helper script to rebuild the squashfs
- `kernel.d/`: kernel hooks to be installed in /etc/kernel.d
- `skel/`: files to be added to /etc/skel
- `bashrc`: my custom .bashrc
- `user-readme.txt`: will be displayed on first login
- `xinitrc`: what dis look like?
- `notes_to_self.txt`: will disappear once finished
- `opt/grub-config`: the custom grub config generator to be installed in /opt/void-usb
- `opt/backup-fs`: helper script to regenerate the squashfs
- `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

0
bashrc Normal file
View File

View File

@ -183,8 +183,7 @@ echo "repository=$TARGET_MIRROR" > /mnt/target/etc/xbps.d/00-repository-main.con
echo "%wheel ALL=(ALL:ALL) ALL" > /mnt/target/etc/sudoers.d/wheel_as_sudo_group.conf
# TODO: add overlayfs scripts (bootup)
# TODO: add overlayfs scripts (bootup and shutdown)
mkdir -p /mnt/target/opt/void-usb
chmod 755 /mnt/target/opt/void-usb
@ -283,7 +282,7 @@ 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 ahci ata pata"
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

@ -5,15 +5,6 @@ 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
test kernel hooks and grub-config with all sorts of weird kernel/initramfs setups
- all names
- various compressions
do not rely on the RTC
- change the message when configuring UTC/localtime to reflect that this is only for offline usage
- use ntp to get time
- only fall back to using rtc if offline
- do not set the RTC
move /boot to /container
musl downsides:
- no nvidia drivers
@ -32,16 +23,6 @@ system lives on squashfs
swap on zram
f2fs for home
boot setup + dracut configuration
- root=/dev/loop0 ro
- custom dracut modules
- udev rule for /dev/loop0
- pre-mount script
- mount /container by UUID (possibly passed from a kernel command line parameter)
- losetup the squashfs img
- do we need one to move over the /container mount to real root?
- overlayfs gets mounted from fstab
when backing up
- do not cross file system boundaries
- exclude /tmp, package cache, logs
@ -50,23 +31,73 @@ when backing up
- consolidate when the user requests it or when exceeding the limit
Steps to install:
- make our own or extract (if feasible) kb selection and time zone selection to hijack them for our purposes
- (user does this:) boot Void installer
-> log in as root
-> connect to the internet
-> download and run install script
- preparations:
-> update xbps
-> install xmirror squashfs-tools
-> make our own or extract (if feasible) kb selection and time zone selection to hijack them for our purposes
- select kb layout
- set up disk
-> select disk from a list
-> warn user about formatting and making the USB stick unusable with Windows
-> allow user to double check that its the USB drive
-> wipe and partition disk (new gpt)
-> 2M BIOS GRUB
-> 268M ESP
-> 1G /boot
-> rest /container
-> format partitions
-> ESP FAT32
-> /boot and /container F2FS
- mount them things
-> set up plain tmpfs as / for now
- install base system
-> select mirror
-> just use xmirror and get the result from the file
-> if musl repo, remove that bit from repo url
-> 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
-> configure XBPS mirror
-> configure sudo
-> drop a file with "%wheel ALL=(ALL:ALL) ALL" in /etc/sudoers.d/sudo_group
-> configure overlayfs setup
-> startup script
-> shutdown squashfs updater
-> rc.shutdown?
-> configure time zone
-> configure fstab
-> /boot, /boot/efi
-> /home (bind mount)
-> NOT /, /container
-> configure rc.conf
-> keyboard layout
-> hardware clock set to UTC?
-> configure time zone while were at it
-> selection dialog?
-> symlink /etc/localtime
-> set up an initramfs to mount the squashfs/overlayfs at boot time
-> 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
-> xbps-reconfigure -fa
-> prepare 2nd stage installation
-> auto login root and put script in .bashrc
-> better method?
-> auto login root
-> put script in .bashrc
-> build squashfs
-> (if needed) set up an initramfs with busybox to mount the squashfs/overlayfs at boot time
- prompt user to reboot to finish installation
- second stage installation
-> configure services

View File

@ -1,83 +0,0 @@
# ALWAYS RUN
# ==========
# things to always set up, even for non-interactive shells
# Fuck vi!
EDITOR=nano
# On FreeBSD this is being set for whatever reason in the other shell rc files. I'll leave it here for compatibility.
PAGER=less
# add a user-specific bin directory to PATH
PATH=$HOME/.local/bin:$PATH
export EDITOR PAGER PATH
# CHECK INTERACTIVE
# =================
# Don't do anything after this if not running an interactive shell.
case $- in
*i*) ;;
*) return ;;
esac
# ALIASES
# =======
alias aliases="nano $HOME/.bashrc_aliases && source $HOME/.bashrc_aliases"
[ -f $HOME/.bashrc_aliases ] && source $HOME/.bashrc_aliases
# BASH COMPLETION
# ===============
# include bash completions if they exist
# (may need to be adjusted to where the bash completions are stored on the current system)
# Default for FreeBSD:
if [ -f /usr/local/share/bash-completion/bash_completion.sh ]; then
source /usr/local/share/bash-completion/bash_completion.sh
# Default for Linux:
elif [ -f /usr/share/bash-completion/bash_completion ]; then
source /usr/share/bash-completion/bash_completion
fi
# VARIABLES
# =========
# don't put duplicate lines or lines starting with a space in history
HISTCONTROL=ingnoreboth
# unlimited history
HISTSIZE=-1
HISTFILESIZE=-1
# set a fancy prompt
PROMPT_COMMAND="PS1=\"[\[\e[03$(
if [ $EUID -eq 0 ]
then
echo -n '1;02m'
else
if [ -n "$(groups | grep 'wheel\|sudo')" ];
then
echo -n '2;01m'
else
echo -n '6;01m'
fi
fi
)\]\u@\h\[\e[0m\]]:\$(
PROMPT_ERRORLEVEL=\$?
if [ \$PROMPT_ERRORLEVEL -eq 0 ]
then
echo -n '\[\e[032;02m\]'
else
echo -n '\[\e[031;02m\]'
fi
echo -n \$PROMPT_ERRORLEVEL
echo -n '\[\e[00m\]'
):\[\e[034;01m\]\$(pwd)\[\e[0m\]:$(
if [ $EUID -eq 0 ]
then
echo -n '\[\e[02m\]#\[\e[0m\]'
else
echo -n '\[\e[02m\]$\[\e[0m\]'
fi
)> \""
# SHELL OPTIONS
# =============
shopt -s histappend
shopt -s checkwinsize
shopt -s globstar

View File

@ -1 +0,0 @@
TODO

View File

@ -1,2 +0,0 @@
#TODO: open user-readme once and then never again
#TODO: check which software selection of Void-USB has been installed and start the appropriate things

0
update-squashfs.sh Normal file
View File

0
user-readme.txt Normal file
View File