From 3fe234da5addcda9ea551a37b3e8c817d8bd2081 Mon Sep 17 00:00:00 2001 From: Michal Vasilek Date: Sat, 15 Apr 2023 01:02:16 +0200 Subject: [PATCH 01/10] build-x86-images: move variant setups to scripts moving different variants will allow us to use the same code for setting up the target system as for setting up the iso --- .gitignore | 1 + build-x86-images.sh.in | 69 ++++++++------------------ setupscripts/main.sh | 20 ++++++++ setupscripts/variants/base.sh | 4 ++ setupscripts/variants/cinnamon.sh | 5 ++ setupscripts/variants/enlightenment.sh | 5 ++ setupscripts/variants/gnome.sh | 5 ++ setupscripts/variants/kde.sh | 5 ++ setupscripts/variants/lxde.sh | 5 ++ setupscripts/variants/lxqt.sh | 5 ++ setupscripts/variants/mate.sh | 5 ++ setupscripts/variants/xfce.sh | 5 ++ 12 files changed, 87 insertions(+), 47 deletions(-) create mode 100644 setupscripts/main.sh create mode 100644 setupscripts/variants/base.sh create mode 100644 setupscripts/variants/cinnamon.sh create mode 100644 setupscripts/variants/enlightenment.sh create mode 100644 setupscripts/variants/gnome.sh create mode 100644 setupscripts/variants/kde.sh create mode 100644 setupscripts/variants/lxde.sh create mode 100644 setupscripts/variants/lxqt.sh create mode 100644 setupscripts/variants/mate.sh create mode 100644 setupscripts/variants/xfce.sh diff --git a/.gitignore b/.gitignore index fa64bc223..d06eb09ec 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ xbps-cachedir* stamps* !dracut/*/*.sh !packer/scripts/*.sh +!setupscripts/** diff --git a/build-x86-images.sh.in b/build-x86-images.sh.in index 5736d9438..bccd575d9 100644 --- a/build-x86-images.sh.in +++ b/build-x86-images.sh.in @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -eu @@ -22,58 +22,26 @@ esac done shift $((OPTIND - 1)) +deduplicate() { + printf "%s\n" $@ | sort -u | tr '\n' ' ' +} + build_variant() { variant="$1" shift IMG=void-live-${ARCH}-${DATE}-${variant}.iso - GRUB_PKGS="grub-i386-efi grub-x86_64-efi" - PKGS="dialog cryptsetup lvm2 mdadm void-docs-browse xtools-minimal xmirror $GRUB_PKGS" - XORG_PKGS="xorg-minimal xorg-input-drivers xorg-video-drivers setxkbmap xauth font-misc-misc terminus-font dejavu-fonts-ttf alsa-plugins-pulseaudio" - SERVICES="sshd" + PKGS=() + SERVICES=() - case $variant in - base) - SERVICES="$SERVICES dhcpcd wpa_supplicant acpid" - ;; - enlightenment) - PKGS="$PKGS $XORG_PKGS lightdm lightdm-gtk3-greeter enlightenment terminology udisks2 firefox" - SERVICES="$SERVICES acpid dhcpcd wpa_supplicant lightdm dbus polkitd" - ;; - xfce) - PKGS="$PKGS $XORG_PKGS lightdm lightdm-gtk3-greeter xfce4 gnome-themes-standard gnome-keyring network-manager-applet gvfs-afc gvfs-mtp gvfs-smb udisks2 firefox" - SERVICES="$SERVICES dbus elogind lightdm NetworkManager polkitd" - ;; - mate) - PKGS="$PKGS $XORG_PKGS lightdm lightdm-gtk3-greeter mate mate-extra gnome-keyring network-manager-applet gvfs-afc gvfs-mtp gvfs-smb udisks2 firefox" - SERVICES="$SERVICES dbus elogind lightdm NetworkManager polkitd" - ;; - cinnamon) - PKGS="$PKGS $XORG_PKGS lightdm lightdm-gtk3-greeter cinnamon gnome-keyring colord gnome-terminal gvfs-afc gvfs-mtp gvfs-smb udisks2 firefox" - SERVICES="$SERVICES dbus elogind lightdm NetworkManager polkitd" - ;; - gnome) - PKGS="$PKGS $XORG_PKGS gnome firefox" - SERVICES="$SERVICES dbus elogind gdm NetworkManager polkitd" - ;; - kde) - PKGS="$PKGS $XORG_PKGS kde5 konsole firefox dolphin" - SERVICES="$SERVICES dbus elogind NetworkManager sddm" - ;; - lxde) - PKGS="$PKGS $XORG_PKGS lxde lightdm lightdm-gtk3-greeter gvfs-afc gvfs-mtp gvfs-smb udisks2 firefox" - SERVICES="$SERVICES acpid dbus dhcpcd wpa_supplicant lightdm polkitd" - ;; - lxqt) - PKGS="$PKGS $XORG_PKGS lxqt sddm gvfs-afc gvfs-mtp gvfs-smb udisks2 firefox" - SERVICES="$SERVICES elogind dbus dhcpcd wpa_supplicant sddm polkitd" - ;; - *) - >&2 echo "Unknown variant $variant" - exit 1 - ;; - esac + export SETUP_TYPE=iso + . ./setupscripts/main.sh + setup_variant "$variant" - ./mklive.sh -a "$ARCH" -o "$IMG" -p "$PKGS" -S "$SERVICES" ${REPO} "$@" + PKGSSTR=$(deduplicate "${PKGS[@]}") + SERVICESSTR=$(deduplicate "${SERVICES[@]}") + + exit 1 + ./mklive.sh -a "$ARCH" -o "$IMG" -p "${PKGSSTR}" -S "${SERVICESSTR}" ${REPO} "$@" } if [ ! -x mklive.sh ]; then @@ -81,6 +49,13 @@ if [ ! -x mklive.sh ]; then exit 1 fi +for image in $IMAGES; do + if [ ! -x "setupscripts/variants/$image.sh" ]; then + echo "Unknown variant $image" >&2 + exit 1 + fi +done + for image in $IMAGES; do build_variant "$image" "$@" done diff --git a/setupscripts/main.sh b/setupscripts/main.sh new file mode 100644 index 000000000..884ad5023 --- /dev/null +++ b/setupscripts/main.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# snippets used in individual variants to avoid repetition +base() { + if [ "$SETUP_TYPE" = "iso" ]; then + PKGS+=("dialog" "cryptsetup" "lvm2" "mdadm" "void-docs-browse" "xtools-minimal" "grub-i386-efi" "grub-x86_64-efi") + SERVICES+=("sshd") + fi +} + +xorg_base() { + base + PKGS+=("xorg-minimal" "xorg-input-drivers" "xorg-video-drivers" "setxkbmap" "xauth" "font-misc-misc" "terminus-font" "dejavu-fonts-ttf" "alsa-plugins-pulseaudio") +} + +# set PKGS, SERVICES and other variables based on which variant we want to set up for +setup_variant() { + variant="$1" # xfce, base, gnome, etc. + . "setupscripts/variants/$variant.sh" +} diff --git a/setupscripts/variants/base.sh b/setupscripts/variants/base.sh new file mode 100644 index 000000000..4da421b55 --- /dev/null +++ b/setupscripts/variants/base.sh @@ -0,0 +1,4 @@ +#!/bin/bash +base + +SERVICES+=("dhcpcd" "wpa_supplicant" "acpid") diff --git a/setupscripts/variants/cinnamon.sh b/setupscripts/variants/cinnamon.sh new file mode 100644 index 000000000..26624cf0f --- /dev/null +++ b/setupscripts/variants/cinnamon.sh @@ -0,0 +1,5 @@ +#!/bin/bash +xorg_base + +PKGS+=("lightdm" "cinnamon" "gnome-keyring" "colord" "gnome-terminal" "gvfs-afc" "gvfs-mtp" "gvfs-smb" "udisks2" "firefox") +SERVICES+=("dbus" "elogind" "lightdm" "NetworkManager" "polkitd") diff --git a/setupscripts/variants/enlightenment.sh b/setupscripts/variants/enlightenment.sh new file mode 100644 index 000000000..4ee553f96 --- /dev/null +++ b/setupscripts/variants/enlightenment.sh @@ -0,0 +1,5 @@ +#!/bin/bash +xorg_base + +PKGS+=("lightdm" "enlightenment" "terminology" "udisks2" "firefox") +SERVICES+=("acpid" "dhcpcd" "wpa_supplicant" "lightdm" "dbus" "polkitd") diff --git a/setupscripts/variants/gnome.sh b/setupscripts/variants/gnome.sh new file mode 100644 index 000000000..a3050274f --- /dev/null +++ b/setupscripts/variants/gnome.sh @@ -0,0 +1,5 @@ +#!/bin/bash +xorg_base + +PKGS+=("gnome" "firefox") +SERVICES+=("dbus" "elogind" "gdm" "NetworkManager" "polkitd") diff --git a/setupscripts/variants/kde.sh b/setupscripts/variants/kde.sh new file mode 100644 index 000000000..447cb4d8b --- /dev/null +++ b/setupscripts/variants/kde.sh @@ -0,0 +1,5 @@ +#!/bin/bash +xorg_base + +PKGS+=("kde5" "konsole" "firefox" "dolphin") +SERVICES+=("dbus" "elogind" "NetworkManager" "sddm") diff --git a/setupscripts/variants/lxde.sh b/setupscripts/variants/lxde.sh new file mode 100644 index 000000000..dbeca7139 --- /dev/null +++ b/setupscripts/variants/lxde.sh @@ -0,0 +1,5 @@ +#!/bin/bash +xorg_base + +PKGS+=("lxde" "lightdm" "gvfs-afc" "gvfs-mtp" "gvfs-smb" "udisks2" "firefox") +SERVICES+=("acpid" "dbus" "dhcpcd" "wpa_supplicant" "lightdm" "polkitd") diff --git a/setupscripts/variants/lxqt.sh b/setupscripts/variants/lxqt.sh new file mode 100644 index 000000000..11f1583b6 --- /dev/null +++ b/setupscripts/variants/lxqt.sh @@ -0,0 +1,5 @@ +#!/bin/bash +xorg_base + +PKGS+=("lxqt" "lightdm" "gvfs-afc" "gvfs-mtp" "gvfs-smb" "udisks2" "firefox") +SERVICES+=("elogind" "dbus" "dhcpcd" "wpa_supplicant" "lightdm" "polkitd") diff --git a/setupscripts/variants/mate.sh b/setupscripts/variants/mate.sh new file mode 100644 index 000000000..d12353358 --- /dev/null +++ b/setupscripts/variants/mate.sh @@ -0,0 +1,5 @@ +#!/bin/bash +xorg_base + +PKGS+=("lightdm" "mate" "mate-extra" "gnome-keyring" "network-manager-applet" "gvfs-afc" "gvfs-mtp" "gvfs-smb" "udisks2" "firefox") +SERVICES+=("dbus" "elogind" "lightdm" "NetworkManager" "polkitd") diff --git a/setupscripts/variants/xfce.sh b/setupscripts/variants/xfce.sh new file mode 100644 index 000000000..7f96a6b54 --- /dev/null +++ b/setupscripts/variants/xfce.sh @@ -0,0 +1,5 @@ +#!/bin/bash +xorg_base + +PKGS+=("lightdm" "xfce4" "gnome-themes-standard" "gnome-keyring" "network-manager-applet" "gvfs-afc" "gvfs-mtp" "gvfs-smb" "udisks2" "firefox") +SERVICES+=("dbus" "elogind" "lightdm" "NetworkManager" "polkitd") From 3e72237aedc9fdd7438fda8d599cee4bb264a3e5 Mon Sep 17 00:00:00 2001 From: Michal Vasilek Date: Sat, 15 Apr 2023 01:40:13 +0200 Subject: [PATCH 02/10] WIP: use setupscripts in installer --- dracut/vmklive/adduser.sh | 4 -- installer.sh.in | 89 +++++---------------------------------- setupscripts/main.sh | 12 ++++++ 3 files changed, 23 insertions(+), 82 deletions(-) diff --git a/dracut/vmklive/adduser.sh b/dracut/vmklive/adduser.sh index 68d94b2cd..1bbb22152 100644 --- a/dracut/vmklive/adduser.sh +++ b/dracut/vmklive/adduser.sh @@ -15,10 +15,6 @@ USERSHELL=$(getarg live.shell) [ -x $NEWROOT/bin/bash -a -z "$USERSHELL" ] && USERSHELL=/bin/bash [ -z "$USERSHELL" ] && USERSHELL=/bin/sh -# Create /etc/default/live.conf to store USER. -echo "USERNAME=$USERNAME" >> ${NEWROOT}/etc/default/live.conf -chmod 644 ${NEWROOT}/etc/default/live.conf - if ! grep -q ${USERSHELL} ${NEWROOT}/etc/shells ; then echo ${USERSHELL} >> ${NEWROOT}/etc/shells fi diff --git a/installer.sh.in b/installer.sh.in index f230ff0b0..6d93d6367 100644 --- a/installer.sh.in +++ b/installer.sh.in @@ -1168,53 +1168,13 @@ umount_filesystems() { umount $TARGETDIR >$LOG 2>&1 } -log_and_count() { - local progress whole tenth - while read line; do - echo "$line" >$LOG - copy_count=$((copy_count + 1)) - progress=$((1000 * copy_count / copy_total)) - if [ "$progress" != "$copy_progress" ]; then - whole=$((progress / 10)) - tenth=$((progress % 10)) - printf "Progress: %d.%d%% (%d of %d files)\n" $whole $tenth $copy_count $copy_total - copy_progress=$progress - fi - done -} - -copy_rootfs() { - local tar_in="--create --one-file-system --xattrs" - TITLE="Check $LOG for details ..." - INFOBOX "Counting files, please be patient ..." 4 60 - copy_total=$(tar ${tar_in} -v -f /dev/null / 2>/dev/null | wc -l) - export copy_total copy_count=0 copy_progress= - clear - tar ${tar_in} -f - / 2>/dev/null | \ - tar --extract --xattrs --xattrs-include='*' --preserve-permissions -v -f - -C $TARGETDIR | \ - log_and_count | \ - DIALOG --title "${TITLE}" \ - --progressbox "Copying live image to target rootfs." 5 60 - if [ $? -ne 0 ]; then - DIE 1 - fi - unset copy_total copy_count copy_percent -} - install_packages() { - local _grub= _syspkg= + local PKGS=() + local SERVICES=() - if [ -n "$EFI_SYSTEM" ]; then - if [ $EFI_FW_BITS -eq 32 ]; then - _grub="grub-i386-efi" - else - _grub="grub-x86_64-efi" - fi - else - _grub="grub" - fi - - _syspkg="base-system" + export SETUP_TYPE=system + . ./setupscripts/main.sh + setup_variant base mkdir -p $TARGETDIR/var/db/xbps/keys $TARGETDIR/usr/share cp -a /usr/share/xbps.d $TARGETDIR/usr/share/ @@ -1228,8 +1188,8 @@ install_packages() { _arch=$(xbps-uhelper arch) stdbuf -oL env XBPS_ARCH=${_arch} \ - xbps-install -r $TARGETDIR -SyU ${_syspkg} ${_grub} 2>&1 | \ - DIALOG --title "Installing base system packages..." \ + xbps-install -r $TARGETDIR -SyU ${PKGS[@]} 2>&1 | \ + DIALOG --title "Installing packages..." \ --programbox 24 80 if [ $? -ne 0 ]; then DIE 1 @@ -1275,37 +1235,10 @@ ${BOLD}Do you want to continue?${RESET}" 20 80 || return # Create and mount filesystems create_filesystems - - # If source not set use defaults. - if [ "$(get_option SOURCE)" = "local" -o -z "$SOURCE_DONE" ]; then - copy_rootfs - . /etc/default/live.conf - rm -f $TARGETDIR/etc/motd - rm -f $TARGETDIR/etc/issue - rm -f $TARGETDIR/usr/sbin/void-installer - # Remove modified sddm.conf to let sddm use the defaults. - rm -f $TARGETDIR/etc/sddm.conf - # Remove live user. - echo "Removing $USERNAME live user from targetdir ..." >$LOG - chroot $TARGETDIR userdel -r $USERNAME >$LOG 2>&1 - rm -f $TARGETDIR/etc/sudoers.d/99-void-live - sed -i "s,GETTY_ARGS=\"--noclear -a $USERNAME\",GETTY_ARGS=\"--noclear\",g" $TARGETDIR/etc/sv/agetty-tty1/conf - TITLE="Check $LOG for details ..." - INFOBOX "Rebuilding initramfs for target ..." 4 60 - echo "Rebuilding initramfs for target ..." >$LOG - # mount required fs - mount_filesystems - chroot $TARGETDIR dracut --no-hostonly --add-drivers "ahci" --force >>$LOG 2>&1 - INFOBOX "Removing temporary packages from target ..." 4 60 - echo "Removing temporary packages from target ..." >$LOG - xbps-remove -r $TARGETDIR -Ry dialog xtools-minimal xmirror >>$LOG 2>&1 - rmdir $TARGETDIR/mnt/target - else - # mount required fs - mount_filesystems - # network install, use packages. - install_packages - fi + # mount required fs + mount_filesystems + # network install, use packages. + install_packages INFOBOX "Applying installer settings..." 4 60 diff --git a/setupscripts/main.sh b/setupscripts/main.sh index 884ad5023..1b1c44f4a 100644 --- a/setupscripts/main.sh +++ b/setupscripts/main.sh @@ -2,10 +2,22 @@ # snippets used in individual variants to avoid repetition base() { + PKGS+=("base-system") if [ "$SETUP_TYPE" = "iso" ]; then PKGS+=("dialog" "cryptsetup" "lvm2" "mdadm" "void-docs-browse" "xtools-minimal" "grub-i386-efi" "grub-x86_64-efi") SERVICES+=("sshd") + elif [ "$SETUP_TYPE" = "system" ]; then + if [ -n "$EFI_SYSTEM" ]; then + if [ "$EFI_FW_BITS" -eq 32 ]; then + PKGS+=("grub-i386-efi") + else + PKGS+=("grub-x86_64-efi") + fi + else + PKGS+=("grub") + fi fi + } xorg_base() { From 0a87fb8a419030c04c2b8c0b9978eabaebedb8e2 Mon Sep 17 00:00:00 2001 From: Michal Vasilek Date: Sat, 15 Apr 2023 01:47:26 +0200 Subject: [PATCH 03/10] installer: generalise enabling services --- installer.sh.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/installer.sh.in b/installer.sh.in index 6d93d6367..0386dad49 100644 --- a/installer.sh.in +++ b/installer.sh.in @@ -1198,8 +1198,8 @@ install_packages() { chroot $TARGETDIR xbps-reconfigure -a } -enable_dhcpd() { - ln -sf /etc/sv/dhcpcd $TARGETDIR/etc/runit/runsvdir/default/dhcpcd +enable_service() { + ln -sf /etc/sv/$1 $TARGETDIR/etc/runit/runsvdir/default/$1 } menu_install() { @@ -1272,7 +1272,7 @@ ${BOLD}Do you want to continue?${RESET}" 20 80 || return cp /etc/wpa_supplicant/wpa_supplicant.conf $TARGETDIR/etc/wpa_supplicant ln -sf /etc/sv/wpa_supplicant $TARGETDIR/etc/runit/runsvdir/default/wpa_supplicant fi - enable_dhcpd + enable_service dhcpcd elif [ -n "$_dev" -a "$_type" = "static" ]; then # static IP through dhcpcd. mv $TARGETDIR/etc/dhcpcd.conf $TARGETDIR/etc/dhcpcd.conf.orig @@ -1282,7 +1282,7 @@ ${BOLD}Do you want to continue?${RESET}" 20 80 || return echo "static ip_address=$_ip" >>$TARGETDIR/etc/dhcpcd.conf echo "static routers=$_gw" >>$TARGETDIR/etc/dhcpcd.conf echo "static domain_name_servers=$_dns1 $_dns2" >>$TARGETDIR/etc/dhcpcd.conf - enable_dhcpd + enable_service dhcpcd fi fi From 2550c7f58fd9e63123c3946b94e9ecde4c796566 Mon Sep 17 00:00:00 2001 From: Michal Vasilek Date: Sat, 15 Apr 2023 01:52:10 +0200 Subject: [PATCH 04/10] installer: also enable services --- installer.sh.in | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/installer.sh.in b/installer.sh.in index 0386dad49..04e6800cb 100644 --- a/installer.sh.in +++ b/installer.sh.in @@ -1168,7 +1168,7 @@ umount_filesystems() { umount $TARGETDIR >$LOG 2>&1 } -install_packages() { +install_packages_services() { local PKGS=() local SERVICES=() @@ -1196,6 +1196,10 @@ install_packages() { fi xbps-reconfigure -r $TARGETDIR -f base-files >/dev/null 2>&1 chroot $TARGETDIR xbps-reconfigure -a + + for service in "${SERVICES[@]}"; do + enable_service "$service" + done } enable_service() { @@ -1237,8 +1241,8 @@ ${BOLD}Do you want to continue?${RESET}" 20 80 || return create_filesystems # mount required fs mount_filesystems - # network install, use packages. - install_packages + # install packages and enable services + install_packages_services INFOBOX "Applying installer settings..." 4 60 From 322c22edfda35c89d661135dfe53754347c0c132 Mon Sep 17 00:00:00 2001 From: Michal Vasilek Date: Sat, 15 Apr 2023 11:11:48 +0200 Subject: [PATCH 05/10] move deduplication to the setupscript --- build-x86-images.sh.in | 8 -------- installer.sh.in | 7 ++++--- setupscripts/main.sh | 6 ++++++ 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/build-x86-images.sh.in b/build-x86-images.sh.in index bccd575d9..20ddb4c38 100644 --- a/build-x86-images.sh.in +++ b/build-x86-images.sh.in @@ -22,10 +22,6 @@ esac done shift $((OPTIND - 1)) -deduplicate() { - printf "%s\n" $@ | sort -u | tr '\n' ' ' -} - build_variant() { variant="$1" shift @@ -37,10 +33,6 @@ build_variant() { . ./setupscripts/main.sh setup_variant "$variant" - PKGSSTR=$(deduplicate "${PKGS[@]}") - SERVICESSTR=$(deduplicate "${SERVICES[@]}") - - exit 1 ./mklive.sh -a "$ARCH" -o "$IMG" -p "${PKGSSTR}" -S "${SERVICESSTR}" ${REPO} "$@" } diff --git a/installer.sh.in b/installer.sh.in index 04e6800cb..0adcbd49b 100644 --- a/installer.sh.in +++ b/installer.sh.in @@ -1168,9 +1168,10 @@ umount_filesystems() { umount $TARGETDIR >$LOG 2>&1 } -install_packages_services() { +perform_setupscript() { local PKGS=() local SERVICES=() + local PKGSSTR="" SERVICESSTR="" export SETUP_TYPE=system . ./setupscripts/main.sh @@ -1197,7 +1198,7 @@ install_packages_services() { xbps-reconfigure -r $TARGETDIR -f base-files >/dev/null 2>&1 chroot $TARGETDIR xbps-reconfigure -a - for service in "${SERVICES[@]}"; do + for service in ${SERVICESSTR}; do enable_service "$service" done } @@ -1242,7 +1243,7 @@ ${BOLD}Do you want to continue?${RESET}" 20 80 || return # mount required fs mount_filesystems # install packages and enable services - install_packages_services + perform_setupscript INFOBOX "Applying installer settings..." 4 60 diff --git a/setupscripts/main.sh b/setupscripts/main.sh index 1b1c44f4a..626e93be1 100644 --- a/setupscripts/main.sh +++ b/setupscripts/main.sh @@ -25,8 +25,14 @@ xorg_base() { PKGS+=("xorg-minimal" "xorg-input-drivers" "xorg-video-drivers" "setxkbmap" "xauth" "font-misc-misc" "terminus-font" "dejavu-fonts-ttf" "alsa-plugins-pulseaudio") } +deduplicate() { + printf "%s\n" $@ | sort -u | tr '\n' ' ' +} + # set PKGS, SERVICES and other variables based on which variant we want to set up for setup_variant() { variant="$1" # xfce, base, gnome, etc. . "setupscripts/variants/$variant.sh" + PKGSSTR=$(deduplicate "${PKGS[@]}") + SERVICESSTR=$(deduplicate "${SERVICES[@]}") } From 1382754875a8311767d0fe7c4e0a01065795d168 Mon Sep 17 00:00:00 2001 From: Michal Vasilek Date: Sat, 15 Apr 2023 11:20:53 +0200 Subject: [PATCH 06/10] build-x86-images: fix condition -x checks for executable permissions, we just want to check if the file exists --- build-x86-images.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-x86-images.sh.in b/build-x86-images.sh.in index 20ddb4c38..75c36ee83 100644 --- a/build-x86-images.sh.in +++ b/build-x86-images.sh.in @@ -42,7 +42,7 @@ if [ ! -x mklive.sh ]; then fi for image in $IMAGES; do - if [ ! -x "setupscripts/variants/$image.sh" ]; then + if [ ! -f "setupscripts/variants/$image.sh" ]; then echo "Unknown variant $image" >&2 exit 1 fi From 10da2ee798e507687c74b218f57ab9427dfb1867 Mon Sep 17 00:00:00 2001 From: Michal Vasilek Date: Sat, 15 Apr 2023 11:22:48 +0200 Subject: [PATCH 07/10] move PKGS and SERVICES initialization to setupscripts --- build-x86-images.sh.in | 2 -- installer.sh.in | 6 ++---- setupscripts/main.sh | 2 ++ 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/build-x86-images.sh.in b/build-x86-images.sh.in index 75c36ee83..00735d7fc 100644 --- a/build-x86-images.sh.in +++ b/build-x86-images.sh.in @@ -26,8 +26,6 @@ build_variant() { variant="$1" shift IMG=void-live-${ARCH}-${DATE}-${variant}.iso - PKGS=() - SERVICES=() export SETUP_TYPE=iso . ./setupscripts/main.sh diff --git a/installer.sh.in b/installer.sh.in index 0adcbd49b..c168e5987 100644 --- a/installer.sh.in +++ b/installer.sh.in @@ -1168,9 +1168,7 @@ umount_filesystems() { umount $TARGETDIR >$LOG 2>&1 } -perform_setupscript() { - local PKGS=() - local SERVICES=() +run_setupscript() { local PKGSSTR="" SERVICESSTR="" export SETUP_TYPE=system @@ -1243,7 +1241,7 @@ ${BOLD}Do you want to continue?${RESET}" 20 80 || return # mount required fs mount_filesystems # install packages and enable services - perform_setupscript + run_setupscript INFOBOX "Applying installer settings..." 4 60 diff --git a/setupscripts/main.sh b/setupscripts/main.sh index 626e93be1..16856ee32 100644 --- a/setupscripts/main.sh +++ b/setupscripts/main.sh @@ -32,6 +32,8 @@ deduplicate() { # set PKGS, SERVICES and other variables based on which variant we want to set up for setup_variant() { variant="$1" # xfce, base, gnome, etc. + local PKGS=() + local SERVICES=() . "setupscripts/variants/$variant.sh" PKGSSTR=$(deduplicate "${PKGS[@]}") SERVICESSTR=$(deduplicate "${SERVICES[@]}") From 7b7cfe73782d53e14b65e1b1200c66e7888334d3 Mon Sep 17 00:00:00 2001 From: Michal Vasilek Date: Sat, 15 Apr 2023 11:39:44 +0200 Subject: [PATCH 08/10] setupscripts: add missed xmirror package --- setupscripts/main.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setupscripts/main.sh b/setupscripts/main.sh index 16856ee32..da306b865 100644 --- a/setupscripts/main.sh +++ b/setupscripts/main.sh @@ -4,7 +4,7 @@ base() { PKGS+=("base-system") if [ "$SETUP_TYPE" = "iso" ]; then - PKGS+=("dialog" "cryptsetup" "lvm2" "mdadm" "void-docs-browse" "xtools-minimal" "grub-i386-efi" "grub-x86_64-efi") + PKGS+=("dialog" "cryptsetup" "lvm2" "mdadm" "void-docs-browse" "xtools-minimal" "grub-i386-efi" "grub-x86_64-efi" "xmirror") SERVICES+=("sshd") elif [ "$SETUP_TYPE" = "system" ]; then if [ -n "$EFI_SYSTEM" ]; then From fd4edd6da9009c6da097264b9812be38ad71ea5d Mon Sep 17 00:00:00 2001 From: Michal Vasilek Date: Sat, 15 Apr 2023 12:00:13 +0200 Subject: [PATCH 09/10] installer: properly unmount the whole /mnt/target without unmounting these filesystems, unmounting their parents fails and /mnt/target doesn't get unmounted --- installer.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer.sh.in b/installer.sh.in index c168e5987..b6d4afd78 100644 --- a/installer.sh.in +++ b/installer.sh.in @@ -1145,7 +1145,7 @@ mount_filesystems() { umount_filesystems() { local f - for f in sys/fs/fuse/connections sys proc dev; do + for f in sys/fs/fuse/connections sys/fs/cgroup/* sys/fs/cgroup sys/kernel/security sys proc dev/pts dev/shm dev; do echo "Unmounting $TARGETDIR/$f..." >$LOG umount $TARGETDIR/$f >$LOG 2>&1 done From 0e212b1ba455b354bc8c8b46b475ce756d90d8ba Mon Sep 17 00:00:00 2001 From: Michal Vasilek Date: Sat, 15 Apr 2023 12:33:34 +0200 Subject: [PATCH 10/10] include setupscripts in the iso, fix installer --- build-x86-images.sh.in | 9 ++++++++- installer.sh.in | 6 ++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/build-x86-images.sh.in b/build-x86-images.sh.in index 00735d7fc..2f633f362 100644 --- a/build-x86-images.sh.in +++ b/build-x86-images.sh.in @@ -11,6 +11,13 @@ help() { echo "${0#/*}: [-a arch] [-b base|enlightenment|xfce|mate|cinnamon|gnome|kde|lxde|lxqt] [-r repo]" >&2 } +includedir=$(mktemp -d -p .) +cleanup() { + rm -rf "$includedir" +} +trap "cleanup" INT TERM QUIT +cp -r setupscripts "$includedir/" + while getopts "a:b:hr:" opt; do case $opt in a) ARCH="$OPTARG";; @@ -31,7 +38,7 @@ build_variant() { . ./setupscripts/main.sh setup_variant "$variant" - ./mklive.sh -a "$ARCH" -o "$IMG" -p "${PKGSSTR}" -S "${SERVICESSTR}" ${REPO} "$@" + ./mklive.sh -a "$ARCH" -o "$IMG" -p "${PKGSSTR}" -S "${SERVICESSTR}" -I ${includedir} ${REPO} "$@" } if [ ! -x mklive.sh ]; then diff --git a/installer.sh.in b/installer.sh.in index b6d4afd78..46d296b99 100644 --- a/installer.sh.in +++ b/installer.sh.in @@ -1171,9 +1171,11 @@ umount_filesystems() { run_setupscript() { local PKGSSTR="" SERVICESSTR="" + cd / export SETUP_TYPE=system - . ./setupscripts/main.sh + . /setupscripts/main.sh setup_variant base + cd - mkdir -p $TARGETDIR/var/db/xbps/keys $TARGETDIR/usr/share cp -a /usr/share/xbps.d $TARGETDIR/usr/share/ @@ -1187,7 +1189,7 @@ run_setupscript() { _arch=$(xbps-uhelper arch) stdbuf -oL env XBPS_ARCH=${_arch} \ - xbps-install -r $TARGETDIR -SyU ${PKGS[@]} 2>&1 | \ + xbps-install -r $TARGETDIR -SyU ${PKGSSTR} 2>&1 | \ DIALOG --title "Installing packages..." \ --programbox 24 80 if [ $? -ne 0 ]; then