#!/bin/sh
#
#
#explodepkg script - bz2 explodepkg script for ISlack Linux
#Copyright (C) 04.06.2005  Iuri Stanchev
#
#This program is free software; you can redistribute it and/or
#modify it under the terms of the GNU General Public License
#as published by the Free Software Foundation; either version 2
#of the License, or (at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

TAR=tar-1.13
$TAR --help 1> /dev/null 2> /dev/null
if [ ! $? = 0 ]; then
  TAR=tar
fi
if [ ! "`LC_MESSAGES=C $TAR --version`" = "tar (GNU tar) 1.13

Copyright (C) 1988, 92,93,94,95,96,97,98, 1999 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Written by John Gilmore and Jay Fenlason." ]; then
  echo "WARNING: pkgtools are unstable with tar > 1.13."
  echo "         You should provide a \"tar-1.13\" in your \$PATH."
  sleep 5
fi

if [ $# = 0 ]; then
 cat << EOF
Usage: explodepkg package_name [package_name2, ...]

Explodes a ISlack compatible software package (or any tar+bz2 archive) in
the current directory.  Equivalent to (for each package listed):

   ( umask 000 ; tar xjvf package_name )

Note: This should only be used for debugging or examining packages, not for 
installing them. It doesn't execute installation scripts or update the package
indexes in /var/log/packages|scripts.

EOF
fi
for PKG in $* ; do
 echo "Exploding package $PKG in current directory:"
 ( umask 000 ; tar xjvf $PKG 2> /dev/null )
 if [ -r install/doinst.sh ]; then
  echo
  echo "An installation script was detected in ./install/doinst.sh, but"
  echo "was not executed."
 fi
done
