#! /bin/sh
#
# minimal lzma extfs for mc; created for spblinux2 (http://spblinux.sf.net) 02-2007, Christian Ostheimer
# assuming that *.lza files are lzma compressed tar files
# Note: mc extfs doesn't do a good job in preserving attributes...
lzalist()
{
 DATE="01-01-70 00:00"
 SIZE=`lzma d "$1" -so 2>/dev/null |wc -c`
 echo "-r--r--r-- 1 0 0 $SIZE $DATE "`basename ${1%.lza}`.tar
}

lzaout()
{
 lzma d "$1" -so >"$3" 2>/dev/null
}

# lzma is part of spblinux addon libs2.lza which might not have been loaded
if [ -x /usr/bin/lzma ]; then
 case $1 in
  list) lzalist "$2";;
  copyout) lzaout "$2" "$3" "$4";;
  *) echo "not supported"; exit 1;;
 esac
else
 echo "/usr/bin/lzma not found (is addon libs2.lza loaded?)"
 exit 1
fi
