2020-06-15 08:08:20 +00:00
|
|
|
#!/bin/bash
|
|
|
|
[ -f /.dockerenv ] || { echo "please run in supplied container"; exit 1; }
|
|
|
|
set -e; source environment
|
|
|
|
|
2022-12-24 05:15:00 +00:00
|
|
|
heads_dir="${HOME}/heads"
|
2020-06-29 22:55:34 +00:00
|
|
|
heads_repo="${HEADS_REPO?}"
|
|
|
|
heads_ref=${HEADS_REF?}
|
2020-08-13 05:25:41 +00:00
|
|
|
heads_external=${HEADS_EXTERNAL?}
|
|
|
|
devices=${DEVICES?}
|
|
|
|
target=${TARGET?}
|
2022-12-24 05:15:00 +00:00
|
|
|
unset FAKETIME
|
2020-06-15 08:08:20 +00:00
|
|
|
|
|
|
|
[[ -f ~/.gitconfig ]] || \
|
|
|
|
printf "[color]\nui=auto\n[user]\nemail=build@local\nname=Build User" \
|
|
|
|
> ~/.gitconfig
|
|
|
|
|
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;
|
2020-10-22 05:59:29 +00:00
|
|
|
git tag airgap || :
|
|
|
|
current_ref="$(git rev-parse --verify HEAD)"
|
|
|
|
[ "$current_ref" == "$heads_ref" ] || {
|
|
|
|
echo "Error: $heads_ref was not successfully checked out"; exit 1;
|
|
|
|
}
|
2020-09-09 11:07:35 +00:00
|
|
|
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-11-10 00:19:36 +00:00
|
|
|
[ -d "${heads_external}/boards" ] && \
|
|
|
|
rsync -Pav "${heads_external}/boards/" "${heads_dir}/boards/"
|
2020-08-13 05:25:41 +00:00
|
|
|
[[ "$devices" =~ "librem" ]] \
|
|
|
|
&& (cd "$heads_dir/blobs/librem_kbl" && ./get_blobs.sh)
|
|
|
|
)
|