diff --git a/pi4/build/build-stormux.sh b/pi4/build/build-stormux.sh index 71c96cf..3613d97 100755 --- a/pi4/build/build-stormux.sh +++ b/pi4/build/build-stormux.sh @@ -38,8 +38,9 @@ cleanup() { losetup --detach "${loopdev}" || true fi - if [[ -n "${imageFileName:-}" ]]; then - rm "${imageFileName}" + # Clean up temporary pacman config directory + if [[ -n "${tmpDir:-}" && -d "${tmpDir:-}" ]]; then + rm -rf "${tmpDir}" fi exit "$status" @@ -117,7 +118,7 @@ if [[ "$(uname -m)" == "x86_64" ]]; then exit 1 fi fi -for i in arch-install-scripts dosfstools parted wget ; do +for i in arch-install-scripts dosfstools parted ; do if ! pacman -Q $i &> /dev/null ; then echo "Please install $i before continuing." exit 1 @@ -125,9 +126,6 @@ for i in arch-install-scripts dosfstools parted wget ; do done -# Url for the aarch64 image to be downloaded. -imageUrl="http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-aarch64-latest.tar.gz" - fallocate -l "$imageSize" "$imageName" loopdev="$(losetup --find --show "${imageName}")" parted --script "${loopdev}" mklabel msdos mkpart primary fat32 0% 512M mkpart primary ext4 512M 100% @@ -138,9 +136,46 @@ mkdir /mnt/boot mount "${loopdev}p1" /mnt/boot # Things are mounted now, so set mounted to 0 (bash true) mounted=0 -imageFileName=$(mktemp -p . ArchLinuxARM-rpi-aarch64-XXXXXX.tar.gz) -wget "${imageUrl}" -O "${imageFileName}" -bsdtar -xpf "${imageFileName}" -C /mnt + +# Set up temporary pacman configuration for ARM bootstrap +echo "Setting up pacman configuration for aarch64..." +tmpDir=$(mktemp -d) +mkdir -p "${tmpDir}/pacman.d" + +# Create mirrorlist for Arch Linux ARM +cat > "${tmpDir}/pacman.d/mirrorlist" << 'MIRRORLIST' +Server = http://mirror.archlinuxarm.org/$arch/$repo +Server = http://fl.us.mirror.archlinuxarm.org/$arch/$repo +Server = http://il.us.mirror.archlinuxarm.org/$arch/$repo +Server = http://tx.us.mirror.archlinuxarm.org/$arch/$repo +Server = http://nj.us.mirror.archlinuxarm.org/$arch/$repo +MIRRORLIST + +# Create pacman.conf for ARM +cat > "${tmpDir}/pacman.conf" << PACMANCONF +[options] +HoldPkg = pacman glibc +Architecture = aarch64 +CheckSpace +SigLevel = Never +LocalFileSigLevel = Never + +[core] +Include = ${tmpDir}/pacman.d/mirrorlist + +[extra] +Include = ${tmpDir}/pacman.d/mirrorlist + +[alarm] +Include = ${tmpDir}/pacman.d/mirrorlist +PACMANCONF + +# Bootstrap the system with pacstrap +echo "Running pacstrap to install base system..." +pacstrap -c -G -M -C "${tmpDir}/pacman.conf" /mnt base base-devel linux-rpi raspberrypi-bootloader firmware-raspberrypi archlinuxarm-keyring + +# Clean up temporary config +rm -rf "${tmpDir}" # Copy override files into place before chroot (except skel to avoid conflicts) cp -rv ../files/boot/* /mnt/boot @@ -152,6 +187,8 @@ find ../files/etc -mindepth 1 -maxdepth 1 ! -name skel -exec cp -rv {} /mnt/etc/ PS1="(Chroot) [\u@\h \W] \$" arch-chroot /mnt << EOF echo "Chroot started." set -euo pipefail +# Disable pacman sandboxing (doesn't work in chroot) +sed -i '/^\[options\]/a DisableSandbox' /etc/pacman.conf # set up pacman pacman-key --init pacman-key --populate archlinuxarm @@ -203,9 +240,6 @@ else fi pacman -Syy -# Change to the Pi kernel for aarch64 -pacman -R --noconfirm linux-aarch64 uboot-raspberrypi -pacman -S --noconfirm linux-rpi # Install all packages (stormux repo has priority since it's listed first) packages=( @@ -218,10 +252,12 @@ packages=( bluez-utils brltty cronie + dialog espeak-ng fake-hwclock fenrir firmware-raspberrypi + linux-firmware git gstreamer gst-plugins-base @@ -260,6 +296,18 @@ packages=( pacman -Su --needed --noconfirm "\${packages[@]}" +# Fix mkinitcpio preset for linux-rpi - kms hook fails on aarch64 +# See: https://archlinuxarm.org/forum/viewtopic.php?t=16672 +if [[ -f /etc/mkinitcpio.d/linux-rpi.preset ]]; then + echo "Configuring mkinitcpio preset to skip kms hook..." + sed -i "s/^default_options=.*/default_options=\"--skiphook kms\"/" /etc/mkinitcpio.d/linux-rpi.preset + sed -i "s/^fallback_options=.*/fallback_options=\"-S autodetect --skiphook kms\"/" /etc/mkinitcpio.d/linux-rpi.preset +fi + +# Regenerate initramfs with the corrected settings +echo "Regenerating initramfs..." +mkinitcpio -P + # Restart gpg agents. gpgconf --kill all # set the language @@ -272,8 +320,8 @@ systemctl enable rngd.service # Set the distribution name. echo 'Stormux \r (\l)' > /etc/issue echo >> /etc/issue -# Change the alarm user to be stormux -usermod -a -g users -G wheel,realtime,audio,video,network,brlapi -m -d /home/stormux -l stormux alarm +# Create the stormux user +useradd -m -g users -G wheel,realtime,audio,video,network,brlapi -s /bin/bash stormux # Grant sudo privileges to the stormux user for package installation. echo 'stormux ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers.d/wheel # Set the password for the root user @@ -324,6 +372,9 @@ done pacman -Sc --noconfirm +# Re-enable pacman sandboxing for the final image +sed -i '/^DisableSandbox/d' /etc/pacman.conf + EOF # Copy skel files to stormux user home (after user rename in chroot) diff --git a/pi4/files/etc/RHVoice/dicts/English/wordfix.txt b/pi4/files/etc/RHVoice/dicts/English/wordfix.txt index bb1ba04..fcdf4c9 100644 --- a/pi4/files/etc/RHVoice/dicts/English/wordfix.txt +++ b/pi4/files/etc/RHVoice/dicts/English/wordfix.txt @@ -1,12 +1,15 @@ asus=aysus certificate=cirtifficate douche=doosh* -nginx=enginex -freenginx=freeenginex espeak=easpeak* +freenginx=freeenginex +git=ghit* +github=ghittehub +gitea=ghittee jolla=yolla jenux=jennux lightnin=lighttnin +nginx=enginex rhvoice=ahraychvoice shit=shitt sync=sink* diff --git a/x86_64/airootfs/etc/RHVoice/dicts/English/wordfix.txt b/x86_64/airootfs/etc/RHVoice/dicts/English/wordfix.txt index bb1ba04..fcdf4c9 100644 --- a/x86_64/airootfs/etc/RHVoice/dicts/English/wordfix.txt +++ b/x86_64/airootfs/etc/RHVoice/dicts/English/wordfix.txt @@ -1,12 +1,15 @@ asus=aysus certificate=cirtifficate douche=doosh* -nginx=enginex -freenginx=freeenginex espeak=easpeak* +freenginx=freeenginex +git=ghit* +github=ghittehub +gitea=ghittee jolla=yolla jenux=jennux lightnin=lighttnin +nginx=enginex rhvoice=ahraychvoice shit=shitt sync=sink*