System profile versioning 11.. IInnttrroodduuccttiioonn System profile versioning may be used for different purposes, to solve various problems related to the complexity of managing workstations and servers. Read the following questions to see if any of them apply to you. Do you have a notebook computer? Have you ever wished to have one set of configuration files: one for the office, one for the home and yet another one for a customer's site? Would you like to be able to switch at will between these configurations, even at boot time? Yet, you want to be able to share some aspects of the system configuration in all three locations. Are you doing more and more complicated things with _L_i_n_u_x these days? Have you ever wished to be able to freeze a working setup and then experiment with new settings while all the users are away? Have you ever been caught very late at night with a non-working setup? The user will be back in a few hours and you are not able to get back to the working state you had when you attempted to enhance the system. Well, if you answer yes to any of those question, then _S_y_s_t_e_m _p_r_o_f_i_l_e _v_e_r_s_i_o_n_i_n_g is for you. 11..11.. AArrcchhiivviinngg mmooddee A checkbox controls the way archiving is performed. By default, archiving of a profile is done either when you switch to another profile or you trigger an archive operation. Archiving may be performed every time you modify a configuration file. The archiving is done just before the file is updated. That way, the archive always contains the original version before you updated it. Using RCS or the --diff command line option, you can track the evolution of the configuration file. See the --diff option below. 11..22.. DDeeffiinniittiioonn ooff aa ssyysstteemm pprrooffiillee A system profile is defined by a set of configuration files. These configuration files belong to various subsystems. Sometimes a file even belongs to two or more subsystems. 11..33.. SSyysstteemm pprrooffiillee vveerrssiioonn A version is a collection of all configuration files which define a specific state of your computer. By switching profile versions, you are effectively saving the current configuration files into a special storage area (/etc/linuxconf/archive) and restoring files from the newly activated version. 11..44.. SShhaarriinngg ffiilleess bbeettwweeeenn ttwwoo ssyysstteemm pprrooffiillee vveerrssiioonnss Swapping all configuration files from a working profile and replacing them by other configuration files is not always useful. For example, you might define two system profile versions: one for the office and one for the home. Some subsystems are identical for both environments. You expect that when you maintain one aspect of your Linux notebook at home, those changes will be available at the office the next morning. Sometimes you expect the two environments to evolve separately. In fact, you need control subsystem by subsystem over how things are saved/restored between various system profile versions. 11..55.. AArrcchhiivviinngg tteecchhnnoollooggyy _L_i_n_u_x_c_o_n_f use the _R_C_S system to save copies of the various files. RCS is used to keep a history of the state of the configuration files. This will be used one day in Linuxconf to create audit reports showing how various subsystems were managed over time. The archiving technology might evolve one day to use an archive server. This would allow one to track efficiently the configuration changes of many workstations and servers. 22.. SSyysstteemm pprrooffiillee ddeeffiinniittiioonn Here is how to define a version. 22..11.. AA nnaammee Each system profile version has a name which is used to select it. The name does not contain any spaces. 22..22.. AA ttiittllee You can give a title to make menus easier to read. 22..33.. DDeeffaauulltt aarrcchhiivviinngg ffaammiillyy Any subsystem without an archiving family will be archived using this default family. Most of the time, system profile versions are archived in one or two different families. This avoids repeating the archiving family over and over. 22..44.. AArrcchhiivviinngg ffaammiilliieess A system profile version is defined by telling Linuxconf how or where the various sub-systems composing it are archived. Sub-system configuration files are archived in a family together. If two system profile versions are defined so they archive one given subsystem in the same family, then the configuration files for this subsystem will be shared between the two versions. This means that a change done while a given system profile version is active will be available when you switch to the other system profile. Switching between the two versions won't affect the state of this specific subsystem. A family is just a single word. It can be any word. It becomes a subdirectory in /etc/linuxconf/archive. In this subdirectory, you will find archived copies of the various configuration files. Inside the family directory, you will find a directory hierarchy that duplicates the various directories normally found in a Linux system, such as /etc and /etc/ppp. Several subsystems may be archived in the same family. 33.. SSppeecciiaall aarrcchhiivviinngg ffaammiillyy:: nnoonnee Selecting none as the archiving family means you don't want any archiving at all for this subsystem. 44.. DDeeffaauulltt sseettttiinnggss When you enter the profile versioning dialog, you see that Linuxconf has already defined two profile versions: one is called Office and the other Home. Both are defined to archive every subsystem except one in the family Home-Office. The subsystems "station identity" and "network connectivity" are archived in the "Home" family for the version Home and are archived in the "Office" family for the Office version. These two settings should be good enough for notebook users who travel between the home and the office. 55.. UUssiinngg yyoouurr oowwnn aarrcchhiivveerr Linuxconf use the script /usr/lib/linuxconf/lib/cfgarchive to save and extract the various configuration files. This script is documented (commented). You can specify another archive command by going in the "Control file and systems" menu followed by the "All commands and daemon" menu. Locate the cfgarchive command and enter the path of a replacement command. 66.. MMaannaaggiinngg ssyysstteemm pprrooffiilleess Once system profile versions are defined, you can switch back and forth between them. Linuxconf preserves the configuration files for all sub-systems that are not shared between the two version. After that it restores the configuration files for the newly selected version. 66..11.. UUssiinngg tthhee ccoonnttrrooll ppaanneell In the control panel, you find the menu entry _s_w_i_t_c_h _s_y_s_t_e_m _v_e_r_s_i_o_n. This menu presents you with the list of all versions available (except the currently active one). You just pick one and there you are. You may want to visit the _A_c_t_i_v_a_t_e _c_h_a_n_g_e_s menu of the control panel or leave Linuxconf so the new configuration is brought into action. 66..22.. AAtt bboooott ttiimmee At boot time, an option lets you select the proper profile version. As with the option in the control panel, this involves archiving the current version and restoring the new one. Linuxconf may then boot using the new configuration files. This is handled by the optional boot time menu (Some distribution are not installing it unfortunatly). It is also possible to switch profile from the LILO prompt. You simply pass the PROFILE=profile-name argument to the selected kernel. For example: LILO boot: linux PROFILE=home 66..33.. FFrroomm tthhee ccoommmmaanndd lliinnee Limited functionality is available from the command line to play with the archiving. Both command line options only work on the current version. They are handy to do some experiments and undo them. Remember that _R_C_S is used to save the files. This means that you can extract a very old copy of a configuration file if needed. _L_i_n_u_x_c_o_n_f does not yet support this however. You have to dig in the /etc/linuxconf/archive. 66..33..11.. AArrcchhiivviinngg ssoommee oorr aallll ssuubbssyysstteemmss The command linuxconf --archive [ sub-system ... ] lets you save a copy of the configuration files of a few subsystems. If you omit a subsystem name, then all subsystems are archived. 66..33..22.. CCoommppaarriinngg tthhee ccuurrrreenntt sseettttiinngg wwiitthh tthhee aarrcchhiivvee The command linuxconf --diff [ sub-system ... ] lets you compare the current state of a the configuration files with the last archived version. If you omit a subsystem name, then all subsystems are compared. 66..33..33.. EExxttrraaccttiinngg ssoommee oorr aallll ssuubbssyysstteemmss The command linuxconf --extract [ sub-system ... ] lets you restore the configuration files of a few sys-systems. If you omit a subsystem name, then all subsystems are restored. 66..33..44.. VViieewwiinngg tthhee ssttaattuuss ooff tthhee RRCCSS aarrcchhiivvee The command linuxconf --history [ sub-system ... ] will present the archiving history of every file in the subsystems (or all subsystems). It does this by executing the rlog command on each file in the archive.