Skip to content

Instantly share code, notes, and snippets.

@nik-gnomic
Last active October 12, 2024 09:41
Show Gist options
  • Save nik-gnomic/b67a754f3deff520b818734f65e1e692 to your computer and use it in GitHub Desktop.
Save nik-gnomic/b67a754f3deff520b818734f65e1e692 to your computer and use it in GitHub Desktop.
BASH script to merge .pacnew files in meld
#!/bin/bash
## ~/.local/bin/pacmeld
## Merge *.pacnew files with original configuration files
## requires pacman-contrib and meld
if [[ $(/usr/bin/pacdiff -o | /usr/bin/grep pacnew | /usr/bin/wc -l) == 0 ]]; then
echo " no .pacnew files found"
else
echo " .pacnew files found..."
# launch meld to merge file
for i in $(/usr/bin/pacdiff -o | grep -e pacnew); do
echo " Launching meld to merge $i with ${i/.pacnew/}"
sleep 2
/usr/bin/meld "admin://$i" "admin://${i/.pacnew/}"
# request deletion of .pacnew file
read -p "Delete $i? " -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo
sudo rm "$i"
echo "$i deleted"
else
echo
fi
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment