Cleaning / Merge pacnew files

With so many folks trying out of the different OS lately, how many good folks remembered to check out those pacnew files on their Arch/Archbase OS.
Been a while myself with all the OS that I use so using Meld today and have been happy with it over the last few years.
What do you good folks use?

1 Like

Good idea in there @sammiev

1 Like

To be honest I have never bothered. Time to look into it.

1 Like

Try pacdiff(8) from the pacman-contrib package.

See also https://wiki.archlinux.org/index.php/Pacman/Pacnew_and_Pacsave#Managing_.pac*_files

2 Likes

I use a little script to open each in an editor (nvim diff mode -d), I only do this once and a while though. Never knew about pacdiff before but it’s quite nice as well.

#!/bin/bash

(( UID == 0 )) || { echo "$(basename "$0"): must be run as root" >&2; exit 1; }

typeset -a new
mapfile -t new <<< "$(find /etc -type f -name '*.pacnew')"

for f in "${new[@]}"; do
    nvim -d "$f" "${f%.pacnew}"
    read -re -p "Remove $f? [Y/n]: "
    [[ ${REPLY^} == "N" ]] && continue
    rm -v "$f"
done
2 Likes

Simpler version:

    read -re -p "Remove $f? [Y/n]: "
    [[ ${REPLY^} == "N" ]] && continue
4 Likes

Nice, never thought about changing the case to simplify the condition.

3 Likes

There is just so many ways of doing the job. I like this one myself.

DIFFPROG+meld pacdiff

2 Likes

I knew nothing of this til it came up one day in the Manjaro forum a couple of years ago when i still lived there. Various theme variations were posted, & eventually i co-opted one i liked into this simple script i run after bigger updates in my various Archies.

Summary
#!/bin/bash

#  2/7/18:   Handy technique:   https://forum.manjaro.org/t/pacsave-pacnew-how-to-manage-those-reasonably/50968/26

echo "When prompted in the terminal to edit the files simply select the “View” option and it will automatically open the 2 file versions side by side in Kompare (24/11/19 Changed to Meld) for merging."

# sudo -H DIFFPROG=kompare pacdiff
sudo -H DIFFPROG=meld pacdiff

echo "Pls close this window now"

I’m a numpty with a craptitudinous memory, so i tend to use my bash scripts not only to do jobs, but also to remind me what to do, why i’m doing it, & sometimes pertinent history. I imagine that pretty soon i’ll be needing to add extra echoes to remind me to cook dinner, get another coffee, check if it’s day or night… :roll_eyes:

3 Likes