mirror of https://github.com/MidnightCommander/mc
* extfs/urar.in: Strengthen quoting. Don't use full path to rar
and unrar. Don't redirect stderr to /dev/null.
This commit is contained in:
parent
a0c6db0bca
commit
5b24e5dc1b
|
@ -1,5 +1,8 @@
|
||||||
2002-12-12 Pavel Roskin <proski@gnu.org>
|
2002-12-12 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
|
* extfs/urar.in: Strengthen quoting. Don't use full path to rar
|
||||||
|
and unrar. Don't redirect stderr to /dev/null.
|
||||||
|
|
||||||
* extfs/uar.in: Simplify "list" command, don't use current year.
|
* extfs/uar.in: Simplify "list" command, don't use current year.
|
||||||
Use more careful quoting.
|
Use more careful quoting.
|
||||||
|
|
||||||
|
|
|
@ -6,15 +6,14 @@
|
||||||
# Andrew V. Samoilov <sav@bcs.zp.ua> 2000
|
# Andrew V. Samoilov <sav@bcs.zp.ua> 2000
|
||||||
# beta version 2.0
|
# beta version 2.0
|
||||||
#
|
#
|
||||||
DRAR=/usr/bin
|
RAR=rar
|
||||||
RAR=$DRAR/rar
|
UNRAR=unrar # Prefer unrar (freeware)
|
||||||
UNRAR=$DRAR/unrar # Prefer unrar (freeware)
|
|
||||||
#
|
#
|
||||||
# NOTE: rar ver 2.0 by Eugene Roshal
|
# NOTE: rar ver 2.0 by Eugene Roshal
|
||||||
# ftp.elf.stuba.sk/pub/pc/pack
|
# ftp.elf.stuba.sk/pub/pc/pack
|
||||||
#
|
#
|
||||||
|
|
||||||
if [ ! -x $UNRAR -a -x $RAR ]; then
|
if ! unrar >/dev/null 2>&1; then
|
||||||
UNRAR=$RAR
|
UNRAR=$RAR
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -41,7 +40,7 @@ else {
|
||||||
$6="-rw-r--r--"
|
$6="-rw-r--r--"
|
||||||
printf "%s 1 %-8d %-8d %8d %3s %2d %4d %s %s\n", $6, uid, 0, $1, substr(date, (a[2]-1)*3+1, 3), a[1], a[3], $5, str
|
printf "%s 1 %-8d %-8d %8d %3s %2d %4d %s %s\n", $6, uid, 0, $1, substr(date, (a[2]-1)*3+1, 3), a[1], a[3], $5, str
|
||||||
}
|
}
|
||||||
}' 2>/dev/null
|
}'
|
||||||
}
|
}
|
||||||
|
|
||||||
mcrarfs_copyin ()
|
mcrarfs_copyin ()
|
||||||
|
@ -50,23 +49,22 @@ mcrarfs_copyin ()
|
||||||
# preserve pwd. It is clean, but is it necessary?
|
# preserve pwd. It is clean, but is it necessary?
|
||||||
pwd=`pwd`
|
pwd=`pwd`
|
||||||
# Create a directory and copy in it the tmp file with the good name
|
# Create a directory and copy in it the tmp file with the good name
|
||||||
mkdir $3.dir
|
mkdir "$3.dir"
|
||||||
cd $3.dir
|
cd "$3.dir"
|
||||||
di="${2%/*}"
|
di="${2%/*}"
|
||||||
# if file is to be written upper in the archive tree, make fake dir
|
# if file is to be written upper in the archive tree, make fake dir
|
||||||
if test "$di" != "${2##*/}" ; then
|
if test "$di" != "${2##*/}" ; then
|
||||||
mkdir -p "$di"
|
mkdir -p "$di"
|
||||||
fi
|
fi
|
||||||
# (cp -p) to preserve date, but $2 is dated now!
|
cp -fp "$3" "$3.dir/$2"
|
||||||
cp -p $3 "$3.dir/$2"
|
|
||||||
$RAR a "$1" "$2" >/dev/null
|
$RAR a "$1" "$2" >/dev/null
|
||||||
cd $pwd
|
cd $pwd
|
||||||
rm -rf $3.dir
|
rm -rf "$3.dir"
|
||||||
}
|
}
|
||||||
|
|
||||||
mcrarfs_copyout ()
|
mcrarfs_copyout ()
|
||||||
{
|
{
|
||||||
$UNRAR p -c- -inul "$1" "$2" > $3 2>/dev/null
|
$UNRAR p -c- -inul "$1" "$2" > "$3"
|
||||||
}
|
}
|
||||||
|
|
||||||
mcrarfs_mkdir ()
|
mcrarfs_mkdir ()
|
||||||
|
@ -80,27 +78,29 @@ mcrarfs_mkdir ()
|
||||||
mkdir -p "$2"
|
mkdir -p "$2"
|
||||||
# rar cannot create an empty directory
|
# rar cannot create an empty directory
|
||||||
touch "$2"/.rarfs
|
touch "$2"/.rarfs
|
||||||
$RAR a -r "$1" "$2" &>/dev/null
|
$RAR a -r "$1" "$2" >/dev/null
|
||||||
$RAR d "$1" "$2"/.rarfs &>/dev/null
|
$RAR d "$1" "$2/.rarfs" >/dev/null
|
||||||
cd $pwd
|
cd $pwd
|
||||||
rm -rf $dir
|
rm -rf $dir
|
||||||
}
|
}
|
||||||
|
|
||||||
mcrarfs_rm ()
|
mcrarfs_rm ()
|
||||||
{
|
{
|
||||||
$RAR d "$1" "$2" &>/dev/null
|
$RAR d "$1" "$2" >/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
umask 077
|
umask 077
|
||||||
|
|
||||||
# uncomment this line for debugging
|
cmd="$1"
|
||||||
#echo "`date +%T` ${0##*/} $1 $2 to=$3 tmp=$4" >>/tmp/${0##*/}.log
|
shift
|
||||||
case "$1" in
|
|
||||||
list) mcrarfs_list "$2" | sort +9 ; exit 0;;
|
case "$cmd" in
|
||||||
rm) mcrarfs_rm "$2" "$3" ; exit 0;;
|
list) mcrarfs_list "$@" ;;
|
||||||
rmdir) mcrarfs_rm "$2" "$3" ; exit 0;;
|
rm) mcrarfs_rm "$@" ;;
|
||||||
mkdir) mcrarfs_mkdir "$2" "$3" ; exit 0;;
|
rmdir) mcrarfs_rm "$@" ;;
|
||||||
copyin) mcrarfs_copyin "$2" "$3" $4; exit 0;;
|
mkdir) mcrarfs_mkdir "$@" ;;
|
||||||
copyout) mcrarfs_copyout "$2" "$3" $4; exit 0;;
|
copyin) mcrarfs_copyin "$@" ;;
|
||||||
|
copyout) mcrarfs_copyout "$@" ;;
|
||||||
|
*) exit 1 ;;
|
||||||
esac
|
esac
|
||||||
exit 1
|
exit 0
|
||||||
|
|
Loading…
Reference in New Issue