Get Appliance Info
All OpenVZ appliance templates created with Debian Appliance Builder will have the dab.conf file embedded in them as ./etc/appliance.info - the leading ./ is important as that is the way it has been archived.
A concatenation of all such appliance.info files separated by atleast 1 newline each along with Location and md5sum lines and removal of the Architecture, Installed-Size and Source lines is what essentially makes up the content of the /var/lib/pve-manager/apl-info/apl-available file (in PVE v1.x, the apl-info folder is not present and hence removed from the path listed here).
Linux file extraction from tar.gz archive
The following will serve as a tutorial on linux tar file creation and selective extraction and concatenation. If we were to use real templates which are big, they would take a long time to extract and concatenate and hence this dummy file set example.
Create some files
First we create a folder and place two files in it with different content:
mkdir files cat << EOF > files/file1.txt This is file 1 in archive 1 This is line 2 of file 1 in archive 1 EOF sed -e 's/file 1/file 2/g' files/file1.txt > files/file2.txt
Archive the files
We now archive this folder with both it's files:
tar -czf archive1.tar.gz files
Create a second archive with different files
sed -e 's/archive 1/archive 2/g' -i files/file1.txt sed -e 's/archive 1/archive 2/g' -i files/file2.txt tar -czf archive2.tar.gz files rm -rf files
Single file extraction
In order to extract a single from an archive we can use the tar -tvf filename.tar.gz command to display the file tree list present in the archive first to determine the exact path and file name of the target to extract.
Now to extract and display the file on the screen/console (the last character in the command below is a capital letter O) we use:
tar -xzf archive1.tar.gz files/file1.txt -O
Multi Archive file extraction and cocatenation
If we know that the file name and path are in the exact place or follow a pattern, we can extract them into a single file for later manipulation.
tar -xzf archive1.tar.gz files/file1.txt -O > all_file1.txt tar -xzf archive2.tar.gz files/file1.txt -O >> all_file1.txt cat all_file1.txt
This will output:
This is file 1 in archive 1 This is line 2 of file 1 in archive 1 This is file 1 in archive 2 This is line 2 of file 1 in archive 2
Extraction and Concatenation from DAB Templates
If some templates have been downloaded into the template cache folder in the host machine, the appliance.info files can all be extracted and concatenated into a single file for later mainpulation.
cd /var/lib/vz/template tar -xzf cache/debian-6.0-frontaccounting_188.8.131.5241028-1_i386.tar.gz ./etc/appliance.info -O > all_infos.txt tar -xzf cache/debian-6.0-genericlamp_2.0-4_i386.tar.gz ./etc/appliance.info -O >> all_infos.txt cat all_infos.txt
More esoteric ways to achieve complete automation can be done using find ... exec constructs which is currently left as an exercise to the reader for now.