#!/bin/sh
#
# 	$Source: /cvsroot/bootcd/bootcd/bootcdbackwiz_extract.src,v $
#       $Id: bootcdbackwiz_extract.src,v 1.5 2007-11-29 12:29:04 bs Exp $
#    author: Carsten Dinkelmann <din@foobar-cpa.de>
#            Bernd Schumacher <bernd.schumacher@hp.com>
#     start: 20.09.2007
#     topic: extract bootcdbackupwizard from debian files to lokal directory
#

# changed from MAKEFILE
BOOTCDVERSION="##BOOTCD.VERSION##"
BOOTCDDEB="##BOOTCDDEB##"
BOOTCDMKINITRAMFSDEB="##BOOTCDMKINITRAMFSDEB##"
BOOTCDI386DEB="##BOOTCDI386DEB##"
BOOTCDBACKUPDEB="##BOOTCDBACKUPDEB##"
README="./usr/share/doc/bootcd-backup/examples/README.bootcdbackupwizard"
# FILES=<files that are needed from the alien system>
FILES="./usr/share/doc/bootcd-backup/examples/bootcdbackupwizard \
./usr/share/doc/bootcd-backup/examples/bootcddebootstrap"

extract_deb()
{
  local temp="tmp"

  ar -x $BOOTCDBACKUPDEB data.tar.gz
  mkdir $temp
  tar xz -C${temp}/ -f data.tar.gz $FILES $README
  for i in $FILES $README; do
     echo "... extract $(basename $i)"
     mv ${temp}/${i} .
  done
  for i in $FILES; do 
     chmod 755 $(basename $i)
  done

  rm -rf ${temp} data.tar.gz
}

echo ""

extract_deb || exit 1

echo -e "\n Run ./bootcdbackupwizard with needed option from this directory!"
echo -e " The example exclude all in /home and /tmp (watch the trailing slashes!) and"
echo -e " creates the backup DVD in directory /var/spool/bootcdbackup (space needed!):"
echo -e "   ./bootcdbackupwizard -e \"/home/ /tmp/\" -d /var/spool/bootcdbackup\n"
echo -e " Read README.bootcdbackupwizard for more useful options. \n"

