Reportsusv3postinst

Status: Accepted

Colis script


begin
  true ;
  (TEMPDIR := embed { mktemp [ '-d' ] } || exit failure) ;
  echo [ 'Fetching'; 'file...' ] ;
  wget [ '-P'; split TEMPDIR;
       'http://www.opengroup.org/onlinepubs/007904975/download/susv3.tar.bz2' ] ;
  echo [ 'Verifying'; 'SHA512'; 'checksum...' ] ;
  SHA512SUM :=
    'b1b8a79112d3f41a3d2951341cd9220566f551e5750378bba5cf786a0c381b064fa1a1cfeb6e76e9c6beb85a893cbb6f90879203e9931e9043bcb95b032def40' ;
  ([ [ 'x'
       embed {
       pipe
       sha512sum [ split TEMPDIR '/susv3.tar.bz2' ]
       into cut [ '-f1'; '-d\ ' ] epip };
     '='; 'x' SHA512SUM; ']' ] ||
    process begin
              rm [ '-rf'; split TEMPDIR ] ;
              exit failure end) ;
  echo [ 'Untarring...' ] ;
  pipe
  bunzip2 [ '-cd'; split TEMPDIR '/susv3.tar.bz2' ]
  into tar [ 'xf'; '-'; '-C'; '/usr/share/doc/susv3';
           '--no-same-permissions'; '--no-same-owner' ]
  epip ;
  rm [ '-rf'; split TEMPDIR ]
end

Original Shell script

#!/bin/sh

set -e

TEMPDIR=$(mktemp -d) || exit 1

echo Fetching file...
wget -P $TEMPDIR http://www.opengroup.org/onlinepubs/007904975/download/susv3.tar.bz2

echo Verifying SHA512 checksum...
SHA512SUM="b1b8a79112d3f41a3d2951341cd9220566f551e5750378bba5cf786a0c381b064fa1a1cfeb6e76e9c6beb85a893cbb6f90879203e9931e9043bcb95b032def40"
[ x"$(sha512sum $TEMPDIR/susv3.tar.bz2 | cut -f1 -d\ )" = x"$SHA512SUM" ] || (rm -rf $TEMPDIR; exit 1)

echo Untarring...
bunzip2 -cd $TEMPDIR/susv3.tar.bz2 | tar xf - -C /usr/share/doc/susv3 --no-same-permissions --no-same-owner

rm -rf $TEMPDIR

## Note: Keep debhelper token after so that files exist when they're being
## registered.