Pacmerge -- merge .pacnew files

pacmerge is a simple (80-line) program to interactively merge .pacnew files with sdiff.
https://aur.archlinux.org/packages.php?ID=52485
Why another such program? For two main reasons:
1. Most others use the wronganother program to merge (e.g. vimdiff, kdiff (eww), &c.), which is difficult to change
2. Haskell is nicer than bash
Last edited by strake (2011-11-26 18:27:40)

karol wrote:
doublerebel wrote:I don't care for the obtuse UI of vimdiff
Use can use regular diff if you want.
Or e.g. meld.
I am aware of the other suggested options, I'm not as noob as my post count appears.  Diff does not merge files.  Copy and paste between files in a terminal while referencing the diff is not a simple task.  Meld is GUI-only.
There is definitely a place for a simple CLI .pacnew interactive merge tool. Diffpac/pacdiffviewer is close, but without documentation and also uses vimdiff -- although at least Diffpac has almost no dependencies.
Most of the .pacnew configuration updates are trivial (thanks to Arch's clean structure and upgrade process), and therefore merging should be trivial as well.  .pacnew merging is a bump in Arch's otherwise smooth rolling upgrades.

Similar Messages

  • (SOLVED) Trouble merging .pacnew files with meld

    Dear Archers
    Unable to merge .pacnew files, following the example on ArchWiki. Only, the difference between the two files shown
    [root@KRISHNA san2ban]# #!/bin/bash
    [root@KRISHNA san2ban]# # pacnew-update - merge *.pacnew files with original configurations with meld
    [root@KRISHNA san2ban]#
    [root@KRISHNA san2ban]# pacnew=$(find /etc -type f -name "*.pacnew")
    [root@KRISHNA san2ban]#
    [root@KRISHNA san2ban]# for config in $pacnew; do
    > # Merge with meld
    > gksu meld ${config%\.*} $config &
    > wait
    > done
    [1] 1578
    GConf Error: Failed to contact configuration server; the most common cause is a missing or misconfigured D-Bus session bus daemon. See http://projects.gnome.org/gconf/ for information. (Details - 1: Failed to get connection to session: The connection is closed)
    GConf Error: Failed to contact configuration server; the most common cause is a missing or misconfigured D-Bus session bus daemon. See http://projects.gnome.org/gconf/ for information. (Details - 1: Failed to get connection to session: The connection is closed)
    Also, on the Archwiki, we are advised to change 'kdesu' to 'gksudo' for GNOME, but I think it should be gksu
    Last edited by San2ban (2011-08-18 14:07:53)

    San2ban wrote:
    Dear Karol
    Thanks. yes, manual intervention is needed
    Wonder how it will be without you guy's guiding us
    You bet your ass, manual intervention is needed. If you try to blindly just merge *.pacnew with original files, it might lead to an unbootable system. Especially when you get pacnew files for /etc/group and /etc/inittab

  • Tool for merging pacnew files ??

    Hi all,
    Is there a program available that are able to merge a .pacnew file with the existing files, instead of doing this manually ??
    Maybe vim can do this but I am not sure ??
    It would be nice to do this quickly to save time !!
    Last edited by niller (2008-03-11 12:02:08)

    niller wrote:Maybe vim can do this but I am not sure ??
    Yup, try this from a terminal:
    $ vimdiff /etc/conf /etc/conf.pacnew
    Last edited by tom5760 (2008-03-11 13:53:21)

  • Pacnew_scripts: scripts to merge some .pacnew files after an upgrade

    info page: http://xyne.archlinux.ca/info/pacnew_scripts
    I was updating my old system which doesn't get turned on that often and had to deal with about 15 pacnew files. Most only required a simple "mv /path/to/file{.pacnew,}" but some required merging. I found a script that I had written a while ago to merge /etc/group.pacnew, made some changes, made a copy which can handle gshadow, then wrote scripts to handle the pacman mirrorlist and locale.gen.
    Thus the pacnew_scripts package was born.
    infopage wrote:
    This package contains scripts which can help merge .pacnew files after a pacman upgrade. These scripts print their results to STDOUT and thus do NOT make any changes to the files. It is up to the user to inspect the output and, if satisfied, redirect it to the original file and then delete the .pacnew file.
    The scripts accept "-c" and "--compare" as options and will display relevant information about differences between the files. For group and gshadow, this will display 3 columns to compare the original, .pacnew and merged files and will use colors to highlight changes. For the mirrorlist and locale.gen, it will check that all settings in the original file are available in the new file and print out a list of any that aren't (e.g. if one of your current mirrors has been dropped from the mirrorlist, it will be listed in the output).
    I'll probably add scripts as I go. I might also merge the scripts to avoid some redundancy but I decided to keep them simple for now. merge_pacnew_locale_gen is actually very generic and works on the mirrorlist and probably other files as well. If you find any, let me know.
    Last edited by Xyne (2010-03-21 13:03:34)

    beroal wrote:
    I'm really astonished that you interpreted my post as an advertisement of "diffpac".
    Xyne wrote:Have you even tried these scripts and compared them to the alternatives that you've proposed? … you can at least post comments based on an informed comparison.
    I expected such a comparison from you. If "pacnew_scripts" merges files automatically, what algorithm does it use?
    I didn't interpret it as advertisement. It seemed that you read the basic description of what this does and concluded that something else already does the same thing. Following on the tail of the previous posts I felt that your post was somewhat rude because it implies that this is useless. Obviously that is relative, but even so I see no point of posting in this thread to express it, even indirectly.
    I admit that I may have interpreted your post the wrong way and if I did then I apologize, but even then I don't understand why you felt the need to post what you did in a contribution thread.
    As for algorithms, there are different scripts and they use different algorithms. The group and gshadow scripts create hash representations of the groups in the original and .pacnew files. Groups which only exist in one of the files pass through untouched. Groups which exist in both have their members combined, which usually means that the original simply passes through. Using the "--compare" option, three aligned columns are displayed which clearly shows existing groups, new groups and the results of merging, with colors used to highlight all changes.
    The mirrorlist script creates a list of selected servers in the current mirrorlist and generates a new mirrorlist from the .pacnew mirrorlist with all servers in the generated list uncommented, if they exist. Passing the "--compare" option will simply check if all the currently selected mirrors still exist in the new mirrorlist (they might not if they're dropped) and prints out a list of any that aren't.
    The locale_gen script does the same thing for currently enabled locales.
    Also note that all of the results are printed to STDOUT so no files are actually changes. It isn't fully "automatic" and the user is expected to sanity-check the results before overwriting the target files.

  • [Solved] A Challenge: Loop meld to update *.pacnew files

    I got no secret, I love meld .  Does a great job of showing differences alot of times if even scattered all over the page, allows for copy and paste...  vimdiff is good but requires a much more keypresses, copy and paste isn't as elegant, and with my fixed drop-down terminal is just too narrow to be able to do it well.  So what I usually end up doing is:
    find /etc -type f -name "*.pacnew"
    and just go through them one at a time:
    kdesu meld /etc/config /etc/config.pacnew
    I haven't do much work with loops, so I was hoping that someone that knew a little about them that could create a script that would go through them one by one.  I suppose this is going to be a little tricker because (I imagine) it's going to have to detect when the windowed instance closes.
    From the knowledge I know, I would do:
    #!/bin/bash
    # etc-update - merge *.pacnew files with original configurations with meld
    pacnew=$(find /etc -type f -name "*.pacnew")
    for i in $pacnew
    do
    kdesu meld $i
    done
    Which isn't going to work very well.  Well, I guess it could, but it's going to open them all at once and leave a nice scruched-up taskbar with *.pacnew files.  Like to be able to go through them one by one.
    Anyone had any experiences at this that could help?
    Last edited by Gen2ly (2009-10-03 01:46:55)

    brisbin33 wrote:
    http://pbrisbin.com:8080/bin/pacnews
    just do a find/replace of vimdiff for meld (or whatever...)
    Nice script, bris.  If I had know about that before, I'd be using it.   Do like the idea of the walk-through process and the saving of the the current one.
    lol, I just read your last post and just what I thought about.
    ugkbunb wrote:I just edited the pacdiff script to use meld and it worked great : ) -- I am not at home atm, but if you would like I can post up my edited pacdiff script.
    Yeah, I saw that on the wiki.  Said it was for CLI though so I didn't get to try.
    @ lolilolicon, and Procyon
    Still learning about pids, what I have seen was more complicated than this.  Pretty clever.
    Allan wrote:
    Maybe....
    #!/bin/bash
    # etc-update - merge *.pacnew files with original configurations with meld
    pacnew=$(find /etc -type f -name "*.pacnew")
    for i in $pacnew
    do
    kdesu meld $(basename $i .pacmew) $i &
    wait
    done
    Note - untested
    Ah, very nice.  Also fits into my knowledge of bash.   Hadn't thought about just using & but it works great.  Had to truncate the file extension and just used a bash filter:
    #!/bin/bash
    # pacnew-diff - merge *.pacnew files with original configurations with meld
    pacnew=$(find /etc -type f -name "*.pacnew")
    for config in $pacnew
    do
    kdesu meld ${config%\.*} $config &
    wait
    done
    Like to be able to do a backup of the current config and then erase the pacnew file afterword, but havn't found out a way to do that without having to type in a password everytime, but, I guess, that can easily be done elsewhere.
    Last edited by Gen2ly (2009-10-02 20:27:17)

  • [SOLVED] .pacnew files

    I just realized something that may have some bad consequences (Atleast, I think they might be bad, usually when I forget to do something on a Linux system it results in me reinstalling the entire OS).
    I forgot to merge some files that are used by pacman, but I dont know how. I need to merge /etc/pacman.d/mirrorlist and /etc/pacman.d/mirrorlist.pacnew. I also need to merge pacman.conf and pacman.conf.pacnew. I read some forum posts about this topic, but I did not fully understand then (I'm a noob). They were talking about programs like pacdiff and vimdiff. Should I use those programs? If so, how would I go about downloading and merging the 2 files?
    Last edited by dsplayer14 (2012-06-27 15:04:59)

    If you're sticking around arch, or linux in general, you should learn to use these tools.  Vimdiff is wonderful ... but only if you already use vim.  If you don't use vim it will most likely just confuse the hell out of you.
    For the time being or while your still learning to use these tools well, I'd recommend whatever text editor you are comfortable with.  If it's nano, use nano, or leafpad, or gedit, kate, any of them will work.  Open each file in one instance of the editor side by side.  The *.pacnew file will have the most up-to-date "defaults".  If you have not added or changed anything in your config files, then you can actually just move pacman.conf.pacnew to pacman.conf overwritting the latter.  But with the pacman.conf, you should also read it carefully as it may have some important instructions depending on when you last updated (about package signing and the like).  If you have changed your pacman.conf, you'll have to "merge" those changes.  All the diff/merge tools help in this process, but all it is is putting together the updates in the pacnew with the changes you have made.
    The mirrorlist.pacnew is less important.  Mainly it just removed the ftp mirrors which (if you have a working system) you're most likely not using anyways.  If you use any mirrorlist tool like reflector, just delete the mirrorlist.pacnew.  Or if your current mirrorlist is working well - just delete the mirrorlist.pacnew.
    Last edited by Trilby (2012-06-27 14:30:46)

  • [SOLVED]pacnew files? i need help...

    Hi,
    After upgrade with pacman -Syu, a lot of pacnew files in /etc.I read about this in archwiki but i'm still confused :S I have no idea how to use vimdiff or meld ...
    Can someone explain me simple what to do with pacnew files.I'm new in arch linux and i need help.
    Thanks to everyone. (sorry for my english)
    Last edited by grobar87 (2011-04-15 14:26:42)

    ewaller wrote:
    a pacnew file is used when an update to a package requires a new configuration file, but there is already a configuration on your system which would be wrong to simply overwrite.
    If there is nothing in the old, corresponding file you want to keep, it is okay for you to move the pacnew file and overwrite the old configuration.  If it is not okay, you need to incorporate your customizations into the pacnew file, and then move the pacnew file and overrwrite the old file.
    The tools you mentioned are just that -- tools to help figure out what changed.  The easiest solution is just to run diff fileName fileName.pacnew to see the lines that changed.
    Thanks for reply...I install vim and run diff:
    [root@DejanArch dejan]# diff /etc/group /etc/group.pacnew
    8c8
    < lp:x:7:daemon,dejan
    > lp:x:7:daemon
    11c11
    < wheel:x:10:root,dejan
    > wheel:x:10:root
    15a16
    > utmp:x:20:
    20,28c21,29
    < games:x:50:dejan
    < network:x:90:dejan
    < video:x:91:dejan
    < audio:x:92:dejan
    < optical:x:93:dejan,hal
    < floppy:x:94:hal
    < storage:x:95:dejan,hal
    < scanner:x:96:dejan
    < power:x:98:dejan
    > games:x:50:
    > network:x:90:
    > video:x:91:
    > audio:x:92:
    > optical:x:93:
    > floppy:x:94:
    > storage:x:95:
    > scanner:x:96:
    > power:x:98:
    31,39d31
    < dbus:x:81:
    < hal:x:82:
    < avahi:x:84:
    < usbmux:x:140:
    < camera:x:97:dejan
    < ntp:x:1000:
    < rtkit:x:133:
    < deluge:x:125:
    < utmp:x:20:
    Now? How to merge this two files?
    Thanks again.
    Last edited by grobar87 (2011-04-13 18:57:50)

  • (SOLVED)recent update .pacnew files what to do?

    Maybe I'm having a duh! moment but today #pacman -Syu gave me /etc/makepkg.conf and /etc/makepkg.conf.pacnew that are identical.; and /etc/pacman.conf(my edited one) and /etc/pacman.conf.pacnew(like new install file). Can I just delete the .pacnew files and keep the original files?
    Last edited by lestoil (2009-10-02 17:38:30)

    maybe yes, maybe no!
    you need to check every .pacnew, if the .pacnew is identical to the original file, you can remove it.
    if it isn't identical, you need to merge this 2 files...
    i would like to help you a bit more, but my poor english stop me xD
    Sorry, for more info, the wiki
    http://wiki.archlinux.org/index.php/Pac … save_Files

  • Pacnew files appears in filesytem after upgrade. What do YOU do ?

    Hi all
    Having great fun with ArchLinux for the last two weeks now, and really enjoy this distro !!
    Did a system upgrade yesterday and everything went fine.
    But when I'm in console Emacs suddenly behaves strangely when typing danish characters :-/
    I looked in /etc for consulting the locale files and discovered some new files with a .pacnew extension.
    I did a
    grep pacnew /var/log/pacman.log
    and gets this
    [2008-02-04 09:20] >>> when merging the pacnew file with your old configuration.
    [2008-02-04 09:48] warning: /etc/locale.gen installed as /etc/locale.gen.pacnew
    [2008-02-04 09:48] ==> Check /etc/locale.gen.pacnew for new supported locales
    [2008-02-04 09:48] warning: /etc/profile installed as /etc/profile.pacnew
    [2008-02-04 09:48] warning: /etc/rc.conf installed as /etc/rc.conf.pacnew
    [2008-02-04 09:48] See /etc/crypttab(.pacnew) for more information.
    [2008-02-04 09:49] warning: /etc/logrotate.conf installed as /etc/logrotate.conf.pacnew
    [2008-02-04 09:49] warning: /etc/nanorc installed as /etc/nanorc.pacnew
    The question is now:
    What should I do with this ?? I guess that the /etc/locale.gen.pacnew is to blame for emacs character problems ??
    What do YOU do ??
    (please have in mind that I am not a emacs expert :-)

    stonecrest wrote:
    shining wrote:
    niller wrote:What do YOU do ??
    If it's a config file I edited in the past, I use vimdiff for merging both files.
    If not, I simply overwrite the old config file by the .pacnew one.
    I thought you only get a pacnew if you had made changes to the file. Or am I confused?
    No you are not confused, but they are exceptions. Like some times last year, because of a bug concerning files in NoUpgrade, we had to reset all md5sums of these files.
    And same when a file is relocated, like recently /etc/profile which moved from bash to filesystem.
    But you are right, in the general case, it does not happen, so I vimdiff all .pacnew files I get
    I also find the very simple pacdiff useful when there are several of them.
    Last edited by shining (2008-03-12 10:38:31)

  • Hyper-v VM - merged .avhd files - now cant start as missing .vsv file

    Hi All,
    Yesterday i shut down one of our VMs to allow the snapshots to merge and then tried to start the VM but got the following error:
    'VM' could not initialize.
    An attempt to initialize VM save state failed.
    'VM' could not initialize. (Virtual Machine ID ........)
    'VM' could not create or access saved state file E:\....... .vsv
    When i looked for one i realised that a .vsv file doesnt exist for the VM. I thought the .vsv file was a temporary file and that the VM should happily start without it?
    Any help is much appreciated!

    Hi jrussellcj,
    "I thought the .vsv file was a temporary file and that the VM should happily start without it?"
    Yes , if all of the snapshots are merged properly , there will be no .bin and .VSV remained for that VM .
    Please check the snapshots' folders to ensure that there is no files .
    And I agree with Philip's suggestion .
    If the merged VHD file can works well in a new VM then you may no longer need the old VM .
    Best Regards
    Elton Ji
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • How to merge pdf files into one pdf file?

    In E-Rec we need the capability to mass printing for correspondance. There i want to merge pdf files for candidates into one pdf file. I am doing the following:
    Data: lv_document1           TYPE rcf_s_cs_document_content.
    LOOP AT activity_object_tab INTO ls_activity_object.
        lo_act_corr ?= ls_activity_object-activity.
         CALL METHOD lo_act_corr->process_document
           EXPORTING
             channel  = 'FRONTEND'
           IMPORTING
             document = lv_document1.
      ENDLOOP.
    Now lv_document1 contains the pdf file in  lv_document1-DOCUMENT_X which is of type RAWSTRING.
    This works for one candidate, in this case the pdf for last candidate will be displayed.
    But how would i append in the loop or what would i need to do display all candidates in one pdf.
    Any help will be appreciated.
    Thanks

    File>Create PDF>From File.
    Please post followups in the Acrobat forum.
    Bob

  • Is there a simple way to merge mp3 files into one mp3 file:

    Is there a way to simply merge multiple mp3s into one? I have audacity; however, that program becomes cumbersome when merging multiple files.
    My thanks to anyone for help on this one.

    I have audacity; however, that program becomes cumbersome when merging multiple files.
    How true! I had to do this recently and used Audacity for the task, having nothing else suitable (that I know of, at least). My method was to open each MP3 in its own Audacity window, select and copy all of the second file, close its window, and paste it into the end of the first file, repeating the process for each additional MP3. After all the pieces are in place, export the whole thing as a new MP3. This was cumbersome indeed, and it took concentration to remember which file was which and avoid assembling the pieces in the wrong order. This description will make a lot more sense to someone who has done it than to anyone who hasn't.
    All of this is to say that if you get a better answer than my kludgey Audacity method, I'll be as grateful as you are.

  • I want to merge mp3 files into one file so i can play a mix in i tunes without pauze

    i want to merge mp3 files into one file so i can play a mix in i tunes without pauze

    Audacity is what you need.
    Obviously you need to create a new MP3 file of the combined songs and not delete the originals.
    If your DJ-ing and/or just have too many songs to do that, then look at the free VirtualDJHome version, gives you a lot of control over your music playback.

  • RoboHelp HTML Version 8 - Merging AIR files

    We use Webhelp Pro to merge 19 separate projects into a single merged help file. Can I do that with AIR output, and if so, how? Can anyone point me to a tutorial?

    Hi there!
    I agree with what both Pater and Rick have said, but there may be another way to acheive your objective.
    I have merged 4 additional help systems into our Knowledgebase as an AIR module.
    How?  By importing each project's topics into the Knnowledgebase and the making a top level TOC entry for each components.
    I got this idea from a comment that Rick made noting that the TOC is simply a set of links to the topics. In a merged webhelp, the TOC entry for the child projects are simply placeholders to make the multiple projects appear as a unified whole.
    So in the case I am describing, the "merged" Top level TOC entries actually point to the topics inside the AIR module.
    While I was doing this, there were some issues with the search. While debugging this issue, I discovered that the .cpd file was getting rather large each time I added another system. (over 2.5meg) To fix this, i just kept deleting the .cpd after i mporting each help system and let RH rebuild it for me. Search problem solved! 
    (close merged project/delete project.cpd/reopenproject)
    Now, whether or not this will work for you would seem in part to depend on:
    The way your 19 subprojects folders are structured
    Number of topics in total (we now have about 500 topics form all the merged modules, not sure what the limits for AIRHelp are)
    How you are handling your RH Source Control process
    The attached snag shows the merged Knowledgebase TOC with one of the Help systems topics opened for you to see. It's all there and it works. My team uses this tool every day and they love the fact that all the files they need are in one interface with commenting and autoupdating.
    Hope thos helps or at least gives you something to consider
    Ciao
    Ed
    Message was edited by: ermphd

  • What is the best way to merge a file content into log file

    What is the best way to merge a file content into log file.
    In worst case, I will read the file line by line as string, then use
    logger.info(lineString)to output to log file.
    However, is there better way to do this?
    The eventual log file will be something like:
    log message 1
    log message 2
    content from file line 1
    content from file line 2
    content from file line 3
    log message 3
    log message 4Thanks

    John618 wrote:
    Thank you and let me explain:
    1. What do you mean by better?
    I would like to see better performance. read line by line and log each line as string can be slow. Did you measure this and determine that it is actually a problem for your application? Or are you guessing?
    Regardless of what you do you are still going to need to read the file.
    >
    2.The only better way I can think of is not having to do it, but I assume you have a very good reason to want to do this.
    Yes, I have to do it beacuse the requirement is to have that file content be part of logging.
    Any idea?How is it supposed to be part of it? For example which of the following is better?
            File AAA - contents
                       First Line
                       Second Line XXX
            Log 1
                    2009-03-27 DEBUG: Random preceding line
                    2009-03-27 DEBUG: First Line
                    2009-03-27 DEBUG: Second Line XXX
                    2009-03-27 DEBUG: Random following line
            Log 2
                    2009-03-27 DEBUG: Random preceding line
                    2009-03-27 DEBUG: ----- File: AAA -------------
                    First Line
                    Second Line XXX
                    2009-03-27 DEBUG: Random following lineBoth of the above have some advantages and disadvantages.
    The first in a mult-threaded app can end up with intermittent log entries in between lines, so having log lines with thread ids becomes important.
    The first can be created by reading one line at a time and posting one at a time.
    The second can be created by reading the entire file as a single string and then posting using a single log statement.

Maybe you are looking for

  • How to Restrict Return Sales Order with reference to a cancelled invoice

    SAP Standard is allowing to create Return Sales Order with reference to a cancelled invoice which practically should not be allowed. Has any body worked on this problem and what could be the possible solutions so that return sales orders can not be c

  • Schedule permanent email removal

    I have an iPod Touch on which I use a POP email account. When I first started doing this many months ago, I found it annoying that I had to delete individual emails from the Inbox -- which is to say, move them to the Trash -- and then they would pile

  • How to integrate non-sap application with sap netweaver trial abap

    Hi, I currently have with me SAP Netweaver ABAP trial and Mini SAP BASIS 4.6 D. What i want to do is to see how can i integrate my non-SAP application with SAP. I am confused as to if using SAP Netweaver ABAP trial, will i be able to establish that.

  • Problems with the USB Ports

    Hi there, I writing this because I'm having some really big problems with my USB ports. A few days ago I plugged in an USB-Hub that was quite cheap. Suddenly a window popped up saying that a USB device was deactivated because it "needed" to much powe

  • Starting HTTP server from Oracle9i home

    After successfully installing Oracle 9iR2 on Redhat AS2.1 I go to start Apache using apachectl start, from the Oracle Apache home directory and instead of OHS starting, Redhat's Apache starts up, from the /usr/sbin directory. I would like to use OHS