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