#!/bin/sh

set -e

#cd $AUTOPKGTEST_TMP

# Create some files to be packed
mkdir -p orig
head -c 1K /dev/urandom > orig/binfile.dat
head -c 1K /dev/urandom | od > orig/octfile.txt

# pack
(cd orig; xar -c -f ../test.xar *)

# unpack
mkdir -p unxar
xar -x -C unxar -f test.xar

# compare
for i in $(ls orig) ; do
  cmp orig/$i unxar/$i
done

echo success