Compare commits
5 Commits
c8ce034f93
...
f67c214ba7
Author | SHA1 | Date |
---|---|---|
BodgeMaster | f67c214ba7 | |
BodgeMaster | 55f814c1e2 | |
BodgeMaster | 0b4533c0dd | |
BodgeMaster | 7ad70c5d07 | |
BodgeMaster | 6365e3c22a |
27
README.md
27
README.md
|
@ -1,5 +1,15 @@
|
|||
# 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).
|
||||
|
@ -48,15 +58,18 @@ The scripts will take it from there, asking you for information and downloading
|
|||
|
||||
## 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
|
||||
|
||||
- `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
|
||||
- `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
|
||||
- `opt/`: contains files to be installed in /opt/void-usb/
|
||||
- `grub-config`: custom grub config generator (probably not necessary but at this point I don’t 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
|
||||
|
|
|
@ -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
|
||||
|
||||
# TODO: add overlayfs scripts (bootup and shutdown)
|
||||
# TODO: add overlayfs scripts (bootup)
|
||||
|
||||
|
||||
mkdir -p /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
|
||||
|
||||
# no idea if any of these are even necessary/relevant but it can’t 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-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'"
|
||||
|
|
|
@ -5,6 +5,15 @@ need xdg menu maker?
|
|||
check if there are problems with GRUB’s --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
|
||||
|
@ -23,6 +32,16 @@ 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
|
||||
|
@ -31,73 +50,23 @@ when backing up
|
|||
- consolidate when the user requests it or when exceeding the limit
|
||||
|
||||
Steps to install:
|
||||
- (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
|
||||
- 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 it’s 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 fstab
|
||||
-> /boot, /boot/efi
|
||||
-> /home (bind mount)
|
||||
-> NOT /, /container
|
||||
-> configure rc.conf
|
||||
-> keyboard layout
|
||||
-> hardware clock set to UTC?
|
||||
-> configure time zone while we’re at it
|
||||
-> configure time zone
|
||||
-> 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
|
||||
-> xbps-reconfigure -fa
|
||||
-> set up an initramfs to mount the squashfs/overlayfs at boot time
|
||||
-> prepare 2nd stage installation
|
||||
-> auto login root
|
||||
-> put script in .bashrc
|
||||
-> auto login root and put script in .bashrc
|
||||
-> better method?
|
||||
-> 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
|
|
@ -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
|
|
@ -0,0 +1 @@
|
|||
TODO
|
|
@ -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
|
Loading…
Reference in New Issue