mc/vfs/extfs/uar.in

55 lines
979 B
Plaintext
Raw Normal View History

1998-02-27 07:54:42 +03:00
#!/bin/sh
#
# Written by Alex Kuchma <ask@bcs.zp.ua>
# Alex Tkachenko <alex@bcs.zp.ua>
# Updated by Vitezslav Samel <xsamel00@dcse.fee.vutbr.cz>
1998-02-27 07:54:42 +03:00
#
# (C) 1997, 1998 The Free Software Foundation.
1998-02-27 07:54:42 +03:00
#
#
1998-02-27 07:54:42 +03:00
XAR=ar
mcarfs_list ()
{
$XAR tv "$1" | sed 's,^,-,;s, , 1 ,;s,/, ,'
1998-02-27 07:54:42 +03:00
}
mcarfs_copyout ()
{
$XAR p "$1" "$2" > "$3"
}
mcarfs_copyin ()
{
TMPDIR=`mktemp -d "${MC_TMPDIR:-/tmp}/mctmpdir-uar.XXXXXX"` || exit 1
name=`basename "$2"`
(cd "$TMPDIR" && cp -fp "$3" "$name" && $XAR r "$1" "$name")
rm -rf "$TMPDIR"
}
mcarfs_rm ()
{
$XAR d "$1" "$2"
1998-02-27 07:54:42 +03:00
}
# override any locale for dates
LC_ALL=C
export LC_ALL
umask 077
1998-02-27 07:54:42 +03:00
case "$1" in
list) mcarfs_list "$2" ;;
copyout) shift; mcarfs_copyout "$@" ;;
copyin) shift; mcarfs_copyin "$@" ;;
rm) shift; mcarfs_rm "$@" ;;
mkdir|rmdir)
echo "mcarfs: ar archives cannot contain directories." 1>&2
exit 1;;
*)
echo "mcarfs: unknown command: \"$1\"." 1>&2
exit 1;;
1998-02-27 07:54:42 +03:00
esac
exit 0