airgap/scripts/fetch

55 lines
1.5 KiB
Plaintext
Raw Normal View History

#!/bin/bash
[ -f /.dockerenv ] || { echo "please run in supplied container"; exit 1; }
set -e; source environment
build_dir="${BUILD_DIR?}"
buildroot_dir="${build_dir}/buildroot"
buildroot_repo="${BUILDROOT_REPO?}"
buildroot_ref=${BUILDROOT_REF?}
2020-08-13 05:25:41 +00:00
buildroot_external=${BR2_EXTERNAL?}
2020-06-29 22:55:34 +00:00
heads_dir="${build_dir}/heads"
heads_repo="${HEADS_REPO?}"
heads_ref=${HEADS_REF?}
2020-08-13 05:25:41 +00:00
heads_external=${HEADS_EXTERNAL?}
devices=${DEVICES?}
target=${TARGET?}
[[ -f ~/.gitconfig ]] || \
printf "[color]\nui=auto\n[user]\nemail=build@local\nname=Build User" \
> ~/.gitconfig
mkdir -p "$build_dir"
2020-07-07 21:13:18 +00:00
[ "$(ls -A "${buildroot_dir}")" ] \
|| git clone "$buildroot_repo" "$buildroot_dir"
2020-08-13 05:25:41 +00:00
(
cd $buildroot_dir;
2020-09-09 11:07:35 +00:00
git checkout "$buildroot_ref";
git reset --hard;
if [ "$(ls -A "${buildroot_external}/patches")" ]; then
for patch in "${buildroot_external}"/patches/*; do
echo "Applying patch: ${patch}";
patch -p1 --no-backup-if-mismatch < "${patch}";
done;
fi
2020-08-13 05:25:41 +00:00
make "airgap_${target}_defconfig";
make source;
)
2020-06-29 22:55:34 +00:00
2020-07-07 21:13:18 +00:00
[ "$(ls -A "${heads_dir}")" ] \
|| git clone "$heads_repo" "$heads_dir"
2020-08-13 05:25:41 +00:00
(
cd "$heads_dir";
2020-09-09 11:07:35 +00:00
git checkout "$heads_ref";
git reset --hard;
if [ "$(ls -A "${heads_external}/patches")" ]; then
for patch in "${heads_external}"/patches/*; do
echo "Applying patch: ${patch}";
patch -p1 --no-backup-if-mismatch < "${patch}";
done;
fi
2020-08-13 05:25:41 +00:00
rsync -Pav "${heads_external}/boards/" "${heads_dir}/boards/"
[[ "$devices" =~ "librem" ]] \
&& (cd "$heads_dir/blobs/librem_kbl" && ./get_blobs.sh)
)