Use the pkg revert command to restore files to their packaged condition. File ownership and protections are also restored.
Caution - Reverting some editable files can make the system unbootable, or cause other malfunctions. |
Use the --require-backup-be option when reverting a key editable file.
The following example specifies one of the two installed files from the pkg/depot package that are different from their packaged versions.
$ pkg revert -v /var/log/pkg/depot/access_log Packages to fix: 1 Estimated space available: 21.08 GB Estimated space to be consumed: 460.87 MB Create boot environment: No Create backup boot environment: No Rebuild boot archive: No Changed packages: solaris package/pkg/depot 0.5.11,5.11-0.175.2.0.0.33.0:20140217T134751Z DOWNLOAD PKGS FILES XFER (MB) SPEED Completed 1/1 1/1 0.0/0.0 50B/s PHASE ITEMS Updating modified actions 1/1 Updating package state database Done Updating package cache 0/0 Updating image state Done Creating fast lookup database Done
The specified file was replaced by the packaged version. No other components of the pkg.depot package were changed.
Use the --tagged option to perform the following operations:
Revert all files tagged with the specified tag name.
Remove any unpackaged files or directories that are under directories with the specified tag name and that match the specified pattern.
See the description of the revert-tag attribute in File Actions in Packaging and Delivering Software With the Image Packaging System in Oracle Solaris 11.2 and Directory Actions in Packaging and Delivering Software With the Image Packaging System in Oracle Solaris 11.2 for more information.
The following example shows some packages that contain files that are tagged with the dev-init tag name:
$ pkg contents -o pkg.name,path -s pkg.name -t file -a revert-tag=dev-init '*' PKG.NAME PATH system/device-administration etc/mpxio/devid_path.cache system/device-administration etc/dev/chassis_aliases system/device-administration etc/dev/.chassis_aliases system/device-administration etc/dev/reserved_devnames system/kernel etc/path_to_inst system/network etc/dladm/datalink.conf
The following command shows a preview of an operation that would revert all files that have the dev-init tag name. Notice that the boot archive would be rebuilt. Using an option to create a new boot environment or a backup boot environment is a good practice.
$ pkg revert -nv --tagged dev-init Packages to fix: 6 Estimated space available: 22.39 GB Estimated space to be consumed: 468.60 MB Create boot environment: No Create backup boot environment: No Rebuild boot archive: Yes Changed packages: solaris system/core-os 0.5.11,5.11-0.175.2.0.0.34.0:20140303T144208Z system/device-administration 0.5.11,5.11-0.175.2.0.0.34.0:20140303T144459Z system/io/usb 0.5.11,5.11-0.175.2.0.0.34.0:20140303T145048Z system/kernel 0.5.11,5.11-0.175.2.0.0.34.0:20140303T145214Z system/kernel/platform 0.5.11,5.11-0.175.2.0.0.34.0:20140303T145112Z system/network 0.5.11,5.11-0.175.2.0.0.34.0:20140303T150218Z