Compare commits

..

5 Commits

Author SHA1 Message Date
BodgeMaster f67c214ba7 skel: move skel files to this directory 2023-06-27 15:47:38 +02:00
BodgeMaster 55f814c1e2 update-squashfs: remove useless redundant script 2023-06-27 15:46:34 +02:00
BodgeMaster 0b4533c0dd readme: update documentation 2023-06-27 15:44:54 +02:00
BodgeMaster 7ad70c5d07 notes to self: update notes and use a more sensible file name 2023-06-27 15:41:16 +02:00
BodgeMaster 6365e3c22a install stage 1: add more GRUB modules to be loaded by default
no idea if this is even useful
2023-06-27 15:38:24 +02:00
9 changed files with 133 additions and 64 deletions

View File

@ -1,5 +1,15 @@
# Void Linux Setup for USB Sticks # Void Linux Setup for USB Sticks
```
_________________________
.*¯ _ _ __ ___ /|_______
/ | |//,·¯¯*. / // _ \ // // /|
| | '// ( ) ;/ // // / // _¯ ///
| |_/ '.__.*/_//___.* // // ///
\*·…_____________________/://
*·…_____________________|;'*
```
This repository holds scripts for installing a Void Linux setup specialized to run off a USB stick. 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). This is only for USB sticks (thumb drives, pen drives, whatever you wanna call them).
@ -48,15 +58,18 @@ The scripts will take it from there, asking you for information and downloading
## How It Works ## How It Works
`//TODO:` Add detailed documentation `//TODO:` Add detailed documentation of how the thing works, changes to the boot up process, and whatever other scripts are in here
## Files ## Files
- `install-stage1.sh`: sets up the base system and prepares for installation stage 2 - `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 - `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 - `opt/`: contains files to be installed in /opt/void-usb/
- `opt/backup-fs`: helper script to regenerate the squashfs - `grub-config`: custom grub config generator (probably not necessary but at this point I dont wanna dig into the default one)
- `procedure.txt`: notes to self, will disappear once finished - `backup-fs`: helper script to rebuild the squashfs
- `bootup.sh`: script that sets up the overlay - `kernel.d/`: kernel hooks to be installed in /etc/kernel.d
- `bashrc`: just a custom bashrc - `skel/`: files to be added to /etc/skel
- `update-squashfs.sh`: runs at shutdown, allows user to back up the system - `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

0
bashrc
View File

View File

@ -183,7 +183,8 @@ 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 echo "%wheel ALL=(ALL:ALL) ALL" > /mnt/target/etc/sudoers.d/wheel_as_sudo_group.conf
# TODO: add overlayfs scripts (bootup and shutdown) # TODO: add overlayfs scripts (bootup)
mkdir -p /mnt/target/opt/void-usb mkdir -p /mnt/target/opt/void-usb
chmod 755 /mnt/target/opt/void-usb chmod 755 /mnt/target/opt/void-usb
@ -282,7 +283,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 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... # 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" TARGET_PRELOAD_GRUB_MODULES="usb usbms uhci ehci ohci part_gpt f2fs ahci ata pata"
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-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=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'" 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,6 +5,15 @@ need xdg menu maker?
check if there are problems with GRUBs --disk-module=native on real USB drives on real hardware 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 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 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: musl downsides:
- no nvidia drivers - no nvidia drivers
@ -23,6 +32,16 @@ system lives on squashfs
swap on zram swap on zram
f2fs for home 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 when backing up
- do not cross file system boundaries - do not cross file system boundaries
- exclude /tmp, package cache, logs - exclude /tmp, package cache, logs
@ -31,73 +50,23 @@ when backing up
- consolidate when the user requests it or when exceeding the limit - consolidate when the user requests it or when exceeding the limit
Steps to install: Steps to install:
- (user does this:) boot Void installer - make our own or extract (if feasible) kb selection and time zone selection to hijack them for our purposes
-> 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 - 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 - 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) -> select installation type (x86_32/x86_64/aarch64, glibc/musl)
-> if musl, add that bit to repo url -> 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 -> configure overlayfs setup
-> startup script -> startup script
-> shutdown squashfs updater -> shutdown squashfs updater
-> rc.shutdown? -> rc.shutdown?
-> configure fstab -> configure time zone
-> /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? -> selection dialog?
-> symlink /etc/localtime -> symlink /etc/localtime
-> configure host name -> set up an initramfs to mount the squashfs/overlayfs at boot time
-> 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 -> prepare 2nd stage installation
-> auto login root -> auto login root and put script in .bashrc
-> put script in .bashrc -> better method?
-> build squashfs -> 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 - prompt user to reboot to finish installation
- second stage installation - second stage installation
-> configure services -> configure services

83
skel/bashrc Normal file
View File

@ -0,0 +1,83 @@
# 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

1
skel/user-readme.txt Normal file
View File

@ -0,0 +1 @@
TODO

2
skel/xinitrc Normal file
View File

@ -0,0 +1,2 @@
#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

View File

View File