Element: <unpack>

Syntax


<!ELEMENT unpack         (digest?,reference?,archive,destination)>

This element occurs in the elements alfs, else, stage. and then

See also : archive, destination, digest, reference,

Description

This element is used to unpack an archive into a destination directory

The sub-element reference gives the URL of the archive, which is used if the archive file is not available locally.

The sub-element digest gives the digest of the archive, as computed by openssl, using the digest type specified in the attribute type.

The sub-element archive gives the name of the archive, and the sub-element destination given the name of the directory in which the archive is unpacked

The choice of the program performing the unpacking is based on the extension of the archive file. The supported extensions are :



Note: The use of the sub-elements digest and reference is deprecated. You should use the element download instead.

Examples


<unpack>
    <digest>cbe9f79450aeecfb06d5e856af16c2cf</digest>
    <reference>ftp://ftp.gnu.org/gnu/gzip/gzip.1.2.4a.tar.gz</reference>
    <archive>/usr/src/lfs-packages/gzip.1.2.4a.tar.gz</archive>
    <destination>/usr/src</destination>
</unpack>

The equivalent bash script is :


echo Unpacking /usr/src/lfs-packages/gzip.1.2.4a.tar.gz into /usr/src
[[ ! -f /usr/src/lfs-packages/gzip.1.2.4a.tar.gz ]] &&
  echo Retrieving  ftp://ftp.gnu.org/gnu/gzip/gzip.1.2.4a.tar.gz
[[ ! -f /usr/src/lfs-packages/gzip.1.2.4a.tar.gz ]] &&
  wget -O /usr/src/lfs-packages/gzip.1.2.4a.tar.gz ftp://ftp.gnu.org/gnu/gzip/gzip.1.2.4a.tar.gz
[[ ! -f /usr/src/lfs-packages/gzip.1.2.4a.tar.gz ]] &&
  echo Archive does not exist && exit 3

cd /usr/src
tar xzvf /usr/src/lfs-packages/gzip.1.2.4a.tar.gz