Tar Archives Modification

Orabuntu-LXC is configured using both scripts and tar archives.  Therefore, when developing Orabuntu-LXC, or when using Orabuntu-LXC, it may be necessary to modify one of the tar archives with an updated version of a file, or to remove a file from the archive.  Those operations are completed using commands as shown below.  In this example, a file is extracted, then edited with vi (not shown), then the original file in the tar archive is deleted, and finally the edited version of the file is added back to the tar archive.

sudo tar -vP --extract --file=lxc-oracle-files.tar rootfs/etc/dhcp/dhclient.conf
sudo tar -vP --delete  --file=lxc-oracle-files.tar rootfs/etc/dhcp/dhclient.conf
sudo tar -vP --append  --file=lxc-oracle-files.tar rootfs/etc/dhcp/dhclient.conf

Note: Some archives use the "--numeric" switch together with the "--append" switch.  Check this before appending an updated file using "tar -tvf archive_name.tar".

Comments