From d8056278d20d9342601e89a29bee11c05be82800 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Fri, 19 Dec 2025 02:56:48 -0500 Subject: [PATCH] Minor improvements to install-stormux. Added xdotool dependency for I38. --- x86_64/airootfs/usr/local/bin/install-stormux | 83 +++++++++++++------ 1 file changed, 56 insertions(+), 27 deletions(-) diff --git a/x86_64/airootfs/usr/local/bin/install-stormux b/x86_64/airootfs/usr/local/bin/install-stormux index 8bdfe69..e3caab2 100755 --- a/x86_64/airootfs/usr/local/bin/install-stormux +++ b/x86_64/airootfs/usr/local/bin/install-stormux @@ -256,15 +256,27 @@ partition_disk_uefi_separate_home() { local disk="$1" log_info "Creating UEFI separate home partition layout on $disk" - # Get disk size in GB for calculating root partition size - local diskSizeGB - diskSizeGB=$(lsblk -dno SIZE "$disk" | grep -oE '[0-9]+' | head -1) + # Get disk size in MiB for calculating root partition size + local diskSizeMiB + diskSizeMiB=$(lsblk -dno SIZE -b "$disk" | awk '{print int($1/1024/1024)}') - # Calculate root partition size (30GB or 40% of disk, whichever is larger) - local rootSizeGB=30 - local fortyPercent=$((diskSizeGB * 40 / 100)) - if [[ $fortyPercent -gt $rootSizeGB ]]; then - rootSizeGB=$fortyPercent + # Calculate root partition size (30GiB or 40% of disk, whichever is larger) + local rootSizeMiB=$((30 * 1024)) + local fortyPercentMiB=$((diskSizeMiB * 40 / 100)) + if [[ $fortyPercentMiB -gt $rootSizeMiB ]]; then + rootSizeMiB=$fortyPercentMiB + fi + + # Ensure space for EFI (1GiB) and a minimal home partition (1GiB) + local efiEndMiB=1025 + local minHomeMiB=1024 + local maxRootMiB=$((diskSizeMiB - efiEndMiB - minHomeMiB)) + if [[ $maxRootMiB -lt 1024 ]]; then + log_error "Disk too small for separate /home partition layout" + return 1 + fi + if [[ $rootSizeMiB -gt $maxRootMiB ]]; then + rootSizeMiB=$maxRootMiB fi # Wipe existing partition table @@ -278,7 +290,7 @@ partition_disk_uefi_separate_home() { parted -s "$disk" set 1 esp on # Create root partition - local rootEndMiB=$((1025 + rootSizeGB * 1024)) + local rootEndMiB=$((efiEndMiB + rootSizeMiB)) parted -s "$disk" mkpart primary ext4 1025MiB "${rootEndMiB}MiB" # Create home partition (rest of disk) @@ -344,15 +356,26 @@ partition_disk_bios_separate_home() { local disk="$1" log_info "Creating BIOS separate home partition layout on $disk" - # Get disk size in GB - local diskSizeGB - diskSizeGB=$(lsblk -dno SIZE "$disk" | grep -oE '[0-9]+' | head -1) + # Get disk size in MiB + local diskSizeMiB + diskSizeMiB=$(lsblk -dno SIZE -b "$disk" | awk '{print int($1/1024/1024)}') - # Calculate root partition size (30GB or 40% of disk, whichever is larger) - local rootSizeGB=30 - local fortyPercent=$((diskSizeGB * 40 / 100)) - if [[ $fortyPercent -gt $rootSizeGB ]]; then - rootSizeGB=$fortyPercent + # Calculate root partition size (30GiB or 40% of disk, whichever is larger) + local rootSizeMiB=$((30 * 1024)) + local fortyPercentMiB=$((diskSizeMiB * 40 / 100)) + if [[ $fortyPercentMiB -gt $rootSizeMiB ]]; then + rootSizeMiB=$fortyPercentMiB + fi + + # Ensure space for a minimal home partition (1GiB) + local minHomeMiB=1024 + local maxRootMiB=$((diskSizeMiB - 1 - minHomeMiB)) + if [[ $maxRootMiB -lt 1024 ]]; then + log_error "Disk too small for separate /home partition layout" + return 1 + fi + if [[ $rootSizeMiB -gt $maxRootMiB ]]; then + rootSizeMiB=$maxRootMiB fi # Wipe existing partition table @@ -362,7 +385,7 @@ partition_disk_bios_separate_home() { parted -s "$disk" mklabel msdos # Create root partition - local rootEndMiB=$((1 + rootSizeGB * 1024)) + local rootEndMiB=$((1 + rootSizeMiB)) parted -s "$disk" mkpart primary ext4 1MiB "${rootEndMiB}MiB" parted -s "$disk" set 1 boot on @@ -416,25 +439,25 @@ partition_disks() { case "$partitionLayout" in single) if [[ "$bootMode" == "uefi" ]]; then - partition_disk_uefi_single "$targetDisk" + partition_disk_uefi_single "$targetDisk" || return 1 else - partition_disk_bios_single "$targetDisk" + partition_disk_bios_single "$targetDisk" || return 1 fi ;; separate_home) if [[ "$bootMode" == "uefi" ]]; then - partition_disk_uefi_separate_home "$targetDisk" + partition_disk_uefi_separate_home "$targetDisk" || return 1 else - partition_disk_bios_separate_home "$targetDisk" + partition_disk_bios_separate_home "$targetDisk" || return 1 fi ;; separate_disk) if [[ "$bootMode" == "uefi" ]]; then - partition_disk_uefi_root_only "$targetDisk" - partition_disk_uefi_home_only "$homeDisk" + partition_disk_uefi_root_only "$targetDisk" || return 1 + partition_disk_uefi_home_only "$homeDisk" || return 1 else - partition_disk_bios_root_only "$targetDisk" - partition_disk_bios_home_only "$homeDisk" + partition_disk_bios_root_only "$targetDisk" || return 1 + partition_disk_bios_home_only "$homeDisk" || return 1 fi ;; esac @@ -861,7 +884,7 @@ install_base_system() { allPackages+=(python-i3ipc python-wxpython sox yad) allPackages+=(lxsession magic-wormhole pcmanfm) allPackages+=(python-gobject python-pillow python-pytesseract scrot tesseract) - allPackages+=(tesseract-data-eng udiskie xorg-setxkbmap) + allPackages+=(tesseract-data-eng udiskie xorg-setxkbmap xdotool) # Add Stormux-specific i3 packages stormuxPackages+=(xlibre-xserver xlibre-input-libinput nodm-dgw brave-bin) ;; @@ -1221,6 +1244,12 @@ if [[ "${desktopEnvironment}" == "i3" ]]; then echo "Configuring I38 for accessibility..." cd /home/\$firstUser/git/I38 || exit 1 + # Ensure xdotool is available for I38 setup + if ! command -v xdotool >/dev/null 2>&1; then + echo "Installing xdotool for I38..." + pacman -Sy --noconfirm --needed xdotool 2>/dev/null || true + fi + # Run I38 setup scripts as the user # -x generates xinitrc and xprofile # Main script generates i3 config with accessibility features