Skip to content

Commit

Permalink
Fix unarchive for .deb which uses xz, and absolute paths
Browse files Browse the repository at this point in the history
  • Loading branch information
zachriggle authored and sorin-ionescu committed Nov 12, 2015
1 parent 2ad1b2f commit 7227c4f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions modules/archive/functions/unarchive
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
local remove_archive
local success
local file_name
local file_path
local extract_dir

if (( $# == 0 )); then
Expand Down Expand Up @@ -36,6 +37,7 @@ while (( $# > 0 )); do

success=0
file_name="${1:t}"
file_path="${1:A}"
extract_dir="${file_name:r}"
case "$1:l" in
(*.tar.gz|*.tgz) tar xvzf "$1" ;;
Expand All @@ -60,10 +62,10 @@ while (( $# > 0 )); do
(*.deb)
mkdir -p "$extract_dir/control"
mkdir -p "$extract_dir/data"
cd "$extract_dir"; ar vx "../${1}" > /dev/null
cd control; tar xzvf ../control.tar.gz
cd ../data; tar xzvf ../data.tar.gz
cd ..; rm *.tar.gz debian-binary
cd "$extract_dir"; ar vx "${file_path}" > /dev/null
cd control; tar xvf ../control.tar.*
cd ../data; tar xvf ../data.tar.*
cd ..; rm control.tar.* data.tar.* debian-binary
cd ..
;;
(*)
Expand Down

0 comments on commit 7227c4f

Please sign in to comment.