mirror of
https://gitlab.com/JKANetwork/jka-toolkit.git
synced 2026-02-18 02:51:33 +01:00
Update
This commit is contained in:
@@ -41,9 +41,9 @@ function msg2() {
|
||||
}
|
||||
|
||||
version="2.0.2"
|
||||
if [ -z $1 ];then
|
||||
if [ -z "$1" ];then
|
||||
echo "$(gettext "No option specified, use jkazip -h")" > /dev/stderr
|
||||
elif [ $1 = "-h" ];then
|
||||
elif [ "$1" = "-h" ];then
|
||||
echo "$(gettext " synopsis: jkazip <options> <file or directory>")"
|
||||
echo ""
|
||||
echo "$(gettext " -d, decompress file")"
|
||||
@@ -59,14 +59,14 @@ elif [ $1 = "-h" ];then
|
||||
echo ""
|
||||
echo "$(gettext " Supported formats: tar, gzip, bzip2, xzip, lzip, 7z, rar (only unzip) and zip")"
|
||||
echo ""
|
||||
elif [ $1 = "-v" ];then
|
||||
elif [ "$1" = "-v" ];then
|
||||
printf -- "$(gettext "jkazip by JKA Network; version %s")" "$version"
|
||||
echo
|
||||
elif [ $1 = "-d" ];then
|
||||
if [ -z $2 ];then
|
||||
elif [ "$1" = "-d" ];then
|
||||
if [ -z "$2" ];then
|
||||
echo "$(gettext "No file or directory specified")" > /dev/stderr
|
||||
exit
|
||||
elif [ -f $2 ];then
|
||||
elif [ -f "$2" ];then
|
||||
printf -- "$(gettext "File %s will be decompressed")" "$2"
|
||||
echo
|
||||
else
|
||||
@@ -74,37 +74,37 @@ elif [ $1 = "-d" ];then
|
||||
echo
|
||||
exit
|
||||
fi
|
||||
entrada=$2
|
||||
sacaFormato $entrada
|
||||
entrada="$2"
|
||||
sacaFormato "$entrada"
|
||||
case $formato in
|
||||
"tar" | "tar.xz" | "tar.lz" | "tar.gz" | "tar.bz2" | "tgz" | "tbz" | "txz" | "tlz")
|
||||
tar xvf $entrada
|
||||
msg2 $entrada
|
||||
tar xvf "$entrada"
|
||||
msg2 "$entrada"
|
||||
;;
|
||||
"7z")
|
||||
7z x $entrada
|
||||
msg2 $entrada
|
||||
7z x "$entrada"
|
||||
msg2 "$entrada"
|
||||
;;
|
||||
"zip")
|
||||
unzip $entrada
|
||||
msg2 $entrada
|
||||
unzip "$entrada"
|
||||
msg2 "$entrada"
|
||||
;;
|
||||
"gz" | "lz")
|
||||
formato="${formato}ip"
|
||||
$formato -dk $entrada
|
||||
msg2 $entrada
|
||||
$formato -dk "$entrada"
|
||||
msg2 "$entrada"
|
||||
;;
|
||||
"xz")
|
||||
$formato -dk $entrada
|
||||
msg2 $entrada
|
||||
$formato -dk "$entrada"
|
||||
msg2 "$entrada"
|
||||
;;
|
||||
"bz2")
|
||||
bzip2 -dk $entrada
|
||||
msg2 $entrada
|
||||
bzip2 -dk "$entrada"
|
||||
msg2 "$entrada"
|
||||
;;
|
||||
"rar")
|
||||
unrar x $entrada
|
||||
msg2 $entrada
|
||||
unrar x "$entrada"
|
||||
msg2 "$entrada"
|
||||
;;
|
||||
*)
|
||||
printf -- "$(gettext "File extension %s are not supported")" $formato > /dev/stderr
|
||||
@@ -112,54 +112,56 @@ elif [ $1 = "-d" ];then
|
||||
;;
|
||||
esac
|
||||
|
||||
elif [ $1 = "-c" ];then
|
||||
salida=$2
|
||||
if [ -z $3 ];then
|
||||
elif [ "$1" = "-c" ];then
|
||||
salida="$2"
|
||||
if [ -z "$3" ];then
|
||||
echo "$(gettext "No file or directory specified")"
|
||||
exit
|
||||
else
|
||||
for i in $@
|
||||
do
|
||||
if [[ $i != $1 && $i != $2 ]];then
|
||||
if [ ! -d $i -a ! -f $i ];then
|
||||
printf -- "$(gettext "%s no such file or directory")" "$i"
|
||||
echo
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
done
|
||||
exit
|
||||
fi
|
||||
files=$3
|
||||
# TODO: Hacer que esto funcione
|
||||
# else
|
||||
# for i in $@
|
||||
# do
|
||||
# if [[ "$i" != "$1" && "$i" != "$2" ]];then
|
||||
# if [ ! -d "$i" -a ! -f "$i" ];then
|
||||
# printf -- "$(gettext "%s no such file or directory")" "$i"
|
||||
# echo
|
||||
# exit
|
||||
# fi
|
||||
# fi
|
||||
# done
|
||||
# fi
|
||||
files="$3"
|
||||
for (( i=4; i<=$#; i++))
|
||||
do
|
||||
files="$files $(echo $* | cut -f$i -d" ")"
|
||||
done
|
||||
sacaFormato $salida
|
||||
sacaFormato "$salida"
|
||||
case $formato in
|
||||
"tar" | "tar.xz" | "tar.lz" | "tar.gz" | "tar.bz2" | "tgz" | "tbz" | "txz" | "tlz")
|
||||
tar cvfa $salida $files
|
||||
msg $files $salida
|
||||
tar cvfa "$salida" "$files"
|
||||
msg "$files" "$salida"
|
||||
;;
|
||||
"7z")
|
||||
7z a $salida $files
|
||||
msg $files $salida
|
||||
7z a "$salida" "$files"
|
||||
msg "$files" "$salida"
|
||||
;;
|
||||
"zip")
|
||||
zip $salida $files
|
||||
msg $files $salida
|
||||
zip "$salida" "$files"
|
||||
msg "$files" "$salida"
|
||||
;;
|
||||
"gz" | "lz")
|
||||
formato="${formato}ip"
|
||||
$formato -9kc $3 > $salida
|
||||
msg $3 $salida
|
||||
"$formato" -9kc "$3" > "$salida"
|
||||
msg "$3" "$salida"
|
||||
;;
|
||||
"xz")
|
||||
$formato -9kc $3 > $salida
|
||||
msg $3 $salida
|
||||
"$formato" -9kc "$3" > "$salida"
|
||||
msg "$3" "$salida"
|
||||
;;
|
||||
"bz2")
|
||||
$formato -9kc $3 > $salida
|
||||
msg $3 $salida
|
||||
"$formato" -9kc "$3" > "$salida"
|
||||
msg "$3" "$salida"
|
||||
;;
|
||||
"rar")
|
||||
echo "$(gettext "rar compression are not supported")" > /dev/stderr
|
||||
|
||||
Reference in New Issue
Block a user