Gentoo:etc-update

From Linux 101, The beginner's guide to all things Linux.

Jump to: navigation, search

etc-update is a program used to update configuration files after an emerge that would overwrite current configuration files takes place. After an emerge occurs that would overwrite a configuration file that is already on the computer, it will give you a message such as

* IMPORTANT: 1 config files in /etc need updating.
* Type emerge --help config to learn how to update config files.

This informs you that a packages default configuration file has changed and might need to be replaced. This sometimes can have dire consequences however as if a configuration file has changed sufficiently enough, the older version may not allow for full functionality and if you reboot your computer without updating the file, certain services may fail to start. This problem is solved by using etc-update. Running it as root

# etc-update

it will scan for configuration files that have changed and present you with a list that you can select from and then choose what you want to do with them.

Scanning Configuration files...
The following is the list of files which need updating, each 
configuration file is followed by a list of possible replacement files.
1) /etc/init.d/net.lo
/etc/init.d/._cfg0000_net.lo
Please select a file to edit by entering the corresponding number.
             (don't use -3 or -5 if you're unsure what to do)
             (-1 to exit) (-3 to auto merge all remaining files)
                          (-5 to auto-merge AND not use 'mv -i'):

In the above scenario, we have one configuration file that needs updating. We have the option of exiting the program using -1, automatically merging the files and accepting whatever changes might occur using -3, automatically merging the files without confirming the overwrite, or we can select the file's changes by selecting its number, in this case, 1. Selecting 1 will bring up the following

Showing differences between /etc/init.d/net.lo and /etc/init.d/._cfg0000_net.lo
--- /etc/init.d/net.lo  2005-10-11 19:34:57.000000000 -0400
+++ /etc/init.d/._cfg0000_net.lo        2005-10-13 02:32:47.000000000 -0400
@@ -180,7 +180,7 @@
       umods=( "${umods[@]}" "${modules[@]}" )

       # Add our preferred modules
-       npref=3
+       npref=4
       umods=( "${umods[@]}" "iproute2" "dhcpcd" "iwconfig" "netplugd" )

       # First we strip any modules that conflict from user settings
lines 1-12/12 (END)

This will most definitely be different than what you might see, but all it tells us is that the npref=3 line will be replaced with the npref=4 line. As the number of modules is indeed now 4 (due to the recent inclusion of iproute2 support) we should update the configuration file. Press q to exit less and we will be returned to the selection menu. However, we will now have new options to choose from

1) Replace original with update
2) Delete update, keeping original as is
3) Interactively merge original with update
4) Show differences again
Please select from the menu above (-1 to ignore this update): 

As we want to merge this file, we will simply choose 1 and we will be prompted to overwrite it. The other options are somewhat self-explanatory aside from option 3 which allows you to step through the changes line by line in order to pick and choose those that you want and don't want. Usually when a configuration file is updated, it is a good idea to select the new one. However, it may overwrite changes you specifically put in there for some reason, and that is when option 3 is what you would want. Further customizations of the etc-update program is available in the /etc/etc-update.conf file such as changing the diff viewer or whether to allow auto-merging of trivial changes.

Navigation: Gentoo Index
Personal tools