diff --git a/scripts/fetch b/scripts/fetch index 83d2301..93c7a06 100755 --- a/scripts/fetch +++ b/scripts/fetch @@ -24,12 +24,14 @@ mkdir -p "$build_dir" || git clone "$buildroot_repo" "$buildroot_dir" ( cd $buildroot_dir; - git checkout "$buildroot_ref" - git reset --hard - for patch in "${buildroot_external}"/patches/*; do - echo "Applying patch: ${patch}"; - patch -p1 --no-backup-if-mismatch < "${patch}"; - done; + 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 make "airgap_${target}_defconfig"; make source; ) @@ -38,12 +40,14 @@ mkdir -p "$build_dir" || git clone "$heads_repo" "$heads_dir" ( cd "$heads_dir"; - git checkout "$heads_ref" - git reset --hard - for patch in "${heads_external}"/patches/*; do - echo "Applying patch: ${patch}" - patch -p1 --no-backup-if-mismatch < "${patch}" - done + 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 rsync -Pav "${heads_external}/boards/" "${heads_dir}/boards/" [[ "$devices" =~ "librem" ]] \ && (cd "$heads_dir/blobs/librem_kbl" && ./get_blobs.sh)