Use parent tor-browser-build instead of submodule if available

This commit is contained in:
JeremyRand 2019-10-31 00:59:14 +00:00
parent 0ed95b0fa7
commit 254be6172f
No known key found for this signature in database
GPG Key ID: B3F2D165786D6570
2 changed files with 23 additions and 2 deletions

View File

@ -59,8 +59,7 @@ release-osx-x86_64: submodule-update
$(rbm) build ncprop279 --target release --target ncdns-osx-x86_64
submodule-update:
git submodule update --init
$(MAKE) -C tor-browser-build submodule-update
./setup-submodule-symlinks
fetch: submodule-update
$(rbm) fetch

22
setup-submodule-symlinks Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env bash
# This script inits tor-browser-build as a Git submodule of ncdns-repro, unless
# ncdns-repro is inside a tor-browser-build tree (e.g. as a Git submodule of
# tor-browser-build), in which case it uses the parent tor-browser-build.
set -euo pipefail
shopt -s nullglob globstar
ncdnsdir=$(pwd)
parentdir=$(dirname "${ncdnsdir}")
parentbase=$(basename "${parentdir}")
if [ "${parentbase}" == "tor-browser-build" ]; then
if [ -e tor-browser-build ]; then
rm tor-browser-build || rmdir tor-browser-build || mv tor-browser-build tor-browser-build-backup
fi
ln -s -T .. tor-browser-build
else
git submodule update --init
make -C tor-browser-build submodule-update
fi