mirror of
https://github.com/oasislinux/oasis.git
synced 2026-05-12 21:34:47 +02:00
e5bb6756c1
Most systems do not have pax installed by default, or it is not available at all. However, since we are relying on the -s flag for member name substitution, we can't just use a tar command that works everywhere. Instead, support the environment variable PAXREAD to specify the command to use in place of `pax -r`. Since bsdtar from libarchive supports -s, we can set PAXREAD='bsdtar -xf -'.
41 lines
591 B
Bash
41 lines
591 B
Bash
set -e
|
|
|
|
if [ "$#" != 1 ] ; then
|
|
echo 'usage: fetch-curl.sh dir' >&2
|
|
exit 2
|
|
fi
|
|
|
|
dir=$1
|
|
shift
|
|
|
|
cd "$dir"
|
|
|
|
if [ -e src ] ; then
|
|
rm -rf src
|
|
fi
|
|
|
|
if ! sha256sum -c sha256 2>/dev/null ; then
|
|
curl -L -K url -O
|
|
sha256sum -c sha256
|
|
fi
|
|
|
|
while read -r checksum archive ; do
|
|
case $archive in
|
|
*.tar.gz|*.tgz)
|
|
tool=zcat ;;
|
|
*.tar.bz2)
|
|
tool=bzcat ;;
|
|
*.tar.xz)
|
|
tool=xzcat ;;
|
|
*)
|
|
tool=
|
|
esac
|
|
if [ -n "$tool" ] ; then
|
|
"$tool" "$archive" | ${PAXREAD:-pax -r} -s ',^[^/]*,src,' '*/*'
|
|
fi
|
|
done <sha256
|
|
|
|
if [ -d patch ] ; then
|
|
git apply -v --whitespace=nowarn --directory "$dir/src" patch/*
|
|
fi
|