github.com/kaisenlinux/docker.io@v0.0.0-20230510090727-ea55db55fac7/debian/helpers/unpack-components.sh (about) 1 #!/bin/bash 2 : <<=cut 3 4 =head1 DESCRIPTION 5 6 Unpack MUT components. Since devscripts 2.19.7, 'origtargz --unpack' 7 unpacks MUT components automatically, and this script is not needed 8 anymore. Also see #929786. 9 10 =head1 SYNOPSIS 11 12 ./debian/helpers/unpack-components.sh 13 14 =cut 15 16 set -e 17 set -u 18 19 DEB_SOURCE="$( dpkg-parsechangelog -SSource )" 20 DEB_VERSION_UPSTREAM="$( dpkg-parsechangelog -SVersion | sed -e 's/-[^-]*$//' )" 21 22 if ls ../${DEB_SOURCE}_${DEB_VERSION_UPSTREAM}.orig-*.tar.* 2>>/dev/null; then 23 for T in ../${DEB_SOURCE}_${DEB_VERSION_UPSTREAM}.orig-*.tar.*; do 24 C="${T##*.orig-}" 25 C="${C%%.tar*}" 26 mkdir -p "${C}" 27 tar xf ${T} -C "${C}" --strip-components=1 28 if [ "$(ls -m ${C})" == "${C}" ]; then 29 ## --strip-components=1 did not work. 30 mv "${C}" "${C}.tmp" 31 mv "${C}.tmp/${C}" . 32 rmdir "${C}.tmp" 33 fi 34 done 35 else 36 printf "W: no components to extract.\n" 37 exit 0 38 fi