Element: <unpack>

Syntax

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

This element occurs in : Element : <alfs> | Element: <stage>

See also : Element : <archive> | Element: <destination> | Element: <digest> | Element: <reference>

Description

The element unpack is one of the top-level operation elements. It is used to unpack an archive into a destination directory

The sub-element reference gives the URL of the archive; it is only 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 gives the name of the directory in which the archive is unpacked.

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