Compare commits

...

5 Commits

Author SHA1 Message Date
BodgeMaster 0460940582 rename backup-fs to system-image
The terminology for "backing up" came from TinyCore Linux but it’s really more confusing than helpful for ppl who don’t know what’s happening under the hood.
2023-07-14 21:27:57 +02:00
BodgeMaster eeda7c61c0 install stage 1 and 2, backup-fs: print a newline after yesno 2023-07-14 20:58:43 +02:00
BodgeMaster c477744a58 package selections: add Xorg packages where relevant 2023-07-14 20:51:40 +02:00
BodgeMaster 94e00e7260 notes to self: update todo list 2023-07-14 20:50:59 +02:00
BodgeMaster 4dcd7d131f Minor improvements and fixes all over the place 2023-07-14 20:50:12 +02:00
8 changed files with 64 additions and 31 deletions

View File

@ -47,6 +47,7 @@ There are a couple manual steps to get started before the installer scripts can
- Be aware that Void uses a US keymap until you change it. If your keyboard is different, you might need to look up an image of a US keyboard to find the right keys. - Be aware that Void uses a US keymap until you change it. If your keyboard is different, you might need to look up an image of a US keyboard to find the right keys.
- If booting off the USB stick you want to install to, use (RAM) option - If booting off the USB stick you want to install to, use (RAM) option
- Log in as `root`, password `voidlinux` - Log in as `root`, password `voidlinux`
- It wont display anything while you type in the password but it will accept it.
- If you need to use WiFi, run `void-installer` - If you need to use WiFi, run `void-installer`
- Set your keyboard layout (optional) - Set your keyboard layout (optional)
- Connect to your network - Connect to your network
@ -69,7 +70,7 @@ The scripts will take it from there, asking you for information and downloading
- `install-stage2.sh`: continues setting up things after booting into the freshly installed base system - `install-stage2.sh`: continues setting up things after booting into the freshly installed base system
- `opt/`: contains files to be installed in /opt/void-usb/ - `opt/`: contains files to be installed in /opt/void-usb/
- `grub-config`: custom grub config generator (probably not necessary but at this point I dont wanna dig into the default one) - `grub-config`: custom grub config generator (probably not necessary but at this point I dont wanna dig into the default one)
- `backup-fs`: helper script to rebuild the squashfs - `system-image`: helper script to rebuild the squashfs
- `kernel.d/`: kernel hooks to be installed in /etc/kernel.d - `kernel.d/`: kernel hooks to be installed in /etc/kernel.d
- `skel/`: files to be added to /etc/skel - `skel/`: files to be added to /etc/skel
- `bashrc`: my custom .bashrc - `bashrc`: my custom .bashrc

View File

@ -26,9 +26,11 @@ function yesno {
read -p "[y/n] " -n1 DISCARD_ME read -p "[y/n] " -n1 DISCARD_ME
case "$DISCARD_ME" in case "$DISCARD_ME" in
y) y)
echo ""
return 0 return 0
;; ;;
n) n)
echo ""
return 1 return 1
;; ;;
*) *)
@ -51,7 +53,7 @@ if [ ! "$(id -u)" -eq 0 ]; then
exit 1 exit 1
fi fi
if ping -c4 repo-default.voidlinux.org >> $LOGFILE 2>&1; then if ping -c2 repo-default.voidlinux.org >> $LOGFILE 2>&1; then
: :
else else
echo "An internet connection is required to run this script." echo "An internet connection is required to run this script."
@ -240,7 +242,7 @@ echo "Adding mirror configuration."
echo "repository=$TARGET_MIRROR" > /mnt/target/etc/xbps.d/00-repository-main.conf echo "repository=$TARGET_MIRROR" > /mnt/target/etc/xbps.d/00-repository-main.conf
echo "Adding sudo configuration." echo "Adding sudo configuration."
echo "%wheel ALL=(ALL:ALL) ALL" > /mnt/target/etc/sudoers.d/wheel_as_sudo_group.conf echo "%wheel ALL=(ALL:ALL) ALL" > /mnt/target/etc/sudoers.d/wheel_as_sudo_group
echo "Disabling root password." echo "Disabling root password."
run_in_target passwd --lock root run_in_target passwd --lock root
@ -266,13 +268,13 @@ wget --output-document=/mnt/target/lib/dracut/modules.d/90void-usb/overlay.sh "$
chmod 744 /mnt/target/lib/dracut/modules.d/90void-usb/overlay.sh >> $LOGFILE 2>&1 chmod 744 /mnt/target/lib/dracut/modules.d/90void-usb/overlay.sh >> $LOGFILE 2>&1
echo "done" echo "done"
echo -n "Adding file system helper... " echo -n "Adding system-image helper... "
mkdir -p /mnt/target/opt/void-usb >> $LOGFILE 2>&1 mkdir -p /mnt/target/opt/void-usb >> $LOGFILE 2>&1
chmod 755 /mnt/target/opt/void-usb >> $LOGFILE 2>&1 chmod 755 /mnt/target/opt/void-usb >> $LOGFILE 2>&1
wget --output-document=/mnt/target/opt/void-usb/backup-fs "$GIT_REPO_BASE/opt/backup-fs" >> $LOGFILE 2>&1 wget --output-document=/mnt/target/opt/void-usb/system-image "$GIT_REPO_BASE/opt/system-image" >> $LOGFILE 2>&1
chmod 744 /mnt/target/opt/void-usb/backup-fs >> $LOGFILE 2>&1 chmod 744 /mnt/target/opt/void-usb/system-image >> $LOGFILE 2>&1
echo " echo "
/opt/void-usb/backup-fs" >> /mnt/target/etc/rc.shutdown /opt/void-usb/system-image" >> /mnt/target/etc/rc.shutdown
echo "done" echo "done"
echo "Adding fstab." echo "Adding fstab."
@ -432,7 +434,7 @@ echo 'if [ -x /sbin/agetty -o -x /bin/agetty ]; then
fi' > /mnt/target/etc/sv/agetty-tty1/conf fi' > /mnt/target/etc/sv/agetty-tty1/conf
[ -f /mnt/target/root/.profile ] && mv /mnt/target/root/.profile /mnt/target/root/.profile.bak >> $LOGFILE 2>&1 [ -f /mnt/target/root/.profile ] && mv /mnt/target/root/.profile /mnt/target/root/.profile.bak >> $LOGFILE 2>&1
echo "if ps aux | grep 'installer-stage2.sh' > /dev/null 2>&1; then echo "if ps aux | grep 'installer-stage2.sh' | grep -v 'grep' > /dev/null 2>&1; then
true true
else else
/opt/void-usb/installer/install-stage2.sh /opt/void-usb/installer/install-stage2.sh
@ -453,6 +455,6 @@ press_any_key
echo "Creating system image..." echo "Creating system image..."
#TODO: make this work without user interaction #TODO: make this work without user interaction
run_in_target /opt/void-usb/backup-fs run_in_target /opt/void-usb/system-image
reboot reboot
# #

View File

@ -14,9 +14,11 @@ function yesno {
read -p "[y/n] " -n1 DISCARD_ME read -p "[y/n] " -n1 DISCARD_ME
case "$DISCARD_ME" in case "$DISCARD_ME" in
y) y)
echo ""
return 0 return 0
;; ;;
n) n)
echo ""
return 1 return 1
;; ;;
*) *)
@ -93,15 +95,17 @@ for I in ${!SECTIONS[@]}; do
else else
clear clear
cat "/opt/void-usb/installer/package_selections/${SECTIONS[$I]}/description.txt" cat "/opt/void-usb/installer/package_selections/${SECTIONS[$I]}/description.txt"
echo ""
for J in ${!AVAILABLE_OPTIONS[@]}; do for J in ${!AVAILABLE_OPTIONS[@]}; do
source "/opt/void-usb/installer/package_selections/${SECTIONS[$I]}/${AVAILABLE_OPTIONS[$J]}" source "/opt/void-usb/installer/package_selections/${SECTIONS[$I]}/${AVAILABLE_OPTIONS[$J]}"
echo "$J: $DESCRIPTION" echo "$J: $DESCRIPTION"
done done
CHOICE="" CHOICE=""
while [ -z "$CHOICE" ]; do while [ -z "$CHOICE" ]; do
echo ""
echo "Select by entering the corresponding number." echo "Select by entering the corresponding number."
read -p "> " CHOICE_NUMBER read -p "> " CHOICE_NUMBER
CHOICE="${AVAILABLE_OPTIONS[$CHOICE_NUMBER]}" grep "^[0-9]*$" <<< "$CHOICE_NUMBER" && CHOICE="${AVAILABLE_OPTIONS[$CHOICE_NUMBER]}"
done done
fi fi

View File

@ -8,14 +8,16 @@ do not rely on the RTC
- 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 or extract (if feasible) kb selection and time zone selection to hijack them for our purposes
- potentially interesting packages
- ckbcomp
- kbd-data
vkpurge old stuff - only keep 2 vkpurgeable kernels vkpurge old stuff - only keep 2 vkpurgeable kernels
- change kernel pre-install hook - change kernel pre-install hook
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)
exclude optical drives exclude optical drives
add newline after yesno (also in backup script)
add bash completion along the line somewhere add bash completion along the line somewhere
test that OpenBox is actually lighter than IceWM - or replace it with something that is replace OpenBox with something lighter
allow unprivileged users to mount / unmount disks in GUI sessions allow unprivileged users to mount / unmount disks in GUI sessions
look into roxterm as an alternative terminal look into roxterm as an alternative terminal
add a zram swap option to package_selections add a zram swap option to package_selections
@ -28,8 +30,15 @@ first run message in xinitrc
put a README.txt on root dir of F2FS partition put a README.txt on root dir of 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
need some sort of notification handler?
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 when installing GUI also install elogind xdg-utils dbus-elogind dbus-elogind-libs dbus-elogind-x11
allow backgrounds only for icewm-fancy
when pre-configuring desktop
-> check if pipewire installed
-> add pipewire, pipewire-pulse, wireplumber
-> run IceWM directly if the lighter setup was selected
musl downsides: musl downsides:
- no nvidia drivers - no nvidia drivers
@ -48,9 +57,16 @@ Stage 2:
-> set up user -> set up user
-> ask for username -> ask for username
-> run useradd (non-interactively) -> run useradd (non-interactively)
-> useradd --groups "comma,separated,groups" --create-home --shell /bin/bash $USERNAME
-> groups: dialout users wheel
-> ?? groups:
-> video - Can use GUI? Can use webcam?
-> 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) -> run passwd (interactively)
-> add to groups
-> including sudo group
-> clean up -> clean up
-> mv /mnt/target/etc/sv/agetty-tty1/conf.bak /mnt/target/etc/sv/agetty-tty1/conf -> 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 -> 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

View File

@ -14,9 +14,11 @@ function yesno {
read -p "[y/n] " -n1 DISCARD_ME < $TTY_OR_CONSOLE read -p "[y/n] " -n1 DISCARD_ME < $TTY_OR_CONSOLE
case "$DISCARD_ME" in case "$DISCARD_ME" in
y) y)
echo ""
return 0 return 0
;; ;;
n) n)
echo ""
return 1 return 1
;; ;;
*) *)
@ -48,34 +50,39 @@ for I in ${!MOUNT_LIST[@]}; do
fi fi
done done
touch /run/void-usb/backup-fs-excludes touch /run/void-usb/system-image-excludes
touch /run/void-usb/backup-fs-pseudo touch /run/void-usb/system-image-pseudo
for I in ${!EXCLUDE_LIST[@]}; do for I in ${!EXCLUDE_LIST[@]}; do
echo "/${EXCLUDE_LIST[$I]}" >> /run/void-usb/backup-fs-excludes echo "/${EXCLUDE_LIST[$I]}" >> /run/void-usb/system-image-excludes
FILE_PERMS="$(stat -c '%a %u %g' "${EXCLUDE_LIST[$I]}")" FILE_PERMS="$(stat -c '%a %u %g' "${EXCLUDE_LIST[$I]}")"
echo "\"/${EXCLUDE_LIST[$I]}\" d $FILE_PERMS" >> /run/void-usb/backup-fs-pseudo echo "\"/${EXCLUDE_LIST[$I]}\" d $FILE_PERMS" >> /run/void-usb/system-image-pseudo
done done
#TODO: refuse to run if system is running #TODO: refuse to run if system is running
#TODO: add a way to force backing up without asking (for example a file in /run/void-usb) #TODO: add a way to force a new system image up without asking (for example a file in /run/void-usb)
#TODO: colors (bright white / light gray for readability) #TODO: colors (bright white / light gray for readability)
echo "Back up system changes to disk? echo "Create a new system image?
This only affects things outside the /home directory. This will replace the existing system image with a snapshot of the currently
Backing up the system will take some time. running system. Choosing no here will discard any newly installed programs,
updates, system configuration changes, etc.
This should not affect your files in /home as they are stored to disk directly.
Check /TODO/README.txt for more information.
Creating a new system image will take some time.
" "
if yesno; then if yesno; then
echo "Backing up..." echo "Building image..."
mksquashfs / /run/void-usb/container/new_squashfs.img -b 1M -comp xz -progress -noappend -pf /run/void-usb/backup-fs-pseudo -ef /run/void-usb/backup-fs-excludes 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
#TODO: check if enough disk space #TODO: check if enough disk space
# yes -> create new image next to old image # yes -> create new image next to old image
# no -> create new image in RAM # no -> create new image in RAM
#TODO: figure out when appending to existing squashfs is a good idea #TODO: figure out when appending to existing squashfs is a good idea
mv /run/void-usb/container/new_squashfs.img /run/void-usb/container/squashfs.img mv /run/void-usb/container/new_squashfs.img /run/void-usb/container/squashfs.img
else else
echo "" echo "Discarding system changes."
echo "Not backing up."
fi fi

View File

@ -5,8 +5,9 @@ function check {
DESCRIPTION="BodgeMasters IceWM setup (recommended)" DESCRIPTION="BodgeMasters IceWM setup (recommended)"
XORG_PACKAGES="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"
# TODO # TODO
PACKAGES="" PACKAGES="$XORG_PACKAGES icewm elogind"
function post_install { function post_install {
echo "desktop/icewm-fancy" >> /tmp/stage-2-choices echo "desktop/icewm-fancy" >> /tmp/stage-2-choices

View File

@ -5,8 +5,9 @@ function check {
DESCRIPTION="Lighter IceWM setup" DESCRIPTION="Lighter IceWM setup"
XORG_PACKAGES="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"
# TODO # TODO
PACKAGES="" PACKAGES="$XORG_PACKAGES icewm elogind"
function post_install { function post_install {
echo "desktop/icewm-light" >> /tmp/stage-2-choices echo "desktop/icewm-light" >> /tmp/stage-2-choices

View File

@ -6,8 +6,9 @@ function check {
# TODO: more information for the user # TODO: more information for the user
DESCRIPTION="OpenBox window manager (even more lightweight???)" DESCRIPTION="OpenBox window manager (even more lightweight???)"
# TODO also add xclock XORG_PACKAGES="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"
PACKAGES="" # TODO
PACKAGES="$XORG_PACKAGES xclock openbox elogind"
function post_install { function post_install {
echo "desktop/openbox" >> /tmp/stage-2-choices echo "desktop/openbox" >> /tmp/stage-2-choices