my dotfiles for arch
at main 726 B view raw
1#!/bin/bash 2set -e 3 4ENTRY_DIR="/efi/loader/entries" 5BACKUP_DIR="${ENTRY_DIR}/backup-$(date +%F-%H%M%S)" 6EDID_PARAM="drm.edid_firmware=DP-1:edid/g80.bin" 7 8echo "Backing up boot entries..." 9sudo mkdir -p "$BACKUP_DIR" 10sudo cp -v "${ENTRY_DIR}"/*.conf "$BACKUP_DIR" 11 12echo "Adding EDID parameter to boot entry files..." 13for file in "${ENTRY_DIR}"/*.conf; do 14 if grep -q "$EDID_PARAM" "$file"; then 15 echo "Already present in $(basename "$file"), skipping." 16 continue 17 fi 18 19 # Use | as delimiter to avoid issues with '/' 20 sudo sed -i "s|^options|& ${EDID_PARAM}|" "$file" 21 echo "Updated $(basename "$file")" 22done 23 24echo 25echo "All done!" 26echo "Backup saved to: $BACKUP_DIR" 27echo "Reboot to apply changes."