Use the x command for unrar and rar to preserve paths

unrar and rar will discard everything up to the file name when extracting
with `e`. This breaks extraction of archives that have files with duplicate
file names and ones where the paths are important. The `x` command
extracts with the full path instead.
This commit is contained in:
lucy 2014-07-16 04:38:57 +02:00 committed by Sorin Ionescu
parent fdb406f917
commit 3e8349ddde

View File

@ -54,8 +54,8 @@ while (( $# > 0 )); do
(*.Z) uncompress "$1" ;; (*.Z) uncompress "$1" ;;
(*.zip) unzip "$1" -d $extract_dir ;; (*.zip) unzip "$1" -d $extract_dir ;;
(*.rar) unrar &> /dev/null \ (*.rar) unrar &> /dev/null \
&& unrar e -ad "$1" \ && unrar x -ad "$1" \
|| rar e -ad "$1" ;; || rar x -ad "$1" ;;
(*.7z) 7za x "$1" ;; (*.7z) 7za x "$1" ;;
(*.deb) (*.deb)
mkdir -p "$extract_dir/control" mkdir -p "$extract_dir/control"