diff --git a/x86_64/airootfs/usr/local/bin/configure-stormux b/x86_64/airootfs/usr/local/bin/configure-stormux index cd2579f..5399a99 100755 --- a/x86_64/airootfs/usr/local/bin/configure-stormux +++ b/x86_64/airootfs/usr/local/bin/configure-stormux @@ -9,21 +9,11 @@ fi trap cleanup EXIT cleanup() { - popd &> /dev/null - if ! [[ -x /opt/configure-stormux/configure-stormux.sh ]]; then - echo "Initial setup is not complete." - echo "To continue setup, please run:" - echo "sudo configure-stormux" - fi + echo "Initial setup is not complete." + echo "To continue setup, please run:" + echo "sudo configure-stormux" } - -if [[ -x /opt/configure-stormux/configure-stormux.sh ]]; then - pushd /opt/configure-stormux - ./configure-stormux.sh - exit 0 -fi - # Volume calibration is now handled in stormux_first_boot.sh export DIALOGOPTS='--insecure --no-lines --visit-items' @@ -36,7 +26,7 @@ set_timezone() { region=$(dialog --backtitle "Please select your Region" \ --no-tags \ --menu "Use up and down arrows or page-up and page-down to navigate the list, and press 'Enter' to make your selection." 0 0 0 \ - $(for i in ${regions[@]} ; do echo "$i";echo "$i";done) --stdout) + $(for i in "${regions[@]}" ; do echo "$i";echo "$i";done) --stdout) mapfile -t cities < <(timedatectl --no-pager list-timezones | grep "$region" | cut -d '/' -f2 | sort -u) @@ -45,13 +35,13 @@ set_timezone() { city=$(dialog --backtitle "Please select a city near you" \ --no-tags \ --menu "Use up and down arrow or page-up and page-down to navigate the list." 0 0 10 \ - $(for i in ${cities[@]} ; do echo "$i";echo "$i";done) --stdout) + $(for i in "${cities[@]}" ; do echo "$i";echo "$i";done) --stdout) # Set the timezone if [[ -f /etc/localtime ]]; then rm /etc/localtime fi - ln -sf /usr/share/zoneinfo/${region}/${city} /etc/localtime + ln -sf /usr/share/zoneinfo/"${region}"/"${city}" /etc/localtime timedatectl set-ntp true } # Offer to switch fenrir layout. @@ -65,29 +55,6 @@ if [[ "${continue,}" == "y" ]];then systemctl restart fenrirscreenreader.service fi -# Check for possible resize -diskSource="$(df --output='source' / | tail -1)" -diskSize="$(df -h --output='size' / | tail -1 | tr -cd '[:digit:].')" -diskSize=${diskSize%.*} -if [[ $diskSize -le 7 ]]; then - echo "$diskSource is only $diskSize gigs, which means it probably needs to be resized. Would you like to do this now?" - echo "Press y for yes or n for no followed by enter." - read -r continue - continue="${continue::1}" - if [[ "${continue,}" == "y" ]];then - # Extract base device name (handles mmcblk0p2, nvme0n1p2, sda2, etc.) - if [[ "$diskSource" =~ (.*[0-9]+)p[0-9]+$ ]]; then - # Handle mmcblk0p2, nvme0n1p2 style - diskDevice="${BASH_REMATCH[1]}" - else - # Handle sda2, sdb3 style - diskDevice="$(echo "$diskSource" | sed 's/[0-9]*$//')" - fi - echo "Yes" | sudo "${sudoFlags[@]}" parted ---pretend-input-tty "$diskDevice" resizepart 2 100% - sudo "${sudoFlags[@]}" resize2fs -f "$diskSource" - fi -fi - if ! ping -c1 stormux.org &> /dev/null ; then echo "No internet connection detected. Press enter to open NetworkManager." read -r continue @@ -103,39 +70,23 @@ if ping -qc1 -W 1 stormux.org &> /dev/null; then echo "Current date and time: $date_time" # set date and time date -s "$date_time" - echo "If your Pi does not have a CMOS battery and is powered off regularly, it may take a while for the time to be set correctly after boot." - echo "Stormux provides a service to sync the time after internet connection is established." - read -rp "Would you like the time to sync as soon as the Pi connects to the internet? " answer - answer="${answer:0:1}" - if [[ "${answer,,}" == "y" ]]; then - systemctl enable time_sync_at_boot.service - else - echo "Time sync at boot skipped." - echo "If you change your mind later, simply type:" - echo "sudo systemctl enable time_sync_at_boot.service" - fi set_timezone else echo "Please connect to the internet and run ${0##*/} again." exit 1 fi -echo "Installing configure-stormux..." -git -C /opt clone -q https://git.stormux.org/storm/configure-stormux || exit 1 echo echo "Initial setup is complete." echo -echo "The default passwords are stormux for the stormux user" -echo "and root for the root user. It is highly recommended to change them." -echo "To change the password for stormux, run:" -echo "passwd" -echo "To change the password for root, run:" -echo "sudo passwd" -echo -echo "For more configuration options, run configure-stormux," -echo "or you may configure your system manually." -echo -echo "Thank you for choosing Stormux." - - -exit 0 +read -rp "Would you like to run the Stormux installer? [y/N]: " answer +answer="${answer:0:1}" +if [[ "${answer,,}" == "y" ]]; then + install-stormux +else + echo + echo "To run the Stormux installer, type install-stormux" + echo + echo "Thank you for choosing Stormux." + exit 0 +fi diff --git a/x86_64/airootfs/usr/local/bin/install-stormux b/x86_64/airootfs/usr/local/bin/install-stormux index bdbe941..73e23f2 100755 --- a/x86_64/airootfs/usr/local/bin/install-stormux +++ b/x86_64/airootfs/usr/local/bin/install-stormux @@ -1352,155 +1352,150 @@ cleanup_and_unmount() { # Main installation flow # -main() { - echo "" - echo "╔════════════════════════════════════════════╗" - echo "║ Stormux Installer for Arch Linux ║" - echo "║ Accessibility-First System Installation ║" - echo "╚════════════════════════════════════════════╝" - echo "" +echo "" +echo "╔════════════════════════════════════════════╗" +echo "║ Stormux Installer for Arch Linux ║" +echo "║ Accessibility-First System Installation ║" +echo "╚════════════════════════════════════════════╝" +echo "" - log_info "=== Stormux Installer Started ===" - log_info "Installation log: $logFile" +log_info "=== Stormux Installer Started ===" +log_info "Installation log: $logFile" - # Pre-flight checks - if ! preflight_checks; then - log_error "Pre-flight checks failed" - exit 1 - fi +# Pre-flight checks +if ! preflight_checks; then + log_error "Pre-flight checks failed" + exit 1 +fi - # Disk selection - echo "=== Disk Selection ===" +# Disk selection +echo "=== Disk Selection ===" +echo "" +if ! select_disk targetDisk "Select target disk for Stormux installation:"; then + log_error "Target disk selection cancelled" + echo "Installation cancelled." + exit 1 +fi + +if ! confirm_disk_destruction "$targetDisk"; then + log_error "Disk destruction not confirmed" + echo "Installation cancelled." + exit 1 +fi + +# Partition layout selection +if ! select_partition_layout; then + log_error "Partition layout selection cancelled" + echo "Installation cancelled." + exit 1 +fi + +# If separate disk layout, select home disk +if [[ "$partitionLayout" == "separate_disk" ]]; then echo "" - if ! select_disk targetDisk "Select target disk for Stormux installation:"; then - log_error "Target disk selection cancelled" + if ! select_disk homeDisk "Select disk for /home partition:"; then + log_error "Home disk selection cancelled" echo "Installation cancelled." exit 1 fi - if ! confirm_disk_destruction "$targetDisk"; then - log_error "Disk destruction not confirmed" + if ! confirm_disk_destruction "$homeDisk"; then + log_error "Home disk destruction not confirmed" echo "Installation cancelled." exit 1 fi +fi - # Partition layout selection - if ! select_partition_layout; then - log_error "Partition layout selection cancelled" - echo "Installation cancelled." - exit 1 - fi +# Gather system information +if ! gather_system_info; then + log_error "System information gathering failed" + exit 1 +fi - # If separate disk layout, select home disk - if [[ "$partitionLayout" == "separate_disk" ]]; then - echo "" - if ! select_disk homeDisk "Select disk for /home partition:"; then - log_error "Home disk selection cancelled" - echo "Installation cancelled." - exit 1 - fi +# Partition disks +if ! partition_disks; then + log_error "Disk partitioning failed" + echo "ERROR: Disk partitioning failed" + play_sound error + exit 1 +fi - if ! confirm_disk_destruction "$homeDisk"; then - log_error "Home disk destruction not confirmed" - echo "Installation cancelled." - exit 1 - fi - fi +# Create filesystems +if ! create_filesystems; then + log_error "Filesystem creation failed" + echo "ERROR: Filesystem creation failed" + play_sound error + exit 1 +fi - # Gather system information - if ! gather_system_info; then - log_error "System information gathering failed" - exit 1 - fi +# Mount filesystems +if ! mount_filesystems; then + log_error "Filesystem mounting failed" + echo "ERROR: Filesystem mounting failed" + play_sound error + exit 1 +fi - # Partition disks - if ! partition_disks; then - log_error "Disk partitioning failed" - echo "ERROR: Disk partitioning failed" - play_sound error - exit 1 - fi - - # Create filesystems - if ! create_filesystems; then - log_error "Filesystem creation failed" - echo "ERROR: Filesystem creation failed" - play_sound error - exit 1 - fi - - # Mount filesystems - if ! mount_filesystems; then - log_error "Filesystem mounting failed" - echo "ERROR: Filesystem mounting failed" - play_sound error - exit 1 - fi - - # Install base system - if ! install_base_system; then - log_error "Base system installation failed" - cleanup_and_unmount - exit 1 - fi - - # Install audio configurations - if ! install_audio_configs; then - log_error "Audio configuration failed" - cleanup_and_unmount - exit 1 - fi - - # Configure system - if ! configure_system; then - log_error "System configuration failed" - cleanup_and_unmount - exit 1 - fi - - # Install bootloader - if ! install_bootloader; then - log_error "Bootloader installation failed" - cleanup_and_unmount - exit 1 - fi - - # Install helper scripts - if ! install_helper_scripts; then - log_warning "Helper script installation had issues (non-fatal)" - fi - - # Cleanup and unmount +# Install base system +if ! install_base_system; then + log_error "Base system installation failed" cleanup_and_unmount + exit 1 +fi - # Success message - echo "" - echo "╔════════════════════════════════════════════╗" - echo "║ Installation Complete Successfully! ║" - echo "╚════════════════════════════════════════════╝" - echo "" - echo "Next steps:" - echo " 1. Remove the installation media" - echo " 2. Reboot your system" - echo " 3. Log in with one of your user accounts: ${userNames[*]}" +# Install audio configurations +if ! install_audio_configs; then + log_error "Audio configuration failed" + cleanup_and_unmount + exit 1 +fi - if [[ "$desktopEnvironment" == "i3" ]]; then - echo " 4. Your i3 desktop is configured with I38 for accessibility" - echo " - I38 source is available in ~/git/I38 for customization" - echo " - Press Alt+Shift+F1 for I38 help after login" - echo " 5. Run 'configure-stormux' for additional setup" - else - echo " 4. Run 'configure-stormux' for additional setup" - fi +# Configure system +if ! configure_system; then + log_error "System configuration failed" + cleanup_and_unmount + exit 1 +fi - echo "" - echo "Installation log saved to: $logFile" - echo "" +# Install bootloader +if ! install_bootloader; then + log_error "Bootloader installation failed" + cleanup_and_unmount + exit 1 +fi - log_info "=== Stormux Installer Completed Successfully ===" +# Install helper scripts +if ! install_helper_scripts; then + log_warning "Helper script installation had issues (non-fatal)" +fi - read -rp "Press Enter to exit..." -} +# Cleanup and unmount +cleanup_and_unmount -# Run main installation -main "$@" +# Success message +echo "" +echo "╔════════════════════════════════════════════╗" +echo "║ Installation Complete Successfully! ║" +echo "╚════════════════════════════════════════════╝" +echo "" +echo "Next steps:" +echo " 1. Remove the installation media" +echo " 2. Reboot your system" +echo " 3. Log in with one of your user accounts: ${userNames[*]}" + +if [[ "$desktopEnvironment" == "i3" ]]; then + echo " 4. Your i3 desktop is configured with I38 for accessibility" + echo " - I38 source is available in ~/git/I38 for customization" + echo " - Press Alt+Shift+F1 for I38 help after login" + echo " 5. Run 'configure-stormux' for additional setup" +else + echo " 4. Run 'configure-stormux' for additional setup" +fi + +echo "" +echo "Installation log saved to: $logFile" +echo "" + +log_info "=== Stormux Installer Completed Successfully ===" + +read -rp "Press Enter to exit..."