Compare commits

..

6 Commits

Author SHA1 Message Date
BodgeMaster 3fe2535213 notes to self: update TODO list 2023-07-03 14:14:23 +02:00
BodgeMaster 657f5f1d47 install stage 2: start implementing 2023-07-03 14:12:55 +02:00
BodgeMaster a8a62834d4 package_selections/**: ensure that we have an internet connection where we need it 2023-07-03 14:11:57 +02:00
BodgeMaster b8ebdffc56 install stage 1: remove squashfs-tools from packages to install at the start
squashfs-tools will be installed and used in the chroot
2023-07-03 14:10:33 +02:00
BodgeMaster 64730980ea install stage 1: add sanity checks at the start 2023-07-03 14:08:11 +02:00
BodgeMaster 8f2a786826 package_selections/**: rename post-install to post_install bc bash was unhappy about it 2023-07-03 12:40:12 +02:00
42 changed files with 206 additions and 68 deletions

View File

@ -46,9 +46,17 @@ function run_in_target {
clear
touch $LOGFILE
#TODO: check that we are root
#TODO: check that we are online
# -> could be done by pinging repo-default.voidlinux.org
if [ ! "$(id -u)" -eq 0 ]; then
echo "Must be root to run this script!"
exit 1
fi
if ping -c4 repo-default.voidlinux.org >> $LOGFILE 2>&1; then
:
else
echo "An internet connection is required to run this script."
exit 1
fi
echo "
This script will now download and install Void Linux on your USB stick.
@ -57,7 +65,6 @@ usable from Windows or MacOS.
Before we begin, the following packages need to be installed (if not installed already):
- xmirror
- squashfs-tools
- wget
"
press_any_key
@ -66,7 +73,7 @@ echo -n "Ensuring that XBPS is up-to-date... "
xbps-install --yes --sync --update xbps >> $LOGFILE 2>&1
echo "done"
echo -n "Installing xmirror, squashfs-tools, wget... "
xbps-install --yes xmirror squashfs-tools wget >> $LOGFILE 2>&1
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

View File

@ -1,4 +1,115 @@
#!/usr/bin/env bash
#debugging
exec bash --norc --noprofile
LOGFILE=/tmp/void-usb-install-log
function press_any_key {
echo "Press any key to continue or Ctrl+c to abort..."
read -n1 DISCARD_ME
echo ""
}
function yesno {
unset DISCARD_ME
while [ -z "$DISCARD_ME" ]; do
read -p "[y/n] " -n1 DISCARD_ME
case "$DISCARD_ME" in
y)
return 0
;;
n)
return 1
;;
*)
echo " Please enter y for yes or n for no."
unset DISCARD_ME
;;
esac
done
}
[ -z "$TERM" ] && export TERM=linux
echo -n "Checking for internet connection..."
INTERNET="down"
WAITING=0
while [ "$INTERNET" = "down" -a "$WAITING" -lt 15 ]; do
sleep 1
if ping -c2 repo-default.voidlinux.org >> $LOGFILE 2>&1; then
INTERNET="up"
fi
WAITING=$((WAITING+1))
echo -n "."
done
echo " $INTERNET"
if [ "$INTERNET" = "down" ]; then
clear
echo "Connect to WiFi?
Any network settings from before the reboot have not been saved and need to be entered again.
Use 'Activate a connection' in the dialog to select your network.
Alternatively, you can continue without internet but the system will be left in a barebones state.
"
if yesno; then
nmtui
clear
echo -n "Checking for internet connection..."
WAITING=0
while [ "$INTERNET" = "down" -a "$WAITING" -lt 15 ]; do
sleep 1
if ping -c2 repo-default.voidlinux.org >> $LOGFILE 2>&1; then
INTERNET="up"
fi
WAITING=$((WAITING+1))
echo -n "."
done
echo " $INTERNET"
fi
fi
if [ "$INTERNET" = "up" ]; then
echo -n "Retrieving package lists... "
xbps-install --sync >>$LOGFILE 2>&1
echo "done"
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
# no need to ask, there is only one option anyway
CHOICE="${AVAILABLE_OPTIONS[0]}"
else
clear
cat "/opt/void-usb/installer/package_selections/${SECTIONS[$I]}/description.txt"
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 "Select by entering the corresponding number."
read -p "> " CHOICE_NUMBER
CHOICE="${AVAILABLE_OPTIONS[$CHOICE_NUMBER]}"
done
fi
source "/opt/void-usb/installer/package_selections/${SECTIONS[$I]}/$CHOICE"
if [ -n "$PACKAGES" ]; then
xbps-install --yes $PACKAGES
fi
post_install
done
bash --norc --noprofile

View File

@ -1,14 +1,12 @@
TODO:
compare sizes of glibc and musl installations
need xdg menu maker?
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
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
show user-friendly status instead of scrolling output from all sorts of tools
make our own or extract (if feasible) kb selection and time zone selection to hijack them for our purposes
vkpurge old stuff - only keep 2 vkpurgeable kernels
- change kernel pre-install hook
@ -23,6 +21,15 @@ look into roxterm as an alternative terminal
add a zram swap option to package_selections
include arandr or something similar in fully featured desktop utils
deal with the entropy thing that runs after rc.shutdown
add firewall option to package_selections
first run message in xinitrc
- auto-disables itself
- displays README.txt on root dir of the F2FS partition
put a README.txt on root dir of F2FS partition
add online check to all the selections that need internet
sort out /etc/resolv.conf for the chroot
Minimum viable Xorg setup: 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
musl downsides:
- no nvidia drivers
@ -38,26 +45,6 @@ Stage 1:
-> symlink /etc/localtime
Stage 2:
-> configure services
-> dbus
-> NetworkManager
-> acpid
-> ask user to connect to network using nmtui
-> install packages
-> go through the list of choices for what the user can install
-> Minimum viable Xorg setup: 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
-> dont ask the user if there is only one option
-> passwd -l root
-> populate /etc/skel
-> ultimate bashrc bc why not
-> first run message in xinitrc
-> auto-deletes itself
-> displays README.txt on root dir of the F2FS partition
-> if using CTWM
-> put xclock in xinitrc
-> configure more sane defaults
-> prepend bashrc with a thing that checks of xorg is running
-> if not, run startx and ask user whether to shut down, reboot, or do nothing afterwards
-> set up user
-> ask for username
-> run useradd (non-interactively)

View File

@ -6,6 +6,6 @@ DESCRIPTION="No audio"
PACKAGES=""
function post-install {
function post_install {
echo "audio/none" >> /tmp/stage-2-choices
}

View File

@ -1,4 +1,5 @@
function check {
[ "$INTERNET" = "down" ] && return 1
if grep "desktop/none" /tmp/stage-2-choices >/dev/null 2>&1; then
return 1
else
@ -10,6 +11,6 @@ DESCRIPTION="Pipewire with GUI settings (Pavucontrol)"
PACKAGES="pipewire pavucontrol"
function post-install {
function post_install {
echo "audio/pipewire" >> /tmp/stage-2-choices
}

View File

@ -1,4 +1,5 @@
function check {
[ "$INTERNET" = "down" ] && return 1
if grep "desktop/none" /tmp/stage-2-choices >/dev/null 2>&1; then
return 1
else
@ -10,6 +11,6 @@ DESCRIPTION="Pipewire with text-based settings (pulsemixer)"
PACKAGES="pipewire pulsemixer"
function post-install {
function post_install {
echo "audio/pipewire-slim" >> /tmp/stage-2-choices
}

View File

@ -1,4 +1,5 @@
function check {
[ "$INTERNET" = "down" ] && return 1
return 0
}
@ -7,6 +8,6 @@ DESCRIPTION="BodgeMasters IceWM setup (recommended)"
# TODO
PACKAGES=""
function post-install {
function post_install {
echo "desktop/icewm-fancy" >> /tmp/stage-2-choices
}

View File

@ -1,4 +1,5 @@
function check {
[ "$INTERNET" = "down" ] && return 1
return 0
}
@ -7,6 +8,6 @@ DESCRIPTION="Lighter IceWM setup"
# TODO
PACKAGES=""
function post-install {
function post_install {
echo "desktop/icewm-light" >> /tmp/stage-2-choices
}

View File

@ -6,6 +6,6 @@ DESCRIPTION="No desktop - for advanced users that want to set things up themselv
PACKAGES=""
function post-install {
function post_install {
echo "desktop/none" >> /tmp/stage-2-choices
}

View File

@ -1,4 +1,5 @@
function check {
[ "$INTERNET" = "down" ] && return 1
return 0
}
@ -8,6 +9,6 @@ DESCRIPTION="OpenBox window manager (even more lightweight???)"
# TODO also add xclock
PACKAGES=""
function post-install {
function post_install {
echo "desktop/openbox" >> /tmp/stage-2-choices
}

View File

@ -1,4 +1,5 @@
function check {
[ "$INTERNET" = "down" ] && return 1
if grep "desktop/none" /tmp/stage-2-choices >/dev/null 2>&1; then
return 1
else
@ -11,7 +12,7 @@ DESCRIPTION="All of the above"
#TODO
PACKAGES=""
function post-install {
function post_install {
# TODO: configure desktop backgounds if using IceWM
echo "extras/all" >> /tmp/stage-2-choices
}

View File

@ -1,4 +1,5 @@
function check {
[ "$INTERNET" = "down" ] && return 1
if grep "desktop/none" /tmp/stage-2-choices >/dev/null 2>&1; then
return 1
else
@ -11,7 +12,7 @@ DESCRIPTION="All of the above except Minecraft"
#TODO
PACKAGES=""
function post-install {
function post_install {
# TODO: configure desktop backgounds if using IceWM
echo "extras/all-no-minecraft" >> /tmp/stage-2-choices
}

View File

@ -1,4 +1,5 @@
function check {
[ "$INTERNET" = "down" ] && return 1
if grep "desktop/icewm" /tmp/stage-2-choices >/dev/null 2>&1; then
return 0
else
@ -10,7 +11,9 @@ DESCRIPTION="Add some desktop backgrounds and randomly choose one on login"
PACKAGES=""
function post-install {
function post_install {
# TODO: install wget
# TODO: configure
# TODO: remove wget
echo "extras/desktop-backgrounds" >> /tmp/stage-2-choices
}

View File

@ -1,4 +1,5 @@
function check {
[ "$INTERNET" = "down" ] && return 1
if grep "desktop/none" /tmp/stage-2-choices >/dev/null 2>&1; then
return 1
else
@ -11,6 +12,6 @@ DESCRIPTION="Prism Launcher for Minecraft"
#TODO: Java stuff
PACKAGES="PrismLauncher"
function post-install {
function post_install {
echo "extras/minecraft" >> /tmp/stage-2-choices
}

View File

@ -1,4 +1,5 @@
function check {
[ "$INTERNET" = "down" ] && return 1
if grep "desktop/none" /tmp/stage-2-choices >/dev/null 2>&1; then
return 1
else
@ -12,6 +13,6 @@ DESCRIPTION="??? (Minesweeper)"
#TODO
PACKAGES=""
function post-install {
function post_install {
echo "extras/minesweeper" >> /tmp/stage-2-choices
}

View File

@ -6,6 +6,6 @@ DESCRIPTION="None"
PACKAGES=""
function post-install {
function post_install {
echo "extras/none" >> /tmp/stage-2-choices
}

View File

@ -1,4 +1,5 @@
function check {
[ "$INTERNET" = "down" ] && return 1
if grep "desktop/none" /tmp/stage-2-choices >/dev/null 2>&1; then
return 1
else
@ -12,6 +13,6 @@ DESCRIPTION="nSnake"
#TODO
PACKAGES="nSnake"
function post-install {
function post_install {
echo "extras/snake" >> /tmp/stage-2-choices
}

View File

@ -6,6 +6,6 @@ DESCRIPTION="No"
PACKAGES=""
function post-install {
function post_install {
echo "multimedia/none" >> /tmp/stage-2-choices
}

View File

@ -1,4 +1,5 @@
function check {
[ "$INTERNET" = "down" ] && return 1
if grep "desktop/none" /tmp/stage-2-choices >/dev/null 2>&1; then
return 1
else
@ -11,6 +12,6 @@ DESCRIPTION="Install VLC"
#TODO: fluidsynth MIDI stuff
PACKAGES="vlc"
function post-install {
function post_install {
echo "multimedia/vlc" >> /tmp/stage-2-choices
}

View File

@ -6,6 +6,6 @@ DESCRIPTION="Dont install."
PACKAGES=""
function post-install {
function post_install {
echo "nvidia/none" >> /tmp/stage-2-choices
}

View File

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

View File

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

View File

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

View File

@ -6,8 +6,9 @@ DESCRIPTION="Only add custom bashrc (advanced users)"
PACKAGES=""
function post-install {
function post_install {
#TODO: configure things
# (probably by barfing the bashrc using echo)
echo "pre-configure/bashrc" >> /tmp/stage-2-choices
}

View File

@ -10,7 +10,7 @@ DESCRIPTION="Auto-start GUI session on login and add custom bashrc (recommended)
PACKAGES=""
function post-install {
function post_install {
#TODO: configure things
echo "pre-configure/gui-and-bashrc" >> /tmp/stage-2-choices

View File

@ -6,6 +6,6 @@ DESCRIPTION="No (advanced users)"
PACKAGES=""
function post-install {
function post_install {
echo "pre-configure/none" >> /tmp/stage-2-choices
}

View File

@ -1,4 +1,5 @@
function check {
[ "$INTERNET" = "down" ] && return 1
if grep "desktop/icewm" /tmp/stage-2-choices >/dev/null 2>&1; then
if grep "audio/none" /tmp/stage-2-choices >/dev/null 2>&1; then
return 0
@ -15,6 +16,6 @@ DESCRIPTION="Add tray icon for network"
#TODO
PACKAGES=""
function post-install {
function post_install {
echo "systray/network" >> /tmp/stage-2-choices
}

View File

@ -1,4 +1,5 @@
function check {
[ "$INTERNET" = "down" ] && return 1
if grep "desktop/icewm" /tmp/stage-2-choices >/dev/null 2>&1; then
if grep "audio/none" /tmp/stage-2-choices >/dev/null 2>&1; then
return 1
@ -15,6 +16,6 @@ DESCRIPTION="Add tray icon for network and audio"
#TODO
PACKAGES=""
function post-install {
function post_install {
echo "systray/network-and-audio" >> /tmp/stage-2-choices
}

View File

@ -6,6 +6,6 @@ DESCRIPTION="Dont install additional tray icons"
PACKAGES=""
function post-install {
function post_install {
echo "systray/none" >> /tmp/stage-2-choices
}

View File

@ -1,4 +1,5 @@
function check {
[ "$INTERNET" = "down" ] && return 1
if grep "desktop/none" /tmp/stage-2-choices >/dev/null 2>&1; then
return 1
else
@ -10,6 +11,6 @@ DESCRIPTION="LXDE Terminal (recommended)"
PACKAGES="lxterminal"
function post-install {
function post_install {
echo "terminal/lxterminal" >> /tmp/stage-2-choices
}

View File

@ -6,6 +6,6 @@ DESCRIPTION="None (advanced users only)"
PACKAGES="none"
function post-install {
function post_install {
echo "terminal/none" >> /tmp/stage-2-choices
}

View File

@ -1,4 +1,5 @@
function check {
[ "$INTERNET" = "down" ] && return 1
if grep "desktop/none" /tmp/stage-2-choices >/dev/null 2>&1; then
return 1
else
@ -10,6 +11,6 @@ DESCRIPTION="Xterm"
PACKAGES="xterm"
function post-install {
function post_install {
echo "terminal/xterm" >> /tmp/stage-2-choices
}

View File

@ -1,4 +1,5 @@
function check {
[ "$INTERNET" = "down" ] && return 1
if grep "desktop/none" /tmp/stage-2-choices >/dev/null 2>&1; then
return 1
else
@ -12,6 +13,6 @@ DESCRIPTION="Fully featured (list of things) (recommended)"
#TODO
PACKAGES=""
function post-install {
function post_install {
echo "utilities/desktop-integrated-guisysmon" >> /tmp/stage-2-choices
}

View File

@ -1,4 +1,5 @@
function check {
[ "$INTERNET" = "down" ] && return 1
if grep "desktop/none" /tmp/stage-2-choices >/dev/null 2>&1; then
return 1
else
@ -12,6 +13,6 @@ DESCRIPTION="Fully featured (list of things with htop)"
#TODO
PACKAGES=""
function post-install {
function post_install {
echo "utilities/desktop-integrated-htop" >> /tmp/stage-2-choices
}

View File

@ -6,6 +6,6 @@ DESCRIPTION="None"
PACKAGES=""
function post-install {
function post_install {
echo "utilities/none" >> /tmp/stage-2-choices
}

View File

@ -1,4 +1,5 @@
function check {
[ "$INTERNET" = "down" ] && return 1
if grep "desktop/none" /tmp/stage-2-choices >/dev/null 2>&1; then
return 1
else
@ -12,6 +13,6 @@ DESCRIPTION="Smaller set of desktop utilities (XFE + ???)"
#TODO
PACKAGES="xfe"
function post-install {
function post_install {
echo "utilities/xfe-guisysmon" >> /tmp/stage-2-choices
}

View File

@ -1,4 +1,5 @@
function check {
[ "$INTERNET" = "down" ] && return 1
if grep "desktop/none" /tmp/stage-2-choices >/dev/null 2>&1; then
return 1
else
@ -10,6 +11,6 @@ DESCRIPTION="Smaller set of desktop utilities (XFE + Htop)"
PACKAGES="xfe htop"
function post-install {
function post_install {
echo "utilities/xfe-htop" >> /tmp/stage-2-choices
}

View File

@ -1,4 +1,5 @@
function check {
[ "$INTERNET" = "down" ] && return 1
return 0
}
@ -6,6 +7,6 @@ DESCRIPTION="Install ELinks (terminal-based browser)"
PACKAGES="elinks"
function post-install {
function post_install {
echo "web/elinks" >> /tmp/stage-2-choices
}

View File

@ -1,4 +1,5 @@
function check {
[ "$INTERNET" = "down" ] && return 1
if grep "desktop/none" /tmp/stage-2-choices >/dev/null 2>&1; then
return 1
else
@ -10,6 +11,6 @@ DESCRIPTION="Join the dark side with Chromium (Consider Firefox... You can still
PACKAGES="chromium"
function post-install {
function post_install {
echo "web/evil" >> /tmp/stage-2-choices
}

View File

@ -1,4 +1,5 @@
function check {
[ "$INTERNET" = "down" ] && return 1
if grep "desktop/none" /tmp/stage-2-choices >/dev/null 2>&1; then
return 1
else
@ -10,6 +11,6 @@ DESCRIPTION="Install Firefox (recommended)"
PACKAGES="firefox"
function post-install {
function post_install {
echo "web/firefox" >> /tmp/stage-2-choices
}

View File

@ -1,4 +1,5 @@
function check {
[ "$INTERNET" = "down" ] && return 1
if grep "desktop/none" /tmp/stage-2-choices >/dev/null 2>&1; then
return 1
else
@ -10,6 +11,6 @@ DESCRIPTION="Install Firefox - Extended Support Release (ESR)"
PACKAGES="firefox-esr"
function post-install {
function post_install {
echo "web/firefox-esr" >> /tmp/stage-2-choices
}

View File

@ -6,6 +6,6 @@ DESCRIPTION="No web browser"
PACKAGES=""
function post-install {
function post_install {
echo "web/none" >> /tmp/stage-2-choices
}