Open cornytrace opened 3 years ago
Does this work?
#!/usr/bin/bash
for FILE in $(pacdiff -o | grep "/*.pacnew");
do
p3wm ${FILE}
done
That absolutely works, however it would be nice to have it integrated into the program so remembering/typing the script or making an alias isn't necessary. Losing pacdiff as a dependency would also be nice.
I think I see a way to integrate it but it would require using my script as main()
and checking for a specific flag/arg else passing to the original function. Maybe $p3wm find
would work. I'm not sure how to find .pacnew files efficiently without $pacdiff -o
but I'm fairly certain that most people looking at this would have it installed.
pacdiff does nothing more nothing less than find/mlocate on the /etc dir, you can check the code and see for yourself you can replicate the behaviour of pacdiff -o trivially with:
find /etc -name '*.pacnew'
and integrate it with p3wm with:
find /etc -name '*.pacnew' -exec p3wm {} \;
I checked the code and saw for myself ;) Looking at the contents of /usr/bin/pacdiff
, it seems that the default behaviour of pacdiff is to scan /var/lib/pacman/local/*/files
(it also has --locate
and --find
options that make it use those instead). As @cornytrace mentioned, the default behaviour also finds files outside of /etc
.
By the way I'm currently using pacdiff --output | grep "/*.pacnew" | xargs --max-args=1 --no-run-if-empty --open-tty sudo p3wm
(I took the solution from @mberlinger3 but used xargs instead of a for-loop). Personally I'm fine with having a dependency on pacdiff.
Any update on this?
Now I'm questioning myself why I wrote this script in the first place instead of just using pacdiff.
I am new to this .pacsave & .pacnew concept.
Found this on archwiki, currently i have pacdiff
p3wm
and pacdiff-pacman-hook-git
. What benefit does p3wm
provides over default pacdiff
? Also pacdiff-pacman-hook-git
launches pacdiff
, is there a way to have same behaviour for p3wm
.
Note - i just installed these 3 and haven't seen them in action yet.
(back from another hiatus)
@KAGEYAM4 right now, p3wm doesn't provide any benefits over pacdiff. p3wm was developed as an accident since I didn't know pacdiff exists. But hey, now I can start piling new features onto this project without anyone else's permission.
Regarding a pacman hook for p3wm: this will be a different issue: #23
Back to the original topic of this issue: if p3wm would support automatic finding of .pacnew files, it'll probably just copy the logic of pacdiff -o -p
: reads potential .pacnew files from pacman DB. If a user wants to find the files in a different way they'll probably have to write their own glue script.
p3wm doesn't provide any benefits over pacdiff
p3wm provides a way to perform a three-way diff (using tools that support such a merge operation, such as meld), which is the primary reason why I looked into p3wm in the first place, though I admit it was only today because I've been neglecting pacnew updates in the past.
To me, it's rather that if p3wm has a way to automatically find remaining pacnew files, I wouldn't need to use pacdiff anymore to find these. However, piping the result of pacdiff --output
into p3wm is fine for me and also allows for some flexibility like filtering out files you don't care about merging like the mirrorlist.
This already very useful program can be made even better by adding a mode in the vein of etc-update where it automatically finds all .pacnew files for quick and easy resolving after a large update, and to find .pacnew files you didn't even knew existed on your system.