Updated urar/uzip fs

This commit is contained in:
Miguel de Icaza 1999-05-15 16:11:04 +00:00
parent 685dde6a6d
commit e453cc49a9
2 changed files with 55 additions and 1 deletions

View File

@ -63,12 +63,38 @@ mcrarfs_copyout ()
{ {
$UNRAR p -c- -inul "$1" "$2" > $3 2>/dev/null $UNRAR p -c- -inul "$1" "$2" > $3 2>/dev/null
} }
mcrarfs_mkdir ()
{
# preserve pwd. It is clean, but is it necessary?
pwd=`pwd`
# Create a directory and create in it a tmp directory with the good name
dir=tmpdir.${RANDOM}
mkdir $dir
cd $dir
mkdir -p "$2"
# rar cannot create an empty directory
touch "$2"/.rarfs
$RAR a -r "$1" "$2" &>/dev/null
$RAR d "$1" "$2"/.rarfs &>/dev/null
cd $pwd
rm -rf $dir
}
mcrarfs_rm ()
{
$RAR d "$1" "$2" &>/dev/null
}
umask 077 umask 077
# uncomment this line for debugging # uncomment this line for debugging
#echo "`date +%T` ${0##*/} $1 $2 to=$3 tmp=$4" >>/tmp/${0##*/}.log #echo "`date +%T` ${0##*/} $1 $2 to=$3 tmp=$4" >>/tmp/${0##*/}.log
case "$1" in case "$1" in
list) mcrarfs_list "$2"; exit 0;; list) mcrarfs_list "$2"; exit 0;;
rm) mcrarfs_rm "$2" "$3" ; exit 0;;
rmdir) mcrarfs_rm "$2" "$3" ; exit 0;;
mkdir) mcrarfs_mkdir "$2" "$3" ; exit 0;;
copyin) mcrarfs_copyin "$2" "$3" $4; exit 0;; copyin) mcrarfs_copyin "$2" "$3" $4; exit 0;;
copyout) mcrarfs_copyout "$2" "$3" $4; exit 0;; copyout) mcrarfs_copyout "$2" "$3" $4; exit 0;;
esac esac

View File

@ -9,6 +9,7 @@
DZIP=/usr/bin DZIP=/usr/bin
XZIP="$DZIP/zip -g" XZIP="$DZIP/zip -g"
XDZIP="$DZIP/zip -d"
XUNZIP="$DZIP/unzip" XUNZIP="$DZIP/unzip"
XZIPINFO="$DZIP/unzip -Z" XZIPINFO="$DZIP/unzip -Z"
# #
@ -71,6 +72,20 @@ else
fi fi
} }
mczipfs_mkdir ()
{
# preserve pwd. It is clean, but is it necessary?
pwd=`pwd`
# Create a directory and create in it a tmp directory with the good name
dir=tmpdir.${RANDOM}
mkdir $dir
cd $dir
mkdir -p "$2"
$XZIP "$1" "$2" &>/dev/null
cd $pwd
rm -rf $dir
}
mczipfs_copyin () mczipfs_copyin ()
{ {
# preserve pwd. It is clean, but is it necessary? # preserve pwd. It is clean, but is it necessary?
@ -94,12 +109,25 @@ mczipfs_copyout ()
{ {
$XUNZIP -p "$1" "$2" > $3 2>/dev/null $XUNZIP -p "$1" "$2" > $3 2>/dev/null
} }
mczipfs_rm ()
{
$XDZIP "$1" "$2" &>/dev/null
}
mczipfs_rmdir ()
{
$XDZIP "$1" "$2"/ &>/dev/null
}
umask 077 umask 077
#echo "`date +%T` ${0##*/} $1 $2 to=$3 tmp=$4" >>/tmp/${0##*/}.log #echo "`date +%T` ${0##*/} $1 $2 to=$3 tmp=$4" >>/tmp/${0##*/}.log
case "$1" in case "$1" in
list) mczipfs_list "$2"; exit 0;; list) mczipfs_list "$2"; exit 0;;
# delete) mczipfs_delete "$2" "$3" ; exit 0;; rm) mczipfs_rm "$2" "$3" ; exit 0;;
rmdir) mczipfs_rmdir "$2" "$3" ; exit 0;;
mkdir) mczipfs_mkdir "$2" "$3" ; exit 0;;
copyin) mczipfs_copyin "$2" "$3" $4 ; exit 0;; copyin) mczipfs_copyin "$2" "$3" $4 ; exit 0;;
copyout) mczipfs_copyout "$2" "$3" $4 ; exit 0;; copyout) mczipfs_copyout "$2" "$3" $4 ; exit 0;;
esac esac