From 055cac8b8f30871e2b8c9808b9681d5d66544d87 Mon Sep 17 00:00:00 2001 From: Davide Cavalca Date: Mar 02 2025 00:13:07 +0000 Subject: [PATCH 1/3] Try a different approach for the existence tests in the setup script --- diff --git a/calamares-firstboot-config.spec b/calamares-firstboot-config.spec index a4863b3..b5479f1 100644 --- a/calamares-firstboot-config.spec +++ b/calamares-firstboot-config.spec @@ -53,6 +53,9 @@ cp -a calamares/* %{buildroot}%{_datadir}/calamares-asahi/ %{_datadir}/calamares-asahi/ %changelog +* Sat Mar 01 2025 Davide Cavalca - 20240509-6 +- Try a different approach for the existence tests in the setup script + * Sat Mar 01 2025 NoisyCoil - 20240509-5 - Do not use globs for existence tests in setup script diff --git a/setup.sh b/setup.sh index 6de213e..43d0d73 100755 --- a/setup.sh +++ b/setup.sh @@ -10,10 +10,18 @@ trap 'killall -9 kwin_wayland calamares plasmashell pipewire pipewire-pulse wire udevadm settle for i in $(seq 1 50); do - if find /dev/dri/by-path -name 'platform-*gpu-card' >/dev/null 2>&1 && \ - find /dev/dri/by-path -name 'platform-*display-subsystem-card' >/dev/null 2>&1; then - break - fi + gpu_found=0 + for f in /dev/dri/by-path/platform-*gpu-card; do + [ "$gpu_found" -eq 1 ] && break + if [ -e "$f" ]; then + for ff in /dev/dri/by-path/platform-*display-subsystem-card; do + if [ -e "$ff" ]; then + gpu_found=1 + break + fi + done + fi + done sleep 0.1 done # If we time out, just go ahead anyways and hope software rendering works. @@ -99,13 +107,16 @@ mkdir -p .config # Detect HiDPI embedded screens and configure things appropriately HIDPI=0 -if find /sys/class/drm -name 'card*-eDP-1' >/dev/null 2>&1; then - WIDTH=$(sort -n /sys/class/drm/card*-eDP-1/modes | sort -n | tail -n 1 | cut -dx -f1) - echo "Screen width: $WIDTH" - if [ "$WIDTH" -gt 2048 ]; then - HIDPI=1 +for f in /sys/class/drm/card*-eDP-1/modes; do + if [ -e "$f" ]; then + WIDTH=$(sort -n "$f" | sort -n | tail -n 1 | cut -dx -f1) + echo "Screen width: $WIDTH" + if [ "$WIDTH" -gt 2048 ]; then + HIDPI=1 + fi + break fi -fi +done cat > .config/kdeglobals < Date: Mar 02 2025 00:25:23 +0000 Subject: [PATCH 2/3] Fix some shellcheck warnings --- diff --git a/calamares-firstboot-config.spec b/calamares-firstboot-config.spec index b5479f1..d9cb7ac 100644 --- a/calamares-firstboot-config.spec +++ b/calamares-firstboot-config.spec @@ -1,6 +1,6 @@ Name: calamares-firstboot-config Version: 20240509 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Fedora Asahi Calamares firstboot configs License: MIT @@ -55,6 +55,7 @@ cp -a calamares/* %{buildroot}%{_datadir}/calamares-asahi/ %changelog * Sat Mar 01 2025 Davide Cavalca - 20240509-6 - Try a different approach for the existence tests in the setup script +- Fix some shellcheck warnings * Sat Mar 01 2025 NoisyCoil - 20240509-5 - Do not use globs for existence tests in setup script diff --git a/setup.sh b/setup.sh index 43d0d73..ff050e5 100755 --- a/setup.sh +++ b/setup.sh @@ -2,9 +2,9 @@ . /etc/os-release -WALLPAPER_FILE="/usr/share/backgrounds/default.png" +WALLPAPER_FILE='/usr/share/backgrounds/default.png' -trap 'killall -9 kwin_wayland calamares plasmashell pipewire pipewire-pulse wireplumber speech-dispatcher kaccess; pkill -9 -f at-spi2' EXIT SIGINT SIGTERM +trap 'killall -9 kwin_wayland calamares plasmashell pipewire pipewire-pulse wireplumber speech-dispatcher kaccess; pkill -9 -f at-spi2' EXIT INT TERM # Wait for the drivers to load udevadm settle @@ -27,24 +27,24 @@ done # If we time out, just go ahead anyways and hope software rendering works. # Configure the default keyboard layout -country="00" +country='00' for country_file in $(find /sys/devices/platform -name country -path '*05AC:*'); do [ -z "$country_file" ] && continue cc=$(cat "$country_file") - if [ "$cc" != "00" ]; then + if [ "$cc" != '00' ]; then country="$cc" fi done case "$country" in 0d) - xkbmodel=applealu_iso + xkbmodel='applealu_iso' ;; 0f) - xkbmodel=applealu_jis + xkbmodel='applealu_jis' ;; 21) - xkbmodel=applealu_ansi + xkbmodel='applealu_ansi' ;; esac @@ -54,55 +54,55 @@ if [ -e /proc/device-tree/chosen/asahi,kblang-code ]; then fi case "$kblang" in - 00000001) xkblayout=de;; - 00000002) xkblayout=fr;; - 00000003) xkblayout=jp;; - 00000004) xkblayout=us; xkbvariant=intl;; - 00000005) xkblayout=us;; - 00000006) xkblayout=gb;; - 00000007) xkblayout=es;; - 00000008) xkblayout=se;; - 00000009) xkblayout=it;; - 0000000a) xkblayout=ca; xkbvariant=multi;; - 0000000b) xkblayout=cn;; - 0000000c) xkblayout=dk;; - 0000000d) xkblayout=be;; - 0000000e) xkblayout=no;; - 0000000f) xkblayout=kr106;; - 00000010) xkblayout=nl;; - 00000011) xkblayout=ch;; - 00000012) xkblayout=tw;; - 00000013) xkblayout=ara;; - 00000014) xkblayout=bg;; - 00000015) xkblayout=hr;; - 00000016) xkblayout=cz;; - 00000017) xkblayout=gr;; - 00000018) xkblayout=il;; - 00000019) xkblayout=is;; - 0000001a) xkblayout=hu;; - 0000001b) xkblayout=pl;; - 0000001c) xkblayout=pt;; - 0000001d) xkblayout=ir;; - 0000001e) xkblayout=ro;; - 0000001f) xkblayout=ru; xkbvariant=mac;; - 00000020) xkblayout=sk;; - 00000021) xkblayout=th;; - 00000022) xkblayout=tr;; # "Turkish-QWERTY-PC"? - 00000023) xkblayout=tr;; # "Turkish"? - 00000024) xkblayout=ua; xkbvariant=macOS;; - 00000025) xkblayout=tr;; # "Turkish-Standard"? - 00000026) xkblayout=latam;; + 00000001) xkblayout='de';; + 00000002) xkblayout='fr';; + 00000003) xkblayout='jp';; + 00000004) xkblayout='us'; xkbvariant='intl';; + 00000005) xkblayout='us';; + 00000006) xkblayout='gb';; + 00000007) xkblayout='es';; + 00000008) xkblayout='se';; + 00000009) xkblayout='it';; + 0000000a) xkblayout='ca'; xkbvariant='multi';; + 0000000b) xkblayout='cn';; + 0000000c) xkblayout='dk';; + 0000000d) xkblayout='be';; + 0000000e) xkblayout='no';; + 0000000f) xkblayout='kr106';; + 00000010) xkblayout='nl';; + 00000011) xkblayout='ch';; + 00000012) xkblayout='tw';; + 00000013) xkblayout='ara';; + 00000014) xkblayout='bg';; + 00000015) xkblayout='hr';; + 00000016) xkblayout='cz';; + 00000017) xkblayout='gr';; + 00000018) xkblayout='il';; + 00000019) xkblayout='is';; + 0000001a) xkblayout='hu';; + 0000001b) xkblayout='pl';; + 0000001c) xkblayout='pt';; + 0000001d) xkblayout='ir';; + 0000001e) xkblayout='ro';; + 0000001f) xkblayout='ru'; xkbvariant='mac';; + 00000020) xkblayout='sk';; + 00000021) xkblayout='th';; + 00000022) xkblayout='tr';; # "Turkish-QWERTY-PC"? + 00000023) xkblayout='tr';; # "Turkish"? + 00000024) xkblayout='ua'; xkbvariant='macOS';; + 00000025) xkblayout='tr';; # "Turkish-Standard"? + 00000026) xkblayout='latam';; esac if [ -n "$xkblayout" ] && [ -n "$xkbmodel" ]; then - localectl set-x11-keymap $xkblayout $xkbmodel $xkbvariant + localectl set-x11-keymap "$xkblayout" "$xkbmodel" "$xkbvariant" fi # Create a dummy home directory for Calamares export HOME="/run/user/0/calamares-home" rm -rf "$HOME" mkdir -p "$HOME" -cd $HOME +cd "$HOME" mkdir -p .config # Detect HiDPI embedded screens and configure things appropriately @@ -165,7 +165,7 @@ currentActivity=1d1809e0-5c93-4423-b0f3-93646408cfa6 EOF # Set up HiDPI configs for sddm (on <=F39 only ) -if [ "$HIDPI" == 1 ] && [ "$VERSION_ID" -lt 40 ]; then +if [ "$HIDPI" -eq 1 ] && [ "$VERSION_ID" -lt 40 ]; then mkdir -p /etc/sddm.conf.d/ cat > /etc/sddm.conf.d/dpi.conf < Date: Mar 02 2025 00:43:54 +0000 Subject: [PATCH 3/3] More robust GPU detection --- diff --git a/calamares-firstboot-config.spec b/calamares-firstboot-config.spec index d9cb7ac..0248d03 100644 --- a/calamares-firstboot-config.spec +++ b/calamares-firstboot-config.spec @@ -56,6 +56,7 @@ cp -a calamares/* %{buildroot}%{_datadir}/calamares-asahi/ * Sat Mar 01 2025 Davide Cavalca - 20240509-6 - Try a different approach for the existence tests in the setup script - Fix some shellcheck warnings +- More robust GPU detection * Sat Mar 01 2025 NoisyCoil - 20240509-5 - Do not use globs for existence tests in setup script diff --git a/setup.sh b/setup.sh index ff050e5..0019916 100755 --- a/setup.sh +++ b/setup.sh @@ -9,10 +9,9 @@ trap 'killall -9 kwin_wayland calamares plasmashell pipewire pipewire-pulse wire # Wait for the drivers to load udevadm settle +gpu_found=0 for i in $(seq 1 50); do - gpu_found=0 for f in /dev/dri/by-path/platform-*gpu-card; do - [ "$gpu_found" -eq 1 ] && break if [ -e "$f" ]; then for ff in /dev/dri/by-path/platform-*display-subsystem-card; do if [ -e "$ff" ]; then @@ -21,7 +20,9 @@ for i in $(seq 1 50); do fi done fi + [ "$gpu_found" -eq 1 ] && break done + [ "$gpu_found" -eq 1 ] && break sleep 0.1 done # If we time out, just go ahead anyways and hope software rendering works.