1
1

* extfs/uzoo.in: Always use "q" option to avoid processing junk.

Always create symlink, do it in a safer directory.
Этот коммит содержится в:
Pavel Roskin 2002-12-14 04:29:12 +00:00
родитель c72422925b
Коммит f7a80d36ba
2 изменённых файлов: 33 добавлений и 33 удалений

Просмотреть файл

@ -1,5 +1,8 @@
2002-12-13 Pavel Roskin <proski@gnu.org> 2002-12-13 Pavel Roskin <proski@gnu.org>
* extfs/uzoo.in: Always use "q" option to avoid processing junk.
Always create symlink, do it in a safer directory.
* extfs/uarj.in: New script working with open-source ARJ. * extfs/uarj.in: New script working with open-source ARJ.
Contributed by Viatcheslav Odintsov. Contributed by Viatcheslav Odintsov.
* extfs/uarj: Remove. * extfs/uarj: Remove.

Просмотреть файл

@ -2,20 +2,29 @@
# #
# Zoo file system # Zoo file system
# #
# Copyright ? U. N. Known # Source of zoo can be found at
# # ftp://ftp.ibiblio.org/pub/Linux/utils/compress/
# This filesystem is _dangerous_. It used to create symlinks in filesystem
# with zoo file, it used to happily delete file from your filesystem.
# Now it is 'only' very ugly (it creates temporary files in ~/.mc/
#
ZOO=zoo ZOO=zoo
# Stupid zoo won't work if the archive name has no .zoo extension, so we
# have to make a symlink with a "better" name. Also, zoo can create
# directories even if printing files to stdout, so it's safer to confine
# it to a temporary directory.
mklink ()
{
TMPDIR="/tmp/mctmpdir-uzoo.$$"
mkdir $TMPDIR || exit 1
trap 'cd /; rm -rf $TMPDIR' 0 1 2 3 5 13 15
ARCHIVE=$TMPDIR/tmp.zoo
ln -sf "$1" "$ARCHIVE"
cd $TMPDIR || exit 1
}
mczoofs_list () mczoofs_list ()
{ {
$ZOO l $1 | @AWK@ -v uid=${UID-0} ' mklink "$1"
BEGIN { hyphens=0 } $ZOO lq "$ARCHIVE" | @AWK@ -v uid=${UID-0} '
/^---/ { if (hyphens > 0) exit 0; hyphens=1; next }
/^[^\ ]/ { next } /^[^\ ]/ { next }
{ {
if (NF < 8) if (NF < 8)
@ -37,33 +46,21 @@ else
mczoofs_copyout () mczoofs_copyout ()
{ {
$ZOO xp $1 $2 | tail +6l > $3 2>/dev/null mklink "$1"
# zoo only accepts name without directory as file to extract
base=`echo "$2" | sed 's,.*/,,'`
$ZOO xpq: "$ARCHIVE" "$base" > "$3"
cd /
exit 0 exit 0
} }
# zoo is stupid and won't be happy when the name has no extension.
# We have to do a small trick :) [pretty dirty, broken hack -- pavel]
if echo $2 | grep '\.zoo$' >/dev/null; then
:
else
SYMLINK=$HOME/.mc/temporary.$2.zoo
if test -f $SYMLINK; then
SYMLINK=$HOME/.mc/temporary.$2.
fi
if test -f $SYMLINK; then
echo "Ugh. I did not expect this to happen. Cleanup your ~/.mc."
sleep 5
exit 1
fi
ln -s $2 $SYMLINK
trap 'rm -f $SYMLINK' 0 1 2 3 5 13 15
$2=$SYMLINK
fi
umask 077 umask 077
case "$1" in cmd="$1"
list) mczoofs_list $2; exit $?;; shift
copyout) mczoofs_copyout $2 $3 $4; exit $?;; case "$cmd" in
list) mczoofs_list "$@" ;;
copyout) mczoofs_copyout "$@" ;;
*) exit 1 ;;
esac esac
exit 1 exit 0