File: unpack-components.sh

package info (click to toggle)
docker.io 18.09.1%2Bdfsg1-7.1%2Bdeb10u3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 66,144 kB
  • sloc: sh: 9,753; makefile: 827; ansic: 239; python: 162; asm: 10
file content (36 lines) | stat: -rwxr-xr-x 815 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
: <<=cut

=head1 DESCRIPTION

Unpack MUT components.

=head1 SYNOPSIS

 ./debian/unpack-components.sh

=cut

set -e
set -u

DEB_SOURCE="$( dpkg-parsechangelog -SSource )"
DEB_VERSION_UPSTREAM="$( dpkg-parsechangelog -SVersion | sed -e 's/-[^-]*$//' )"

if ls ../${DEB_SOURCE}_${DEB_VERSION_UPSTREAM}.orig-*.tar.* 2>>/dev/null; then
    for T in ../${DEB_SOURCE}_${DEB_VERSION_UPSTREAM}.orig-*.tar.*; do
        C="${T##*.orig-}"
        C="${C%%.tar*}"
        mkdir -p "${C}"
        tar xf ${T} -C "${C}" --strip-components=1
        if [ "$(ls -m ${C})" == "${C}" ]; then
            ## --strip-components=1 did not work.
            mv "${C}" "${C}.tmp"
            mv "${C}.tmp/${C}" .
            rmdir "${C}.tmp"
        fi
    done
else
    printf "W: no components to extract.\n"
    exit 0
fi