Compare commits

..

14 Commits

Author SHA1 Message Date
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
8 changed files with 5467 additions and 172 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
- 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
- `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`
The scripts will take it from there, asking you for information and downloading things as needed.

View File

@ -6,13 +6,14 @@ Use this to Deploy rices/set up services/etc.
Each configuration script should follow this structure:
```bash
#!/bin/bash
#!/usr/bin/env bash
# NAME: Your Script Name
# DESC: A brief description of what the script does.
# Your script logic here
```
If NAME and DESC are not found, the script will default to the script's filename.
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` (Separate by newline) and they will show up on the installer.
Place the scripts under this folder, add the filename to `scripts.lst` (separate by newline) and they will show up in the installer.

File diff suppressed because one or more lines are too long

View File

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

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
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 {
echo "Press any key to continue or Ctrl+c to abort..."
@ -78,9 +78,7 @@ echo -n "Installing xmirror, squashfs-tools, wget... "
xbps-install --yes xmirror wget >> $LOGFILE 2>&1
echo "done"
#TODO: If going down the path of extracting routines from void-installer, that should be done here
#TODO: Select keyboard layout
#TODO: Select keyboard layout by showing lists of what's present (directories for region, then files within)
KBD_LAYOUT="de-latin1"
clear
@ -177,13 +175,15 @@ 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 --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
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
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
@ -207,21 +207,20 @@ the chosen mirror from the config file it generates.
"
press_any_key
xmirror
#TODO: also remove CPU architecture
TARGET_MIRROR="$(sed 's/repository=//;s|/musl$||' /etc/xbps.d/00-repository-main.conf)"
options=("x86_64" "x86_64 musl" "x86_32")
#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]}"
echo "$((i+1)): ${options[$i]}"
done
read -p "Input your choice: " choice
read -p "Input your choice (number): " choice
# Funny loop in bash...
if [[ "$choice" =~ ^[0-9]+$ ]] && [ "$choice" -ge 1 ] && [ "$choice" -le "${#options[@]}" ]; then
if [ "$choice" -ge 1 ] && [ "$choice" -le "${#options[@]}" ]; then
TARGET_TYPE="${options[$((choice-1))]}"
break
else
@ -231,12 +230,9 @@ done
echo "You selected: $TARGET_TYPE"
#TODO: also add CPU architecture
if grep "musl" <<< "$TARGET_TYPE"; then
TARGET_MIRROR="$TARGET_MIRROR/musl"
# Probably not the smartest idea, but since there is just one option for musl,
# I figured out this should do.
TARGET_TYPE="x86_64"
TARGET_TYPE="$(sed -e 's/ musl//' <<< "$TARGET_TYPE")"
fi
echo -n "Copying repository keys... "
@ -257,6 +253,11 @@ XBPS_ARCH="$TARGET_TYPE" xbps-install --yes --sync --rootdir /mnt/target --repos
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 xz 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 "Adding mirror configuration."
@ -323,8 +324,6 @@ else
echo "KEYMAP=\"$KBD_LAYOUT\"" >> /mnt/target/etc/rc.conf
fi
#TODO: Figure out how to configure keyboard for Xorg
#TODO timezone
clear
@ -432,28 +431,14 @@ function get_stage2_file {
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
function download_scripts {
local scripts_file="$1"
# Read the scripts file line by line
while IFS= read -r script; do
# Call the function to download each script
get_stage2_file "custom-scripts/$script"
done < "$scripts_file"
}
# Create the custom-scripts directory
CUSTOM_SCRIPTS_DIR="$STAGE2_DIR/custom-scripts"
mkdir -p "$CUSTOM_SCRIPTS_DIR"
# Download the scripts file into the custom-scripts folder
SCRIPTS_FILE="scripts" # The name of the scripts file in the custom-scripts folder
get_stage2_file "custom-scripts/$SCRIPTS_FILE"
download_scripts "$CUSTOM_SCRIPTS_DIR/$SCRIPTS_FILE"
# Stage 2 prefab environment/rice install scripts
get_stage2_file "custom-scripts/scripts.lst"
while read -r NEXT_SCRIPT; do
[ -n "$NEXT_SCRIPT" ] && get_stage2_file "custom-scripts/$NEXT_SCRIPT"
done < "$STAGE2_DIR/custom-scripts/scripts.lst"
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

View File

@ -1,6 +1,7 @@
#!/usr/bin/env bash
LOGFILE=/tmp/void-usb-install-log
STAGE2_DIR="/opt/void-usb/installer/"
function press_any_key {
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 "."
done
echo " $INTERNET"
# TODO: allow to connect again if still no internet
fi
fi
@ -79,25 +81,20 @@ if [ "$INTERNET" = "up" ]; then
fi
STAGE2_DIR="/opt/void-usb/installer/" # Change this to your desired directory
CONFIG_DIR="$STAGE2_DIR/custom-scripts"
SCRIPT_LIST="$CONFIG_DIR/scripts.lst"
SCRIPTS=()
NAMES=()
DESCRIPTIONS=()
# Find all scripts and extract their names & descriptions
echo "Scanning for configuration scripts in $CONFIG_DIR..."
for script in "$CONFIG_DIR"/*.sh; do
[ -f "$script" ] || continue # Skip if no .sh files found
SCRIPTS+=("$script")
# Extract name from "# NAME:" (first occurrence)
SCRIPT_NAME=$(grep -m1 '^# NAME:' "$script" | sed 's/^# NAME:[[:space:]]*//')
SCRIPT_NAME=$(grep '^# NAME:' "$script" | sed 's/^# NAME:[[:space:]]*//')
[ -z "$SCRIPT_NAME" ] && SCRIPT_NAME="$(basename "$script")"
# Extract description from "# DESC:" (first occurrence)
SCRIPT_DESC=$(grep -m1 '^# DESC:' "$script" | sed 's/^# DESC:[[:space:]]*//')
SCRIPT_DESC=$(grep '^# DESC:' "$script" | sed 's/^# DESC:[[:space:]]*//')
[ -z "$SCRIPT_DESC" ] && SCRIPT_DESC="No description available."
NAMES+=("$SCRIPT_NAME")
@ -110,38 +107,51 @@ if [ ${#SCRIPTS[@]} -eq 0 ]; then
exit 1
fi
# Display menu dynamically
echo "Available configurations:"
for i in "${!SCRIPTS[@]}"; do
echo "$((i+1))) ${NAMES[i]} - ${DESCRIPTIONS[i]}"
echo "$((i+1)): ${NAMES[i]} - ${DESCRIPTIONS[i]}"
done
echo "$(( ${#SCRIPTS[@]} + 1 ))) Exit"
echo "$(( ${#SCRIPTS[@]} + 1 )): Exit"
# Get user input
read -p "Select an option (1-${#SCRIPTS[@]}): " choice
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
# Run selected script
if (( choice >= 1 && choice <= ${#SCRIPTS[@]} )); then
echo "Running: ${NAMES[choice-1]}"
bash "${SCRIPTS[choice-1]}"
elif (( choice == ${#SCRIPTS[@]} + 1 )); then
echo "Exiting..."
exit 0
else
echo "Invalid choice."
exit 1
fi
# Stage 2 Tasks
echo "Setting up user..."
read -p "Enter username: " NEW_USER
useradd -m -G wheel "$NEW_USER"
#TODO: let the user choose additional groups (suggest sane defaults for different use cases)
# cdrom? optical? storage? what they do?
# scanner
# network (check if this even still does anything)
# kvm
# audio, video
# dialout
# users (dows this even do anything)
useradd -m -s /bin/bash -G wheel,video,audio,dialout,network "$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"
echo "Restoring TTY1 configuration..."
mv /mnt/target/etc/sv/agetty-tty1/conf.bak /mnt/target/etc/sv/agetty-tty1/conf >> $LOGFILE 2>&1
clear
echo "To save the changes made to the system, a new system image needs to be created.
bash --norc --noprofile
The system will reboot now. While shutting down, you will be asked about creating a system image. Choose yes."
reboot

View File

@ -1,6 +1,4 @@
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
need xdg menu maker?
adjust required USB stick and RAM size in README
@ -9,114 +7,27 @@ do not rely on the RTC
- use ntp to get time
- only fall back to using rtc if offline
- do not set the RTC
make our own or extract (if feasible) kb selection and time zone selection to hijack them for our purposes
- potentially interesting packages
- ckbcomp
- kbd-data
make our own time zone selection
keyboard?
overview of the installation process at the start
overall progress indication (step x out of y)
look into roxterm as an alternative terminal
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
sort out /etc/resolv.conf for the chroot
set keyboard layout for initramfs
tell user about expected GRUB error messaegs
disable suspend and hibernate
when shutting down, let Xorg exit first, then run `loginctl {poweroff,reboot}`
add polkit to common packages
disable hibernate, warn about suspend
use zswap
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
system-image
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:
-> select kb layout
-> select installation type (x86_32/x86_64, glibc/musl)
-> configure time zone
-> selection dialog?
-> 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

@ -19,7 +19,8 @@ function echo_tty {
function yesno {
unset DISCARD_ME
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
y)
# add a line break
@ -97,10 +98,14 @@ if $DONT_ASK || yesno; then
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
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"
if [ "$?" -ne 0 ]; then
echo_tty "An error ocurred while generating the image. It will be discarded."
sleep 5
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
echo_tty "Discarding system changes."
fi