Last active
April 7, 2023 14:31
-
-
Save metalefty/3a52837be28da46f2abd268f23ccf75a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -xe | |
MOUNTPOINT=$(mktemp -d) | |
CHECKSUM=$(mktemp) | |
LODEV=$(losetup -f) | |
IMAGE_FILE=AlmaLinux-9-RaspberryPi-GNOME-latest.aarch64.raw.xz | |
IMAGE_URL=$(curl -s https://mirrors.almalinux.org/mirrorlist/9/raspberrypi/ | \ | |
sort -R | head -n1 | grep -o "^.*almalinux/" )/9/raspberrypi/images/ | |
cd /tmp | |
wget -c ${IMAGE_URL}CHECKSUM | |
wget -c ${IMAGE_URL}${IMAGE_FILE} | |
grep ${IMAGE_FILE} CHECKSUM > ${CHECKSUM} | |
sha256sum --check ${CHECKSUM} | |
xz -k -d ${IMAGE_FILE} | |
sudo -v | |
sudo partx -a ${IMAGE_FILE//.xz/} | |
sudo mount ${LODEV}p3 ${MOUNTPOINT} | |
sudo bash -c "echo 'blacklist brcmfmac' > ${MOUNTPOINT}/etc/modprobe.d/raspi-blacklist.conf" | |
cat -n ${MOUNTPOINT}/etc/modprobe.d/raspi-blacklist.conf | |
sudo umount ${MOUNTPOINT} | |
sudo losetup -d ${LODEV} | |
rmdir ${MOUNTPOINT} | |
rm -f ${CHECKSUM} | |
echo "Finished! ${IMAGE_FILE//.xz/} has been modified for Pi 3!". |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See also: AlmaLinux/raspberry-pi#17