From 41fb0fd8ecdd7bae9817838b1af539de599433a0 Mon Sep 17 00:00:00 2001 From: Michael Olbrich Date: Tue, 21 Jun 2011 18:08:15 +0200 Subject: ptxd_make_world_extract: force extracting to _DIR Signed-off-by: Michael Olbrich --- scripts/lib/ptxd_make_world_extract.sh | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'scripts/lib/ptxd_make_world_extract.sh') diff --git a/scripts/lib/ptxd_make_world_extract.sh b/scripts/lib/ptxd_make_world_extract.sh index 1eb260af9..46e32ccfb 100644 --- a/scripts/lib/ptxd_make_world_extract.sh +++ b/scripts/lib/ptxd_make_world_extract.sh @@ -1,6 +1,8 @@ #!/bin/bash # # Copyright (C) 2008, 2009, 2010 by Marc Kleine-Budde +# 2011 by Michael Olbrich +# # See CREDITS for details about who has contributed to this project. # # For further information about the PTXdist project and license conditions @@ -59,9 +61,28 @@ ptxd_make_world_extract() { echo "\ extract: pkg_src=$(ptxd_print_path ${pkg_src}) -extract: pkg_extract_dir=$(ptxd_print_path ${pkg_extract_dir})" +extract: pkg_extract_dir=$(ptxd_print_path ${pkg_dir})" - ptxd_make_extract_archive "${pkg_src}" "${pkg_extract_dir}" + local tmpdir + tmpdir="$(mktemp -d "${pkg_dir}.XXXXXX")" + if ! ptxd_make_extract_archive "${pkg_src}" "${tmpdir}"; then + rm -rf "${tmpdir}" + ptxd_bailout "failed to extract '${pkg_src}'." + fi + local depth=$[${pkg_strip_level:=1}+1] + if [ -e "${pkg_dir}" ]; then + tar -C "${tmpdir}" --remove-files -c . | \ + tar -x --strip-components=${depth} -C "${pkg_dir}" + check_pipe_status + else + mkdir -p "${pkg_dir}" && + find "${tmpdir}" -mindepth ${depth} -maxdepth ${depth} -print0 | \ + xargs -0 mv -t "${pkg_dir}" + check_pipe_status + fi + local ret=$? + rm -rf "${tmpdir}" + return ${ret} } export -f ptxd_make_world_extract -- cgit v1.2.3