We mentioned the /usr/sbin/cleanup command in the previous section in order to commit patches on a system. The cleanup command can prove to be useful in managing a patch depot. In our depot, we have seen that we have a number of superseded patches relating to the FooProd product. Periodically, you might want to review the content of your patch depot to see if it is still relevant to maintaining the superseded patches as well as the active patch as well. The cleanup command is a convenient mechanism whereby we can analyze an entire depot and delete the superseded patches. In this way, we are making patch selection easier; other administrators don't need to keep asking what patch level they should take FooProd to. We can also significantly save on disk space if we periodically run cleanup on our patch depots. Here is an example of cleanup in preview mode: root@hpeos004[] cleanup -p -d /software/11i-PA ### Cleanup program started at 09/26/03 18:23:49 Preview mode enabled. No modifications will be made. Cleanup of depot '/software/11i-PA'. Obtaining the list of patches in the depot: /software/11i-PA ...done. Obtaining the list of superseded 11.X patches in the depot: /software/11i-PA ...The following superseded patches exist in the depot: ==================================================== PHCO_1000 superseded by PHCO_2000 PHCO_2000 superseded by PHCO_3000 All information has been logged to /var/adm/cleanup.log. ### Cleanup program completed at 09/26/03 18:23:49 root@hpeos004[] It may look as simple as running cleanup without the “p option will clean up my patch depot. This is not necessarily the case, as this demonstration shows: root@hpeos004[] cleanup -d /software/11i-PA ### Cleanup program started at 09/26/03 18:33:24 Cleanup of depot '/software/11i-PA'. Obtaining the list of patches in the depot: /software/11i-PA ...done. Obtaining the list of superseded 11.X patches in the depot: /software/11i-PA ...The following superseded patches exist in the depot: ==================================================== PHCO_1000 superseded by PHCO_2000 PHCO_2000 superseded by PHCO_3000 Please be patient; this may take several minutes. Removing superseded 11.X patches from depot: /software/11i-PA ... ERROR: swremove(1M) encountered a problem removing the superseded patches: ERROR: "hpeos004:/software/11i-PA": The software dependencies for 1 products or filesets cannot be resolved. ERROR: "hpeos004:/software/11i-PA": 1 filesets were determined to be skipped in the analysis phase. All information has been logged to /var/adm/cleanup.log. ### Cleanup program completed at 09/26/03 18:33:24 root@hpeos004[] root@hpeos004[] swlist -d @ /software/11i-PA/ # Initializing... # Contacting target "hpeos004"... # # Target: hpeos004:/software/11i-PA/ # # # No Bundle(s) on hpeos004:/software/11i-PA/ # Product(s): # FooProd 1.0 This is an example 11.X product. PHCO_1000 1.0 Foo Cumulative Patch PHCO_3000 1.0 Foo Cumulative Patch PHCO_4000 1.0 Foo Cumulative Patch root@hpeos004[] Although the cleanup command managed to remove patch PHCO_2000 , it failed to remove PHCO_1000 due to dependencies between the product and the patch. We need to consider two options to the swremove command: -x enforce_dependencies=true and “x autoselect_dependents=false . These two options will control what happens when we try to remove a patch that has dependencies. The -x enforce_dependencies=truefalse option determines whether swremove allows a patch to be removed, if that patch is required by other patches or products. The default value for this option is true . The -x autoselect_dependents=truefalse option determines whether swremove selects just the explicitly selected patch, or the explicitly selected patch and all of its dependents. The default value for this option is false . The table below summarizes the resulting swremove behavior that you will see when using the most common combinations of these options to remove a patch that has dependencies: Table 12-4. Options to swremove That Influence Patch Removal enforce_dependencies | autoselect_dependents | Result | True | False | Nothing removed (default) | False | False | Patch removed, dependents remain | True | True | Patch and dependents removed | In our case, we will need to ensure that we set both options to false in order to remove patch PHCO_1000 . In reality, the option “x autoselect_dependents is false by default, so we need only worry about the option “x enforce_dependencies=false : root@hpeos004[] swremove d x enforce_dependencies=false PHCO_1000 @ /software/11i-PA ======= 09/26/03 19:25:34 BST BEGIN swremove SESSION (non-interactive) (jobid=hpeos004-0133) * Session started for user "root@hpeos004". * Beginning Selection * Target connection succeeded for "hpeos004:/software/11i-PA/". * Software selections: PHCO_1000.FOO-MIN,r=1.0,a=HP-UX_B.11.00_32/64,v=HP,fr=1.0,fa=HP-UX_B.11.00_32/64 * Selection succeeded. * Beginning Analysis * Session selections have been saved in the file "/.sw/sessions/swremove.last". WARNING: "hpeos004:/software/11i-PA/": The software dependencies for 1 products or filesets cannot be resolved. * Analysis succeeded. * Beginning Execution * The execution phase succeeded for "hpeos004:/software/11i-PA/". * Execution succeeded. NOTE: More information may be found in the agent logfile using the command "swjob a log hpeos004-0133 @ hpeos004:/software/11i-PA/". ======= 09/26/03 19:25:34 BST END swremove SESSION (non-interactive) (jobid=hpeos004-0133) root@hpeos004[] root@hpeos004[] swlist d @ /software/11i-PA/ # Initializing... # Contacting target "hpeos004"... # # Target: hpeos004:/software/11i-PA/ # # # No Bundle(s) on hpeos004:/software/11i-PA/ # Product(s): # FooProd 1.0 This is an example 11.X product. PHCO_3000 1.0 Foo Cumulative Patch PHCO_4000 1.0 Foo Cumulative Patch root@hpeos004[] |