Compare commits

...

29 Commits

Author SHA1 Message Date
BodgeMaster 9930dabd09 install stage 1, opt/grub-config, custom-scripts/icewm_bodgemaster_env: temporarily change to US keymap 2026-04-09 16:46:14 +02:00
BodgeMaster 6f47e6ee19 install stage 2: add more user groups 2026-04-09 16:22:55 +02:00
BodgeMaster 466f67ac4c install stage 1: disable grub native disk drivers as it hurts more than it helps 2026-04-06 14:02:12 +02:00
BodgeMaster eaeed6bd90 install stage 1: fix fstab generator 2026-04-06 02:15:23 +02:00
BodgeMaster 1ac7006dfa opt/grub-config: fix LUKS container detection 2026-04-06 01:30:19 +02:00
BodgeMaster 86a7cc1d60 install stage 1: forgot formatting LUKS container 2026-04-06 01:29:06 +02:00
BodgeMaster 4b2749b2a5 install stage 1: make device mapper name match with the one after boot 2026-04-05 21:43:23 +02:00
BodgeMaster e89138b2b7 install stage 1, opt/grub-config.sh: initial implementation of encryption support
I'll be very surprised if this contains no bugs.
2026-04-05 21:27:59 +02:00
BodgeMaster 5fb752518e kernel.d/pre-install/99-void-usb: fix syntax error 2026-04-05 21:24:11 +02:00
BodgeMaster e36ab97582 kernel.d/post-install/99-void-usb: simplify link replacement 2026-04-05 21:23:35 +02:00
BodgeMaster 76479e11fd custom-scripts/icewm_bodgemaster_env.sh: add bashrc to root 2026-04-05 21:22:32 +02:00
BodgeMaster a94eea39fc opt/grub-config: hartd-code keymap (fixme) 2026-04-03 18:32:46 +02:00
BodgeMaster 197f9c59a1 custom-scripts/icewm_bodgemaster_env.sh: add qView image viewer 2026-03-30 03:33:19 +02:00
BodgeMaster c35f412cf4 install stage 1: add timezone picker, set SEEDRNG_SKIP_CREDIT 2026-03-30 03:31:20 +02:00
BodgeMaster faa381effb custom-scripts/icewm_bodgemaster_env.sh: fix wallpapers 2026-03-27 11:50:10 +01:00
BodgeMaster c4881f49ff opt/system-image: fix an issue where the prompt might not be displayed sometimes 2026-03-27 02:39:05 +01:00
BodgeMaster 30beeec37a custom-scripts/icewm_bodgemaster_env.sh: bug fixes, continue working on it 2026-03-27 02:37:45 +01:00
BodgeMaster 79bbdb5f94 custom-scripts/icewm_bodgemaster_env.sh: Add new (unfinished) script 2026-03-26 23:50:14 +01:00
BodgeMaster d290fffa70 install stage 2: add user to useful groups for desktop use by default
This is intended as a desktop system anyway
2026-03-26 23:39:20 +01:00
BodgeMaster 86fe8387bb install stage 1: add an error check on installing base system 2026-03-22 04:58:24 +01:00
BodgeMaster ed95da5244 install stage 1: apply learnings from Gentoo (chroot mounting) and hopefully fix musl support 2026-03-22 04:51:49 +01:00
BodgeMaster 8b98b2e160 system-image: check that the mksquashfs command actually succeeded before overwriting the old image 2026-03-22 04:34:08 +01:00
BodgeMaster a84cb829dd install stage 2: fix removing first-boot config of tty1 2026-03-22 03:22:20 +01:00
BodgeMaster ae2a5f94e3 README: fix URL 2026-03-22 03:21:28 +01:00
BodgeMaster f1ee7c85dd Cleanup (see long commit message)
Here we go, a kitchen sink commit (with a singular focus tho)
(Yes, I am coping lol)
- update repo URL
- update TODOs, remove obsolete ones, add new ones
- remove comments that just say the following line(s) of code in words
- minor UI changes:
  - tell user to enter a number for TARGET_TYPE
  - tell the user to create a new system image at the end of installation
  - use : instead of ) in some places to make code like `$((i+1)):` more readable
- fix some particularly crunchy commands
  - remove entirely redundant condition checking if the input of an integer operation is (fail = false)
  - when installing a musl target, auto-determine CPU arch from target
  - while getting names and descriptions of customization scripts, only use POSIX grep - we might be on musl...
  - don't kill the installer when the user selects exit or enters garbage at custom-scripts selection
- remove unused variable $SCRIPT_LIST
- reboot rather than launching into a debug shell at the end of installation
2025-03-02 06:42:29 +01:00
Joca 34d6e1674c Add the ability to choose between different architectures 2025-03-02 04:55:29 +01:00
Joca 3f10d03ad5 install stage 2: finish system setup
- allow the user to add a user
- remove installation files

This commit was originally part of a larger _kitchen sink mix commit_
2025-02-18 04:19:27 +01:00
Joca 517ac34e3d custom-scripts: add customization scripts infrastructure
This commit has been created from multiple commits on Joca’s branch
and additional edits

Co-authored-by: BodgeMaster <>
2025-02-18 04:12:39 +01:00
Joca 2cc32fe645 Remove Package Selections, removed non-ascii characters 2025-02-18 02:19:52 +01:00
30 changed files with 5853 additions and 525 deletions

View File

@ -55,7 +55,7 @@ There are a couple manual steps to get started before the installer scripts can
- Download and run stage 1 of the USB installation script - 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` - 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` - `wget https://lostcave.ddnss.de/git/BodgeMaster/void-usb/raw/branch/master/install-stage1.sh`
- `bash install-stage1.sh` - `bash install-stage1.sh`
The scripts will take it from there, asking you for information and downloading things as needed. The scripts will take it from there, asking you for information and downloading things as needed.

19
custom-scripts/README.md Normal file
View File

@ -0,0 +1,19 @@
### Configuration Scripts
Use this to Deploy rices/set up services/etc.
Each configuration script should follow this structure:
```bash
#!/usr/bin/env bash
# NAME: Your Script Name
# DESC: A brief description of what the script does.
# Your script logic here
```
If `# NAME:` is not found, install stage 2 will fall back to displaying the script's filename.
If `# DESC:` is not found, "No description available." will be displayed instead.
Place the scripts under this folder, add the filename to `scripts.lst` (separate by newline) and they will show up in the installer.

12
custom-scripts/i3wm.sh Normal file
View File

@ -0,0 +1,12 @@
#!/bin/bash
# NAME: Install i3wm
# DESC: This script installs i3wm and basic utilities.
echo "Updating Void"
xbps-install -Suv
xbps-install -S
echo -e "Installing i3wm"
xbps-install -S xinit xorg base-devel i3 i3status i3-gaps termite

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,2 @@
i3wm.sh
icewm_bodgemaster_env.sh

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
LOGFILE=/tmp/void-usb-install-log LOGFILE=/tmp/void-usb-install-log
GIT_REPO_BASE="https://lostcave.ddnss.de/git/BodgeMaster/void-minecraft-usb/raw/branch/master" GIT_REPO_BASE="https://lostcave.ddnss.de/git/BodgeMaster/void-usb/raw/branch/master"
function press_any_key { function press_any_key {
echo "Press any key to continue or Ctrl+c to abort..." echo "Press any key to continue or Ctrl+c to abort..."
@ -62,7 +62,7 @@ fi
echo " echo "
This script will now download and install Void Linux on your USB stick. This script will now download and install Void Linux on your USB stick.
Any data that is currently on the stick will be lost and it wont be Any data that is currently on the stick will be lost and it won't be
usable from Windows or MacOS. usable from Windows or MacOS.
Before we begin, the following packages need to be installed (if not installed already): Before we begin, the following packages need to be installed (if not installed already):
@ -78,10 +78,8 @@ echo -n "Installing xmirror, squashfs-tools, wget... "
xbps-install --yes xmirror wget >> $LOGFILE 2>&1 xbps-install --yes xmirror wget >> $LOGFILE 2>&1
echo "done" echo "done"
#TODO: If going down the path of extracting routines from void-installer, that should be done here #TODO: Select keyboard layout by showing lists of what's present (directories for region, then files within)
KBD_LAYOUT="us"
#TODO: Select keyboard layout
KBD_LAYOUT="de-latin1"
clear clear
echo "Select the USB stick to install to (NAME column below)... echo "Select the USB stick to install to (NAME column below)...
@ -133,70 +131,168 @@ if grep "$TARGET_DISK" /proc/mounts >> $LOGFILE 2>&1; then
fi fi
fi fi
echo -n "Wiping and partitioning storage... " echo "
# new GPT Do you want to encrypt your files?
# 2M BIOS GRUB
# 66592 sectors ESP (first sector + 66591 sectors, the minimum to format FAT32 with default settings) With the exception of the files essential for booting, the system will be encrypted.
# everything else one big partition This will use an additional 1Gib of storage space.
echo "g
n If you enable encryption, you will be prompted for a passphrase. This passphrase will be
asked separately during bootup and may be different from the user login.
"
if yesno; then
ADD_CRYPTSETUP="cryptsetup"
echo -n "Wiping and partitioning storage... "
# new GPT
# 2M BIOS GRUB
# 66592 sectors ESP (first sector + 66591 sectors, the minimum to format FAT32 with default settings)
# everything else one big partition
echo "g
n
+2M +2M
n n
+66591 +66591
n n
+1G
n
t t
1 1
4 4
t t
2 2
1 1
t t
3 3
20 142
w" | fdisk --wipe always --wipe-partitions always "/dev/$TARGET_DISK" >> $LOGFILE 2>&1 t
TARGET_PART_BIOS="$(lsblk --raw --noheadings --output PATH "/dev/$TARGET_DISK" | sed -n '2p')" 4
TARGET_PART_EFI="$(lsblk --raw --noheadings --output PATH "/dev/$TARGET_DISK" | sed -n '3p')" 20
TARGET_PART_BIG="$(lsblk --raw --noheadings --output PATH "/dev/$TARGET_DISK" | sed -n '4p')" w" | fdisk --wipe always --wipe-partitions always "/dev/$TARGET_DISK" >> $LOGFILE 2>&1
echo "done" TARGET_PART_BIOS="$(lsblk --raw --noheadings --output PATH "/dev/$TARGET_DISK" | sed -n '2p')"
TARGET_PART_EFI="$(lsblk --raw --noheadings --output PATH "/dev/$TARGET_DISK" | sed -n '3p')"
TARGET_PART_BOOT="$(lsblk --raw --noheadings --output PATH "/dev/$TARGET_DISK" | sed -n '4p')"
TARGET_PART_BIG="$(lsblk --raw --noheadings --output PATH "/dev/$TARGET_DISK" | sed -n '5p')"
echo "done"
echo -n "Formatting partitions... " echo -n "Formatting partitions... "
mkfs.vfat -F32 -n "EFIBOOT" "$TARGET_PART_EFI" >> $LOGFILE 2>&1 mkfs.vfat -F32 -n "EFIBOOT" "$TARGET_PART_EFI" >> $LOGFILE 2>&1
mkfs.f2fs -f -l "container" "$TARGET_PART_BIG" >> $LOGFILE 2>&1 mkfs.f2fs -f -l "boot" "$TARGET_PART_BOOT" >> $LOGFILE 2>&1
echo "done" echo "Setting up encryption. You will be asked for the same password twice."
cryptsetup luksFormat --batch-mode --type luks2 --force-password "$TARGET_PART_BIG"
DEV_MAPPER_NAME="luks-$(blkid --output value --match-tag UUID "$TARGET_PART_BIG")"
cryptsetup luksOpen --batch-mode --type luks2 "$TARGET_PART_BIG" "$DEV_MAPPER_NAME"
if [ "$?" -gt 0 ]; then
echo "Failed to open encrypted container. The entered passwords probably didn't match."
exit 1
fi
mkfs.f2fs -f -l "container" /dev/mapper/"$DEV_MAPPER_NAME" >> $LOGFILE 2>&1
echo "done"
echo -n "Mounting partitions and virtual file systems... " echo -n "Mounting partitions and virtual file systems... "
mkdir -p /mnt/target >> $LOGFILE 2>&1 mkdir -p /mnt/target >> $LOGFILE 2>&1
mount -t tmpfs -o size=3g,mode=755 tmpfs /mnt/target >> $LOGFILE 2>&1 mount -t tmpfs -o size=3g,mode=755 tmpfs /mnt/target >> $LOGFILE 2>&1
# used for chroot later # used for chroot later
mkdir /mnt/target/run >> $LOGFILE 2>&1 mkdir /mnt/target/run >> $LOGFILE 2>&1
mount --rbind /run /mnt/target/run >> $LOGFILE 2>&1 mount -t tmpfs none /mnt/target/run >> $LOGFILE 2>&1
mkdir /mnt/target/proc >> $LOGFILE 2>&1 mkdir /mnt/target/proc >> $LOGFILE 2>&1
mount --rbind /proc /mnt/target/proc >> $LOGFILE 2>&1 mount -t proc proc /mnt/target/proc >> $LOGFILE 2>&1
mkdir /mnt/target/sys >> $LOGFILE 2>&1 mkdir /mnt/target/sys >> $LOGFILE 2>&1
mount --rbind /sys /mnt/target/sys >> $LOGFILE 2>&1 mount --rbind /sys /mnt/target/sys >> $LOGFILE 2>&1
mkdir /mnt/target/dev >> $LOGFILE 2>&1 mount --make-rslave /mnt/target/sys >> $LOGFILE 2>&1
mount --rbind /dev /mnt/target/dev >> $LOGFILE 2>&1 mkdir /mnt/target/dev >> $LOGFILE 2>&1
mount --rbind /dev /mnt/target/dev >> $LOGFILE 2>&1
mount --make-rslave /mnt/target/dev >> $LOGFILE 2>&1
# actual storage # actual storage
mkdir -p /mnt/target/run/void-usb/container >> $LOGFILE 2>&1 mkdir -p /mnt/target/run/void-usb/container >> $LOGFILE 2>&1
mount "$TARGET_PART_BIG" /mnt/target/run/void-usb/container >> $LOGFILE 2>&1 mount /dev/mapper/"$DEV_MAPPER_NAME" /mnt/target/run/void-usb/container >> $LOGFILE 2>&1
mkdir /mnt/target/boot >> $LOGFILE 2>&1 mkdir /mnt/target/boot >> $LOGFILE 2>&1
mkdir /mnt/target/run/void-usb/container/boot >> $LOGFILE 2>&1 mount "$TARGET_PART_BOOT" /mnt/target/boot
mount --bind /mnt/target/run/void-usb/container/boot /mnt/target/boot >> $LOGFILE 2>&1 mkdir /mnt/target/boot/efi >> $LOGFILE 2>&1
mkdir /mnt/target/boot/efi >> $LOGFILE 2>&1 mount "$TARGET_PART_EFI" /mnt/target/boot/efi >> $LOGFILE 2>&1
mount "$TARGET_PART_EFI" /mnt/target/boot/efi >> $LOGFILE 2>&1 mkdir /mnt/target/home >> $LOGFILE 2>&1
mkdir /mnt/target/home >> $LOGFILE 2>&1 mkdir /mnt/target/run/void-usb/container/home >> $LOGFILE 2>&1
mkdir /mnt/target/run/void-usb/container/home >> $LOGFILE 2>&1 mount --bind /mnt/target/run/void-usb/container/home /mnt/target/home >> $LOGFILE 2>&1
mount --bind /mnt/target/run/void-usb/container/home /mnt/target/home >> $LOGFILE 2>&1 echo "done"
echo "done" else
echo -n "Wiping and partitioning storage... "
# new GPT
# 2M BIOS GRUB
# 66592 sectors ESP (first sector + 66591 sectors, the minimum to format FAT32 with default settings)
# everything else one big partition
echo "g
n
+2M
n
+66591
n
t
1
4
t
2
1
t
3
20
w" | fdisk --wipe always --wipe-partitions always "/dev/$TARGET_DISK" >> $LOGFILE 2>&1
TARGET_PART_BIOS="$(lsblk --raw --noheadings --output PATH "/dev/$TARGET_DISK" | sed -n '2p')"
TARGET_PART_EFI="$(lsblk --raw --noheadings --output PATH "/dev/$TARGET_DISK" | sed -n '3p')"
TARGET_PART_BIG="$(lsblk --raw --noheadings --output PATH "/dev/$TARGET_DISK" | sed -n '4p')"
echo "done"
echo -n "Formatting partitions... "
mkfs.vfat -F32 -n "EFIBOOT" "$TARGET_PART_EFI" >> $LOGFILE 2>&1
mkfs.f2fs -f -l "container" "$TARGET_PART_BIG" >> $LOGFILE 2>&1
echo "done"
echo -n "Mounting partitions and virtual file systems... "
mkdir -p /mnt/target >> $LOGFILE 2>&1
mount -t tmpfs -o size=3g,mode=755 tmpfs /mnt/target >> $LOGFILE 2>&1
# used for chroot later
mkdir /mnt/target/run >> $LOGFILE 2>&1
mount -t tmpfs none /mnt/target/run >> $LOGFILE 2>&1
mkdir /mnt/target/proc >> $LOGFILE 2>&1
mount -t proc proc /mnt/target/proc >> $LOGFILE 2>&1
mkdir /mnt/target/sys >> $LOGFILE 2>&1
mount --rbind /sys /mnt/target/sys >> $LOGFILE 2>&1
mount --make-rslave /mnt/target/sys >> $LOGFILE 2>&1
mkdir /mnt/target/dev >> $LOGFILE 2>&1
mount --rbind /dev /mnt/target/dev >> $LOGFILE 2>&1
mount --make-rslave /mnt/target/dev >> $LOGFILE 2>&1
# actual storage
mkdir -p /mnt/target/run/void-usb/container >> $LOGFILE 2>&1
mount "$TARGET_PART_BIG" /mnt/target/run/void-usb/container >> $LOGFILE 2>&1
mkdir /mnt/target/boot >> $LOGFILE 2>&1
mkdir /mnt/target/run/void-usb/container/boot >> $LOGFILE 2>&1
mount --bind /mnt/target/run/void-usb/container/boot /mnt/target/boot >> $LOGFILE 2>&1
mkdir /mnt/target/boot/efi >> $LOGFILE 2>&1
mount "$TARGET_PART_EFI" /mnt/target/boot/efi >> $LOGFILE 2>&1
mkdir /mnt/target/home >> $LOGFILE 2>&1
mkdir /mnt/target/run/void-usb/container/home >> $LOGFILE 2>&1
mount --bind /mnt/target/run/void-usb/container/home /mnt/target/home >> $LOGFILE 2>&1
echo "done"
fi
clear clear
echo "Storage is now prepared and ready for installation. echo "Storage is now prepared and ready for installation.
@ -207,15 +303,32 @@ the chosen mirror from the config file it generates.
" "
press_any_key press_any_key
xmirror xmirror
#TODO: also remove CPU architecture
TARGET_MIRROR="$(sed 's/repository=//;s|/musl$||' /etc/xbps.d/00-repository-main.conf)" TARGET_MIRROR="$(sed 's/repository=//;s|/musl$||' /etc/xbps.d/00-repository-main.conf)"
#TODO: select installation type
TARGET_TYPE="x86_64"
#TODO: also add CPU architecture #TODO: allow only 32 bit on a 32 bit system
options=("x86_64" "x86_64-musl" "x86_32")
while true; do
echo "Select your desired architecture."
for i in "${!options[@]}"; do
echo "$((i+1)): ${options[$i]}"
done
read -p "Input your choice (number): " choice
if [ "$choice" -ge 1 ] && [ "$choice" -le "${#options[@]}" ]; then
TARGET_TYPE="${options[$((choice-1))]}"
break
else
echo "Selection invalid."
fi
done
echo "You selected: $TARGET_TYPE"
if grep "musl" <<< "$TARGET_TYPE"; then if grep "musl" <<< "$TARGET_TYPE"; then
TARGET_MIRROR="$TARGET_MIRROR/musl" TARGET_MIRROR="$TARGET_MIRROR/musl"
TARGET_TYPE="$(sed -e 's/ musl//' <<< "$TARGET_TYPE")"
fi fi
echo -n "Copying repository keys... " echo -n "Copying repository keys... "
@ -235,7 +348,12 @@ XBPS_ARCH="$TARGET_TYPE" xbps-install --yes --sync --rootdir /mnt/target --repos
wifi-firmware traceroute grep gzip file sed gawk less coreutils findutils \ wifi-firmware traceroute grep gzip file sed gawk less coreutils findutils \
diffutils pciutils usbutils tzdata base-files ncurses mdocml procps-ng \ diffutils pciutils usbutils tzdata base-files ncurses mdocml procps-ng \
kbd xbps sudo ethtool kmod eudev runit-void removed-packages nano acpid \ kbd xbps sudo ethtool kmod eudev runit-void removed-packages nano acpid \
squashfs-tools grub grub-i386-efi grub-x86_64-efi dracut xz 2>&1 | tee --append $LOGFILE squashfs-tools grub grub-i386-efi grub-x86_64-efi dracut xz $ADD_CRYPTSETUP 2>&1 | tee --append $LOGFILE
if [ "$?" -ne 0 ]; then
echo ""
echo "An error occurred while trying to install the base system."
exit 1
fi
echo "" echo ""
echo "Adding mirror configuration." echo "Adding mirror configuration."
@ -278,15 +396,27 @@ echo "
echo "done" echo "done"
echo "Adding fstab." echo "Adding fstab."
echo "# See fstab(5). if [ -n "$TARGET_PART_BOOT" ]; then
# <device> <mount point> <fstype> <options> <dump> <pass> echo "# See fstab(5).
# <device> <mount point> <fstype> <options> <dump> <pass>
# /run/void-usb/container, /run/void-usb/overlay, and / are mounted by scripts in initramfs # /run/void-usb/container, /run/void-usb/overlay, and / are mounted by scripts in initramfs
/run/void-usb/container/boot /boot none bind 0 0 UUID=$(blkid --output value --match-tag UUID $TARGET_PART_BOOT) /boot f2fs nodev,nosuid,noexec 0 2
/run/void-usb/container/home /home none bind 0 0 /run/void-usb/container/home /home none bind 0 0
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 nodev,nosuid,noexec,umask=133,dmask=022 0 2
" > /mnt/target/etc/fstab " > /mnt/target/etc/fstab
else
echo "# See fstab(5).
# <device> <mount point> <fstype> <options> <dump> <pass>
# /run/void-usb/container, /run/void-usb/overlay, and / are mounted by scripts in initramfs
/run/void-usb/container/boot /boot none bind 0 0
/run/void-usb/container/home /home none bind 0 0
UUID=$(blkid --output value --match-tag UUID $TARGET_PART_EFI) /boot/efi vfat nodev,nosuid,noexec,umask=133,dmask=022 0 2
" > /mnt/target/etc/fstab
fi
echo "Configuring keyboard layout." echo "Configuring keyboard layout."
if grep "#KEYMAP=" /mnt/target/etc/rc.conf; then if grep "#KEYMAP=" /mnt/target/etc/rc.conf; then
@ -302,9 +432,105 @@ else
echo "KEYMAP=\"$KBD_LAYOUT\"" >> /mnt/target/etc/rc.conf echo "KEYMAP=\"$KBD_LAYOUT\"" >> /mnt/target/etc/rc.conf
fi fi
#TODO: Figure out how to configure keyboard for Xorg clear
REGIONS="$(find /usr/share/zoneinfo/ -mindepth 1 -maxdepth 1 -type d -exec basename \{\} \; | sort)"
I=1
echo "
To set up time zone information, you will now be prompted for a region and location.
The location should be the one that determines your timezone, it isn't necessarily the one nearest to you.
#TODO timezone Please choose a region:"
for REGION in $REGIONS; do
echo "$I: $REGION"
I=$((I+1))
done
REGION=""
CHOICE=0
while ! [ "$CHOICE" -gt 0 -a "$CHOICE" -le "$(wc -l <<< "$REGIONS")" ]; do
read -p "Select an option [1-$(wc -l <<< "$REGIONS")]: " CHOICE
if [ "$CHOICE" -gt 0 -a "$CHOICE" -le "$(wc -l <<< "$REGIONS")" ]; then
REGION="$(sed -n -e "${CHOICE}p" <<< "$REGIONS")"
else
echo "Invalid choice."
fi
done
LOCATIONS="$(find /usr/share/zoneinfo/"$REGION"/ -mindepth 1 -maxdepth 1 -exec basename \{\} \; | sort)"
I=1
echo "
Please choose a location or sub-region:"
for LOCATION in $LOCATIONS; do
if [ "$((I % 3))" -eq 0 ]; then
echo "$I: $LOCATION"
else
echo -n "$I: $LOCATION"
echo -ne "\t"
fi
I=$((I+1))
done
LOCATION=""
CHOICE=0
while ! [ "$CHOICE" -gt 0 -a "$CHOICE" -le "$(wc -l <<< "$LOCATIONS")" ]; do
read -p "Select an option [1-$(wc -l <<< "$LOCATIONS")]: " CHOICE
if [ "$CHOICE" -gt 0 -a "$CHOICE" -le "$(wc -l <<< "$LOCATIONS")" ]; then
LOCATION="$(sed -n -e "${CHOICE}p" <<< "$LOCATIONS")"
else
echo "Invalid choice."
fi
done
if [ -d "/usr/share/zoneinfo/$REGION/$LOCATION" ]; then
REGION="$REGION/$LOCATION"
LOCATIONS="$(find /usr/share/zoneinfo/"$REGION"/ -mindepth 1 -maxdepth 1 -exec basename \{\} \; | sort)"
I=1
echo "
Please choose a location:"
for LOCATION in $LOCATIONS; do
if [ "$((I % 3))" -eq 0 ]; then
echo "$I: $LOCATION"
else
echo -n "$I: $LOCATION"
echo -ne "\t"
fi
I=$((I+1))
done
LOCATION=""
CHOICE=0
while ! [ "$CHOICE" -gt 0 -a "$CHOICE" -le "$(wc -l <<< "$LOCATIONS")" ]; do
read -p "Select an option [1-$(wc -l <<< "$LOCATIONS")]: " CHOICE
if [ "$CHOICE" -gt 0 -a "$CHOICE" -le "$(wc -l <<< "$LOCATIONS")" ]; then
LOCATION="$(sed -n -e "${CHOICE}p" <<< "$LOCATIONS")"
else
echo "Invalid choice."
fi
done
fi
TIMEZONE="$REGION/$LOCATION"
echo "Configuring timezone."
if grep "#TIMEZONE=" /mnt/target/etc/rc.conf; then
sed -i -e 's/#TIMEZONE=.*/TIMEZONE="'"$TIMEZONE"'"/' /mnt/target/etc/rc.conf
else
clear
echo "WARNING: Could not locate the time zone setting in rc.conf." | tee --append $LOGFILE
echo "The script will attempt to add one." | tee --append $LOGFILE
echo ""
press_any_key
echo "" >> /mnt/target/etc/rc.conf
echo "# Install script could not find time zone setting, adding one here." >> /mnt/target/etc/rc.conf
echo "TIMEZONE=\"$TIMEZONE\"" >> /mnt/target/etc/rc.conf
fi
echo "Setting SEEDRNG_SKIP_CREDIT=true"
if grep "#SEEDRNG_SKIP_CREDIT=" /mnt/target/etc/rc.conf; then
sed -i -e 's/#SEEDRNG_SKIP_CREDIT=.*/SEEDRNG_SKIP_CREDIT=true/' /mnt/target/etc/rc.conf
else
clear
echo "WARNING: Could not locate the SEEDRNG_SKIP_CREDIT setting in rc.conf." | tee --append $LOGFILE
echo "The script will attempt to add one." | tee --append $LOGFILE
echo ""
press_any_key
echo "" >> /mnt/target/etc/rc.conf
echo "# Install script could not find SEEDRNG_SKIP_CREDIT setting, adding one here." >> /mnt/target/etc/rc.conf
echo "SEEDRNG_SKIP_CREDIT=true" >> /mnt/target/etc/rc.conf
fi
clear clear
echo "Assume that the hardware clock is UTC? echo "Assume that the hardware clock is UTC?
@ -366,17 +592,18 @@ done
echo "$TARGET_HOSTNAME" > /mnt/target/etc/hostname echo "$TARGET_HOSTNAME" > /mnt/target/etc/hostname
#TODO: set up / fix locale on glibc
clear clear
echo -n "Installing bootloader... " echo -n "Installing bootloader... "
mkdir /mnt/target/boot/efi/LOADER >> $LOGFILE 2>&1 mkdir /mnt/target/boot/efi/LOADER >> $LOGFILE 2>&1
echo "GRUB has been deliberately installed to a non-standard location. 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 can't hurt...
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 "'/dev/$TARGET_DISK'" >> $LOGFILE 2>&1
run_in_target grub-install --target=i386-pc --boot-directory=/boot/efi/LOADER --disk-module=native --modules="'$TARGET_PRELOAD_GRUB_MODULES'" "'/dev/$TARGET_DISK'" >> $LOGFILE 2>&1 run_in_target grub-install --target=i386-efi --boot-directory=/boot/efi/LOADER --efi-directory=/boot/efi --removable --no-nvram "'/dev/$TARGET_DISK'" >> $LOGFILE 2>&1
run_in_target grub-install --target=i386-efi --boot-directory=/boot/efi/LOADER --disk-module=native --efi-directory=/boot/efi --removable --no-nvram --modules="'$TARGET_PRELOAD_GRUB_MODULES'" "'/dev/$TARGET_DISK'" >> $LOGFILE 2>&1 run_in_target grub-install --target=x86_64-efi --boot-directory=/boot/efi/LOADER --efi-directory=/boot/efi --removable --no-nvram "'/dev/$TARGET_DISK'" >> $LOGFILE 2>&1
run_in_target grub-install --target=x86_64-efi --boot-directory=/boot/efi/LOADER --disk-module=native --efi-directory=/boot/efi --removable --no-nvram --modules="'$TARGET_PRELOAD_GRUB_MODULES'" "'/dev/$TARGET_DISK'" >> $LOGFILE 2>&1
echo "done" echo "done"
echo -n "Adding grub-config helper... " echo -n "Adding grub-config helper... "
@ -411,26 +638,14 @@ function get_stage2_file {
wget --output-document="$STAGE2_DIR/$1" "$GIT_REPO_BASE/$1" >> $LOGFILE 2>&1 wget --output-document="$STAGE2_DIR/$1" "$GIT_REPO_BASE/$1" >> $LOGFILE 2>&1
} }
get_stage2_file install-stage2.sh >> $LOGFILE 2>&1 get_stage2_file "install-stage2.sh" >> $LOGFILE 2>&1
chmod 744 "$STAGE2_DIR/install-stage2.sh" >> $LOGFILE 2>&1 chmod 744 "$STAGE2_DIR/install-stage2.sh" >> $LOGFILE 2>&1
get_stage2_file package_selections/sections.lst # Stage 2 prefab environment/rice install scripts
readarray -t SECTIONS < "$STAGE2_DIR/package_selections/sections.lst" get_stage2_file "custom-scripts/scripts.lst"
for I in ${!SECTIONS[@]}; do while read -r NEXT_SCRIPT; do
get_stage2_file "package_selections/${SECTIONS[$I]}/description.txt" [ -n "$NEXT_SCRIPT" ] && get_stage2_file "custom-scripts/$NEXT_SCRIPT"
done < "$STAGE2_DIR/custom-scripts/scripts.lst"
get_stage2_file "package_selections/${SECTIONS[$I]}/options.lst"
readarray -t OPTIONS < "$STAGE2_DIR/package_selections/${SECTIONS[$I]}/options.lst"
for J in ${!OPTIONS[@]}; do
get_stage2_file "package_selections/${SECTIONS[$I]}/${OPTIONS[$J]}"
done
get_stage2_file "package_selections/${SECTIONS[$I]}/additional_files.lst"
readarray -t FILES < "$STAGE2_DIR/package_selections/${SECTIONS[$I]}/additional_files.lst"
for J in ${!FILES[@]}; do
get_stage2_file "package_selections/${SECTIONS[$I]}/${FILES[$J]}"
done
done
mv /mnt/target/etc/sv/agetty-tty1/conf /mnt/target/etc/sv/agetty-tty1/conf.bak >> $LOGFILE 2>&1 mv /mnt/target/etc/sv/agetty-tty1/conf /mnt/target/etc/sv/agetty-tty1/conf.bak >> $LOGFILE 2>&1
echo 'if [ -x /sbin/agetty -o -x /bin/agetty ]; then echo 'if [ -x /sbin/agetty -o -x /bin/agetty ]; then

View File

@ -1,6 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
LOGFILE=/tmp/void-usb-install-log LOGFILE=/tmp/void-usb-install-log
STAGE2_DIR="/opt/void-usb/installer/"
function press_any_key { function press_any_key {
echo "Press any key to continue or Ctrl+c to abort..." echo "Press any key to continue or Ctrl+c to abort..."
@ -69,6 +70,7 @@ Alternatively, you can continue without internet but the system will be left in
echo -n "." echo -n "."
done done
echo " $INTERNET" echo " $INTERNET"
# TODO: allow to connect again if still no internet
fi fi
fi fi
@ -78,42 +80,73 @@ if [ "$INTERNET" = "up" ]; then
echo "done" echo "done"
fi fi
readarray -t SECTIONS < /opt/void-usb/installer/package_selections/sections.lst
for I in ${!SECTIONS[@]}; do
readarray -t OPTIONS < "/opt/void-usb/installer/package_selections/${SECTIONS[$I]}/options.lst"
AVAILABLE_OPTIONS=()
for J in ${!OPTIONS[@]}; do
source "/opt/void-usb/installer/package_selections/${SECTIONS[$I]}/${OPTIONS[$J]}"
if check; then
AVAILABLE_OPTIONS+=("${OPTIONS[$J]}")
fi
done
if [ -z "${AVAILABLE_OPTIONS[1]}" ]; then CONFIG_DIR="$STAGE2_DIR/custom-scripts"
# no need to ask, there is only one option anyway SCRIPTS=()
CHOICE="${AVAILABLE_OPTIONS[0]}" NAMES=()
else DESCRIPTIONS=()
clear
cat "/opt/void-usb/installer/package_selections/${SECTIONS[$I]}/description.txt"
echo ""
for J in ${!AVAILABLE_OPTIONS[@]}; do
source "/opt/void-usb/installer/package_selections/${SECTIONS[$I]}/${AVAILABLE_OPTIONS[$J]}"
echo "$J: $DESCRIPTION"
done
CHOICE=""
while [ -z "$CHOICE" ]; do
echo ""
echo "Select by entering the corresponding number."
read -p "> " CHOICE_NUMBER
grep "^[0-9]*$" <<< "$CHOICE_NUMBER" && CHOICE="${AVAILABLE_OPTIONS[$CHOICE_NUMBER]}"
done
fi
source "/opt/void-usb/installer/package_selections/${SECTIONS[$I]}/$CHOICE" echo "Scanning for configuration scripts in $CONFIG_DIR..."
if [ -n "$PACKAGES" ]; then for script in "$CONFIG_DIR"/*.sh; do
xbps-install --yes $PACKAGES [ -f "$script" ] || continue # Skip if no .sh files found
fi SCRIPTS+=("$script")
post_install
SCRIPT_NAME=$(grep '^# NAME:' "$script" | sed 's/^# NAME:[[:space:]]*//')
[ -z "$SCRIPT_NAME" ] && SCRIPT_NAME="$(basename "$script")"
SCRIPT_DESC=$(grep '^# DESC:' "$script" | sed 's/^# DESC:[[:space:]]*//')
[ -z "$SCRIPT_DESC" ] && SCRIPT_DESC="No description available."
NAMES+=("$SCRIPT_NAME")
DESCRIPTIONS+=("$SCRIPT_DESC")
done done
bash --norc --noprofile # Check if no scripts were found
if [ ${#SCRIPTS[@]} -eq 0 ]; then
echo "No configuration scripts found in $CONFIG_DIR."
exit 1
fi
echo "Available configurations:"
for i in "${!SCRIPTS[@]}"; do
echo "$((i+1)): ${NAMES[i]} - ${DESCRIPTIONS[i]}"
done
echo "$(( ${#SCRIPTS[@]} + 1 )): Exit"
CHOICE=0
while ! (( CHOICE >= 1 && CHOICE <= ${#SCRIPTS[@]} )); do
read -p "Select an option [1-$((${#SCRIPTS[@]}+1))]: " CHOICE
if (( CHOICE >= 1 && CHOICE <= ${#SCRIPTS[@]} )); then
echo "Running: ${NAMES[CHOICE-1]}"
bash "${SCRIPTS[CHOICE-1]}"
elif (( CHOICE == ${#SCRIPTS[@]} + 1 )); then
echo "Exiting..."
break
else
echo "Invalid choice."
fi
done
echo "Setting up user..."
read -p "Enter username: " NEW_USER
#TODO: let the user choose additional groups (suggest sane defaults for different use cases)
# cdrom? optical? storage? what they do?
# users (dows this even do anything)
useradd -m -s /bin/bash -G wheel,users,kvm,video,audio,dialout,network,scanner "$NEW_USER"
passwd "$NEW_USER"
echo "Cleaning up installation files..."
mv /etc/sv/agetty-tty1/conf.bak /etc/sv/agetty-tty1/conf >> $LOGFILE 2>&1
if [ -f /root/.profile.bak ]; then
mv /root/.profile.bak /root/.profile
else
rm /root/.profile
fi
rm -rf "$STAGE2_DIR"
clear
echo "To save the changes made to the system, a new system image needs to be created.
The system will reboot now. While shutting down, you will be asked about creating a system image. Choose yes."
reboot

View File

@ -11,23 +11,6 @@ VERSION="$2"
echo "Updating default kernel and initramfs symlinks..." echo "Updating default kernel and initramfs symlinks..."
#####################
# Delete old symlinks
#####################
OLD_LINUX=/boot/vmlinu?
if [ ! -f "$OLD_LINUX" ]; then
# in cases where its a .gz or .xz or whatever
OLD_LINUX=$(find /boot -type l -name "vmlinu*" 2>/dev/null | sort | head -n1)
fi
[ -f "$OLD_LINUX" ] && rm "$OLD_LINUX"
OLD_INITRAMFS=/boot/initramfs.img
if [ ! -f "$OLD_INITRAMFS" ]; then
# hope to find anything named initramfs or initrd
OLD_INITRAMFS=$(find /boot -type l -name "init*" 2>/dev/null | sort | head -n1)
fi
[ -f "$OLD_INITRAMFS" ] && rm "$OLD_INITRAMFS"
##################### #####################
# Create new symlinks # Create new symlinks
##################### #####################
@ -39,7 +22,7 @@ fi
if grep -e ".gz$" -e ".xz$" -e ".bz$" -e ".bz2$" -e ".lzma$" -e ".lz$" -e ".img$" >/dev/null 2>&1 <<< "$NEW_LINUX_FILE"; then if grep -e ".gz$" -e ".xz$" -e ".bz$" -e ".bz2$" -e ".lzma$" -e ".lz$" -e ".img$" >/dev/null 2>&1 <<< "$NEW_LINUX_FILE"; then
NEW_LINUX_SYMLINK="$NEW_LINUX_SYMLINK$(grep -o -e ".gz$" -e ".xz$" -e ".bz$" -e ".bz2$" -e ".lzma$" -e ".lz$" -e ".img$" 2>/dev/null <<< "$NEW_LINUX_FILE")" NEW_LINUX_SYMLINK="$NEW_LINUX_SYMLINK$(grep -o -e ".gz$" -e ".xz$" -e ".bz$" -e ".bz2$" -e ".lzma$" -e ".lz$" -e ".img$" 2>/dev/null <<< "$NEW_LINUX_FILE")"
fi fi
ln -s "$NEW_LINUX_FILE" "/boot/$NEW_LINUX_SYMLINK" ln -s -f "$NEW_LINUX_FILE" "/boot/$NEW_LINUX_SYMLINK"
NEW_INITRAMFS_FILE="$(find /boot -name "init*$VERSION*" 2>/dev/null | sed 's|^/boot/||')" NEW_INITRAMFS_FILE="$(find /boot -name "init*$VERSION*" 2>/dev/null | sed 's|^/boot/||')"
NEW_INITRAMFS_SYMLINK="initramfs" NEW_INITRAMFS_SYMLINK="initramfs"
@ -49,7 +32,7 @@ fi
if grep -e ".gz$" -e ".xz$" -e ".bz$" -e ".bz2$" -e ".lzma$" -e ".lz$" -e ".img$" >/dev/null 2>&1 <<< "$NEW_INITRAMFS_FILE"; then if grep -e ".gz$" -e ".xz$" -e ".bz$" -e ".bz2$" -e ".lzma$" -e ".lz$" -e ".img$" >/dev/null 2>&1 <<< "$NEW_INITRAMFS_FILE"; then
NEW_INITRAMFS_SYMLINK="$NEW_INITRAMFS_SYMLINK$(grep -o -e ".gz$" -e ".xz$" -e ".bz$" -e ".bz2$" -e ".lzma$" -e ".lz$" -e ".img$" 2>/dev/null <<< "$NEW_INITRAMFS_FILE")" NEW_INITRAMFS_SYMLINK="$NEW_INITRAMFS_SYMLINK$(grep -o -e ".gz$" -e ".xz$" -e ".bz$" -e ".bz2$" -e ".lzma$" -e ".lz$" -e ".img$" 2>/dev/null <<< "$NEW_INITRAMFS_FILE")"
fi fi
ln -s "$NEW_INITRAMFS_FILE" "/boot/$NEW_INITRAMFS_SYMLINK" ln -s -f "$NEW_INITRAMFS_FILE" "/boot/$NEW_INITRAMFS_SYMLINK"
echo "Default kernel and initramfs are now: $NEW_LINUX_FILE, $NEW_INITRAMFS_FILE" echo "Default kernel and initramfs are now: $NEW_LINUX_FILE, $NEW_INITRAMFS_FILE"

View File

@ -13,5 +13,4 @@ while [ "$(vkpurge list | wc -l)" -gt "$KEEP_OLD_KERNELS" ]; do
OLDEST_KERNEL="$(vkpurge list | sort | head -n1)" OLDEST_KERNEL="$(vkpurge list | sort | head -n1)"
echo "Removing old kernel $OLDEST_KERNEL using vkpurge..." echo "Removing old kernel $OLDEST_KERNEL using vkpurge..."
vkpurge rm "$OLDEST_KERNEL" vkpurge rm "$OLDEST_KERNEL"
fi
done done

View File

@ -1,6 +1,4 @@
TODO: TODO:
make sure that gufw works as intended
check for Nvidia Optimus support - or make it happen somehow
compare sizes of glibc and musl installations compare sizes of glibc and musl installations
need xdg menu maker? need xdg menu maker?
adjust required USB stick and RAM size in README adjust required USB stick and RAM size in README
@ -9,114 +7,27 @@ do not rely on the RTC
- use ntp to get time - use ntp to get time
- only fall back to using rtc if offline - only fall back to using rtc if offline
- do not set the RTC - do not set the RTC
make our own or extract (if feasible) kb selection and time zone selection to hijack them for our purposes make our own time zone selection
- potentially interesting packages keyboard?
- ckbcomp
- kbd-data
overview of the installation process at the start overview of the installation process at the start
overall progress indication (step x out of y) overall progress indication (step x out of y)
look into roxterm as an alternative terminal look into roxterm as an alternative terminal
deal with the entropy thing that runs after rc.shutdown deal with the entropy thing that runs after rc.shutdown
first run message in .xinitrc.d
- auto-removes itself
- displays README.txt on root dir of the F2FS partition
add online check to all the selections that need internet add online check to all the selections that need internet
sort out /etc/resolv.conf for the chroot sort out /etc/resolv.conf for the chroot
set keyboard layout for initramfs set keyboard layout for initramfs
tell user about expected GRUB error messaegs tell user about expected GRUB error messaegs
disable suspend and hibernate disable hibernate, warn about suspend
when shutting down, let Xorg exit first, then run `loginctl {poweroff,reboot}` use zswap
add polkit to common packages rices: when shutting down, let Xorg exit first, then run `loginctl {poweroff,reboot}`
- this is needed so the user can interact with the console
https://github.com/aarnt/octoxbps https://github.com/aarnt/octoxbps
system-image system-image
check that all output goes to current TTY check that all output goes to current TTY
package selections:
desktop
icewm-full
packages
-> audio applet -> volctl
-> system monitor, file browser, image viewer, text editor, archive manager
-> GUI package manager? GUI update manager?
-> notification daemon?
xscreensaver
blueman
-> BT support?
post-install
add ultimate.bashrc
add backgrounds
modify bashrc to auto-start X if not already running
kick off scripts in .xinitrc.d from .xinitrc
exec icewm-session from .xinitrc
add to .xinitrc.d
start pipewire, pipewire-pulse, wireplumber
start conky
start desktop applets
volctl &
nm-applet &
blueman-applet &
display README
start xscreensaver
xscreensaver --no-splash &
start conky
conky &
put README.txt with relevant information on root dir of F2FS partition
symlink to /home/README.txt
add a symlink ~/.local/bin/xterm that points to lxterminal
configure icewm
startup script
choose random background
configuration
configure conky
configure xscreensaver
icewm-lite
post-install
add ultimate.bashrc
modify bashrc to auto-start X if not already running
kick off scripts in .xinitrc.d from .xinitrc
exec icewm (not session) from .xinitrc
add to .xinitrc.d
start pipewire, pipewire-pulse, wireplumber
display README
put README.txt with relevant information on root dir of F2FS partition
symlink to /home/README.txt
configure icewm
none
post-install
add ultimate.bashrc
modify bashrc to display README
put README.txt with relevant information on root dir of F2FS partition
symlink to /home/README.txt
musl downsides:
- no nvidia drivers
- may be janky in regards to running some Minecraft versions
musl upsides:
- ??
Stage 1: Stage 1:
-> select kb layout -> select kb layout
-> select installation type (x86_32/x86_64, glibc/musl)
-> configure time zone -> configure time zone
-> selection dialog? -> selection dialog?
-> symlink /etc/localtime -> symlink /etc/localtime
Stage 2:
-> set up user
-> ask for username
-> run useradd (non-interactively)
-> useradd --groups "comma,separated,groups" --create-home --shell /bin/bash $USERNAME
-> groups: dialout users wheel
-> ?? groups:
-> cdrom optical - can listen to CDs? Can watch DVDs? Can mount / unmount CDs/DVDs?
-> storage - can mount / unmount disks from GUI?
-> scanner - can scan things (for example using XSane?)
-> network - can interface with NetworkManager?
-> kvm - can run QEMU?
-> run passwd (interactively)
-> clean up
-> mv /mnt/target/etc/sv/agetty-tty1/conf.bak /mnt/target/etc/sv/agetty-tty1/conf
-> if [ -f /mnt/target/root/.profile.bak ]; then mv /mnt/target/root/.profile.bak /mnt/target/root/.profile; else rm /mnt/target/root/.profile; fi
-> rm -r /opt/void-usb/installer
-> build new squashfs image and reboot

View File

@ -4,21 +4,27 @@ OS_NAME="Void Linux USB"
GRUB_PREFIX="/boot/efi/LOADER/grub" GRUB_PREFIX="/boot/efi/LOADER/grub"
CFG_CUSTOM_BEFORE="custom_before.cfg" CFG_CUSTOM_BEFORE="custom_before.cfg"
CFG_CUSTOM_AFTER="custom_after.cfg" CFG_CUSTOM_AFTER="custom_after.cfg"
CONTAINER_UUID="$(blkid --output value --match-tag UUID "$(grep " /run/void-usb/container " /proc/mounts | sed -e 's/ .*//')")"
LINUX_CMDLINE="quiet root=/dev/loop0 ro void-usb-container=UUID=$CONTAINER_UUID"
DEFAULT_LINUX=/boot/vmlinu? if [ "$(findmnt --noheadings --nofsroot --output SOURCE /boot)" = "$(findmnt --noheadings --nofsroot --output SOURCE /run/void-usb/container)" ]; then
if [ ! -f "$DEFAULT_LINUX" ]; then GRUB_BOOT_PATH="/boot"
# in cases where its a .gz or .xz or whatever else
DEFAULT_LINUX=$(find /boot -type l -name "vmlinu*" 2>/dev/null | sort | head -n1) # assuming separate /boot partition
GRUB_BOOT_PATH=""
fi fi
VOIDUSB_CONTAINER="$(findmnt --noheadings --output SOURCE /run/void-usb/container)"
if grep "/dev/mapper" <<< "$VOIDUSB_CONTAINER" > /dev/null; then
LUKS_SETTINGS="rd.luks.uuid=$(blkid --output value --match-tag UUID /dev/"$(ls /sys/block/"$(basename "$(realpath "$VOIDUSB_CONTAINER")")"/slaves | head -n1)")"
else
VOIDUSB_CONTAINER="UUID=$(blkid --output value --match-tag UUID "$VOIDUSB_CONTAINER")"
fi
# TODO: rd.vconsole.keymap
LINUX_CMDLINE="quiet root=/dev/loop0 ro $LUKS_SETTINGS void-usb-container=$VOIDUSB_CONTAINER rd.vconsole.keymap=us"
DEFAULT_LINUX=$(find /boot -type l -name "vmlinu*" 2>/dev/null | sort | head -n1)
DEFAULT_LINUX="$(sed 's|^/boot/||' <<< "$DEFAULT_LINUX")" DEFAULT_LINUX="$(sed 's|^/boot/||' <<< "$DEFAULT_LINUX")"
DEFAULT_INITRAMFS=/boot/initramfs.img # hope to find anything named initramfs or initrd
if [ ! -f "$DEFAULT_INITRAMFS" ]; then DEFAULT_INITRAMFS=$(find /boot -type l -name "init*" 2>/dev/null | sort | head -n1)
# hope to find anything named initramfs or initrd
DEFAULT_INITRAMFS=$(find /boot -type l -name "init*" 2>/dev/null | sort | head -n1)
fi
DEFAULT_INITRAMFS="$(sed 's|^/boot/||' <<< "$DEFAULT_INITRAMFS")" DEFAULT_INITRAMFS="$(sed 's|^/boot/||' <<< "$DEFAULT_INITRAMFS")"
function make_menuentry { function make_menuentry {
@ -49,9 +55,9 @@ function make_menuentry {
echo " echo "
menuentry 'Linux $LINUX_VERSION' { menuentry 'Linux $LINUX_VERSION' {
echo 'Loading $LINUX...' echo 'Loading $LINUX...'
linux /boot/$LINUX $LINUX_CMDLINE linux $GRUB_BOOT_PATH/$LINUX $LINUX_CMDLINE
echo 'Loading initial ramdisk...' echo 'Loading initial ramdisk...'
initrd /boot/$INITRAMFS initrd $GRUB_BOOT_PATH/$INITRAMFS
}" >> "$GRUB_PREFIX/grub.cfg" }" >> "$GRUB_PREFIX/grub.cfg"
} }
@ -65,7 +71,7 @@ echo "# This file is auto-generated by $0.
# $GRUB_PREFIX/$CFG_CUSTOM_BEFORE or # $GRUB_PREFIX/$CFG_CUSTOM_BEFORE or
# $GRUB_PREFIX/$CFG_CUSTOM_AFTER # $GRUB_PREFIX/$CFG_CUSTOM_AFTER
search --fs-uuid --set=root $CONTAINER_UUID search --fs-uuid --set=root $(blkid --output value --match-tag UUID "$(findmnt --noheadings --nofsroot --output SOURCE /boot)")
set menu_color_normal=white/black set menu_color_normal=white/black
set menu_color_highlight=black/light-gray set menu_color_highlight=black/light-gray
@ -80,9 +86,9 @@ fi
menuentry '$OS_NAME' { menuentry '$OS_NAME' {
echo 'Loading Linux...' echo 'Loading Linux...'
linux /boot/$DEFAULT_LINUX $LINUX_CMDLINE linux $GRUB_BOOT_PATH/$DEFAULT_LINUX $LINUX_CMDLINE
echo 'Loading initial ramdisk...' echo 'Loading initial ramdisk...'
initrd /boot/$DEFAULT_INITRAMFS initrd $GRUB_BOOT_PATH/$DEFAULT_INITRAMFS
} }
submenu 'Choose kernel version...' {" > "$GRUB_PREFIX/grub.cfg" submenu 'Choose kernel version...' {" > "$GRUB_PREFIX/grub.cfg"

View File

@ -19,7 +19,8 @@ function echo_tty {
function yesno { function yesno {
unset DISCARD_ME unset DISCARD_ME
while [ -z "$DISCARD_ME" ]; do while [ -z "$DISCARD_ME" ]; do
read -p "[y/n] " -n1 DISCARD_ME < $TTY_OR_CONSOLE > $TTY_OR_CONSOLE echo_tty -n "[y/n] "
read -n1 DISCARD_ME < $TTY_OR_CONSOLE > $TTY_OR_CONSOLE
case "$DISCARD_ME" in case "$DISCARD_ME" in
y) y)
# add a line break # add a line break
@ -97,10 +98,14 @@ if $DONT_ASK || yesno; then
echo_tty "Building image..." echo_tty "Building image..."
mksquashfs / /run/void-usb/container/new_squashfs.img -b 1M -comp xz -progress -noappend -pf /run/void-usb/system-image-pseudo -ef /run/void-usb/system-image-excludes > $TTY_OR_CONSOLE mksquashfs / /run/void-usb/container/new_squashfs.img -b 1M -comp xz -progress -noappend -pf /run/void-usb/system-image-pseudo -ef /run/void-usb/system-image-excludes > $TTY_OR_CONSOLE
if [ "$?" -ne 0 ]; then
echo_tty -n "Moving new image in place... " echo_tty "An error ocurred while generating the image. It will be discarded."
mv /run/void-usb/container/new_squashfs.img /run/void-usb/container/squashfs.img sleep 5
echo_tty "done" else
echo_tty -n "Moving new image in place... "
mv /run/void-usb/container/new_squashfs.img /run/void-usb/container/squashfs.img
echo_tty "done"
fi
else else
echo_tty "Discarding system changes." echo_tty "Discarding system changes."
fi fi

View File

@ -1,19 +0,0 @@
# Package Selections
These are intended to give the user a bunch of choices when installing the
system. For example whether to use XFE or a more fully featured set of applications.
## Sections
Sections contain choices of a specific category. The sections are stored in
folders containing the sections description and its options.
For each section, only one of the options can be chosen.
The file `sections.lst` holds a list of all available sections in the order
in which the user will be asked about them.
## Options
Options are shell scripts that are sourced by the stage 2 installer.
They hold variables for description, package list, pre-install checks,
and additional post-install actions.
Options are shown in the order in which they appear in `options.lst`.

View File

@ -1,3 +0,0 @@
resources/common_packages
resources/xinitrc
resources/bashrc

View File

@ -1 +0,0 @@
Choose a desktop setup to install

View File

@ -1,13 +0,0 @@
function check {
[ "$INTERNET" = "down" ] && return 1
return 0
}
DESCRIPTION="Fully featured desktop with IceWM"
# TODO
PACKAGES="$(cat /opt/void-usb/installer/package_selections/desktop/resources/common_packages) pavucontrol network-manager-applet vlc lxterminal bash-completion gufw conky icewm firefox arandr xscreensaver-elogind volctl"
function post_install {
echo "desktop/icewm-light" >> /tmp/stage-2-choices
}

View File

@ -1,13 +0,0 @@
function check {
[ "$INTERNET" = "down" ] && return 1
return 0
}
DESCRIPTION="Small desktop with IceWM"
# TODO
PACKAGES="$(cat /opt/void-usb/installer/package_selections/desktop/resources/common_packages) pulsemixer xterm icewm firefox htop xfe"
function post_install {
echo "desktop/icewm-light" >> /tmp/stage-2-choices
}

View File

@ -1,11 +0,0 @@
function check {
return 0
}
DESCRIPTION="Leave the system as-is (no desktop)"
PACKAGES=""
function post_install {
echo "desktop/none" >> /tmp/stage-2-choices
}

View File

@ -1,3 +0,0 @@
icewm-full
icewm-lite
none

View File

@ -1,94 +0,0 @@
# ALWAYS RUN
# ==========
# things to always set up, even for non-interactive shells
EDITOR=nano
PAGER=less
if grep -F ".local/bin" <<< "$PATH"; then
true
else
PATH="$HOME/.local/bin:$PATH"
fi
export EDITOR PAGER PATH
# CHECK INTERACTIVE
# =================
# Don't do anything after this if not running an interactive shell.
case $- in
*i*) ;;
*) return ;;
esac
# START XORG
# ==========
# TODO
# check if login shell
# if yes, check if .xinitrc exists
# if yes, check if xorg is already running
# if no, startx
# 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 @@
setxkbmap xauth xorg-video-drivers mesa mesa-dri xorg-server elogind xorg-input-drivers xrandr acpilight xhost xinit xrdb xinput xgamma xset iceauth sessreg transset xcmsdb xkbutils xmodmap dejavu-fonts-ttf elogind xdg-utils dbus-elogind dbus-elogind-libs dbus-elogind-x11 pipewire

View File

@ -1,18 +0,0 @@
#!/bin/sh
if grep -F ".local/bin" <<< "$PATH"; then
true
else
PATH="$HOME/.local/bin:$PATH"
fi
export PATH
if [ -d "$HOME/.xinitrc.d" ]; then
for FILE in "$HOME/.xinitrc.d"/*; do
[ -x "$FILE" ] && "$FILE" &
done
fi
# The line below is placed by the package selection script.

View File

@ -1,10 +0,0 @@
Do you want to install the proprietary Nvidia driver?
By default, Void Linux ships with the open-source nouveau driver.
This is nice because it gets the system up and running when using an
Nvidia GPU but, due to Nvidias secrecy, nouveau isnt particularly good.
Installing the proprietary driver is recommended if you want to use Nvidia GPUs.
This will enable the nonfree repository.
Different versions are available. You can only choose one.

View File

@ -1,11 +0,0 @@
function check {
return 0
}
DESCRIPTION="Dont install."
PACKAGES=""
function post_install {
echo "nvidia/none" >> /tmp/stage-2-choices
}

View File

@ -1,18 +0,0 @@
function check {
[ "$INTERNET" = "down" ] && return 1
if xbps-query glibc >/dev/null 2>&1; then
return 0
else
return 1
fi
}
DESCRIPTION="Latest Nvidia driver, supports GTX ??? series and up"
#TODO: void-repo-nonfree
PACKAGES="nvidia"
function post_install {
#TODO: nvidia modeset kernel parameter?
echo "nvidia/nvidia" >> /tmp/stage-2-choices
}

View File

@ -1,18 +0,0 @@
function check {
[ "$INTERNET" = "down" ] && return 1
if xbps-query glibc >/dev/null 2>&1; then
return 0
else
return 1
fi
}
DESCRIPTION="Legacy Nvidia driver, version 390, supports GTX ??? series"
#TODO: void-repo-nonfree
PACKAGES="nvidia390"
function post_install {
#TODO: nvidia modeset kernel parameter?
echo "nvidia/nvidia390" >> /tmp/stage-2-choices
}

View File

@ -1,18 +0,0 @@
function check {
[ "$INTERNET" = "down" ] && return 1
if xbps-query glibc >/dev/null 2>&1; then
return 0
else
return 1
fi
}
DESCRIPTION="Legacy Nvidia driver, version 470, supports GTX ??? series"
#TODO: void-repo-nonfree
PACKAGES="nvidia470"
function post_install {
#TODO: nvidia modeset kernel parameter?
echo "nvidia/nvidia470" >> /tmp/stage-2-choices
}

View File

@ -1,4 +0,0 @@
none
nvidia
nvidia470
nvidia390

View File

@ -1,2 +0,0 @@
nvidia
desktop