Get Appliance Info: Difference between revisions

From Proxmox VE
Jump to navigation Jump to search
Line 5: Line 5:


== Linux file extraction from tar.gz archive ==
== Linux file extraction from tar.gz archive ==
The following will serve as a tutorial on linux '''tar''' file creation and selective extraction and concatenation.
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:
<source lang="bash">
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
</source>
 
=== Archive the files ===
We now archive this folder with both it's files:
<source lang="bash">
tar -czf archive1.tar.gz files
</source>
 
=== Create a second archive with different files ===
<source lang="bash">
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
</source>
 
=== Single file extraction ===

Revision as of 10:01, 3 November 2014

Introduction

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