diff --git a/install/preflight/all.sh b/install/preflight/all.sh index 883546594f1..deb882dd3ba 100644 --- a/install/preflight/all.sh +++ b/install/preflight/all.sh @@ -2,6 +2,8 @@ source $OMARCHY_INSTALL/preflight/guard.sh source $OMARCHY_INSTALL/preflight/begin.sh run_logged $OMARCHY_INSTALL/preflight/show-env.sh run_logged $OMARCHY_INSTALL/preflight/pacman.sh +run_logged $OMARCHY_INSTALL/preflight/arm.sh +run_logged $OMARCHY_INSTALL/preflight/asahi.sh run_logged $OMARCHY_INSTALL/preflight/migrations.sh run_logged $OMARCHY_INSTALL/preflight/first-run-mode.sh run_logged $OMARCHY_INSTALL/preflight/disable-mkinitcpio.sh diff --git a/install/preflight/arm.sh b/install/preflight/arm.sh new file mode 100644 index 00000000000..930867da574 --- /dev/null +++ b/install/preflight/arm.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# Auto-detect ARM architecture and set flag +arch=$(uname -m) +if [[ "$arch" == "aarch64" || "$arch" == "arm64" ]]; then + export OMARCHY_ARM=true + echo "Auto-detected ARM architecture: $arch" + echo "Setting OMARCHY_ARM=true" + + # Patch envs.conf for aarch64 - add Vulkan ICD for walker + envs_file="$HOME/.local/share/omarchy/default/hypr/envs.conf" + if [[ -f "$envs_file" ]]; then + # Check if the Vulkan ICD line already exists + if ! grep -q "VK_ICD_FILENAMES" "$envs_file"; then + echo "Patching envs.conf for aarch64..." + # Find the last env line and add the Vulkan ICD after it + last_env_line=$(grep -n "^env = " "$envs_file" | tail -1 | cut -d: -f1) + if [[ -n "$last_env_line" ]]; then + sed -i "${last_env_line}a\\\\n# Required for walker on aarch64\\nenv = VK_ICD_FILENAMES,/usr/share/vulkan/icd.d/lvp_icd.aarch64.json" "$envs_file" + fi + fi + fi + +fi diff --git a/install/preflight/asahi.sh b/install/preflight/asahi.sh new file mode 100644 index 00000000000..9320f8182f4 --- /dev/null +++ b/install/preflight/asahi.sh @@ -0,0 +1,118 @@ +#!/bin/bash + +# Prerequisites for installing Omarchy on a m-series macbook +# +# 1. Follow these instructions: https://asahi-alarm.org/ and choose the minimal installation (1) +# 2. Set up wifi and install wget +# 3. Run the omarchy install command + +# Asahi Linux ARM setup script for Omarchy +# This script automates the post-Asahi installation steps for MacBook M-series + +# Check if we're on Asahi Linux and need initial setup +if [ "$EUID" -eq 0 ] && [ "$(uname -m)" = "aarch64" ]; then + + # Check for Asahi indicators + if grep -qi "asahi" /etc/os-release 2>/dev/null || + uname -r | grep -qi "asahi" || + pacman -Q linux-asahi &>/dev/null || + pacman -Q asahi-scripts &>/dev/null; then + + echo "Detected Asahi Linux - running initial setup..." + + # install gum and asahi specific packages + pacman -S --needed --noconfirm \ + gum \ + asahi-audio \ + pipewire-alsa \ + pipewire-jack \ + pipewire-pulse + + set -e + + # Check if running as root (required for initial setup) + if [ "$EUID" -ne 0 ]; then + echo "This script must be run as root for initial setup" + echo "Please run: sudo bash $0" + exit 1 + fi + + echo "==================================" + echo "Omarchy Asahi Linux Setup" + echo "==================================" + echo + + # Check if user already exists + echo "Setting up user account..." + existing_users=$(awk -F: '$3 >= 1000 && $1 != "nobody" {print $1}' /etc/passwd) + + if [ -n "$existing_users" ]; then + echo "Found existing users: $existing_users" + use_existing=$(gum confirm "Use an existing user account?" && echo "yes" || echo "no") + + if [ "$use_existing" = "yes" ]; then + username=$(echo "$existing_users" | gum choose --header "Select user:") + else + username=$(gum input --placeholder "Enter new username") + fi + else + username=$(gum input --placeholder "Enter username for Omarchy") + fi + + # Create user if doesn't exist + if ! id "$username" &>/dev/null; then + echo "Creating user $username..." + useradd -m "$username" + + echo "Setting password for $username..." + while true; do + password=$(gum input --password --placeholder "Enter password for $username") + password_confirm=$(gum input --password --placeholder "Confirm password") + + if [ "$password" = "$password_confirm" ]; then + echo "$username:$password" | chpasswd + break + else + echo "Passwords don't match. Please try again." + fi + done + + # Add to wheel group for sudo access + usermod -aG wheel "$username" + echo "Added $username to wheel group" + fi + + # Enable sudo for wheel group + echo "Configuring sudo access..." + if grep -q "^# %wheel ALL=(ALL:ALL) ALL" /etc/sudoers; then + sed -i 's/^# %wheel ALL=(ALL:ALL) ALL/%wheel ALL=(ALL:ALL) ALL/' /etc/sudoers + echo "Enabled sudo for wheel group" + elif ! grep -q "^%wheel ALL=(ALL:ALL) ALL" /etc/sudoers; then + echo "%wheel ALL=(ALL:ALL) ALL" >>/etc/sudoers + echo "Added wheel group to sudoers" + fi + + # User setup complete - provide instructions to continue the Omarchy installation + echo + echo "==================================" + echo "Initial setup complete!" + echo "==================================" + echo + echo "Please follow these steps to continue:" + echo + echo "1. Log in as user: $username" + echo + echo " su - $username" + echo + echo "2. Run the following command to continue installation:" + echo + echo " wget -qO- https://omarchy.org/install | bash" + echo + echo "==================================" + echo + + # Exit the script here so it doesn't continue with the rest of install.sh + exit 0 + + fi +fi diff --git a/install/preflight/guard.sh b/install/preflight/guard.sh index 60a6c87363f..ff3812994d4 100644 --- a/install/preflight/guard.sh +++ b/install/preflight/guard.sh @@ -15,9 +15,6 @@ done # Must not be running as root [ "$EUID" -eq 0 ] && abort "Running as root (not user)" -# Must be x86 only to fully work -[ "$(uname -m)" != "x86_64" ] && abort "x86_64 CPU" - # Must not have Gnome or KDE already install pacman -Qe gnome-shell &>/dev/null && abort "Fresh + Vanilla Arch" pacman -Qe plasma-desktop &>/dev/null && abort "Fresh + Vanilla Arch"