diff options
-rwxr-xr-x | bin/reproducible_lede.sh | 1 | ||||
-rwxr-xr-x | bin/reproducible_openwrt.sh | 1 | ||||
-rw-r--r-- | bin/reproducible_openwrt_common.sh | 45 |
3 files changed, 36 insertions, 11 deletions
diff --git a/bin/reproducible_lede.sh b/bin/reproducible_lede.sh index 519c8c0c..bccc6d00 100755 --- a/bin/reproducible_lede.sh +++ b/bin/reproducible_lede.sh @@ -25,6 +25,7 @@ case $1 in shift case $1 in openwrt_build |\ + openwrt_download |\ openwrt_get_banner |\ node_cleanup_tmpdirs) ;; # this is the allowed list *) diff --git a/bin/reproducible_openwrt.sh b/bin/reproducible_openwrt.sh index b3d66750..cf7eedc9 100755 --- a/bin/reproducible_openwrt.sh +++ b/bin/reproducible_openwrt.sh @@ -25,6 +25,7 @@ case $1 in shift case $1 in openwrt_build |\ + openwrt_download |\ openwrt_get_banner |\ node_cleanup_tmpdirs) ;; # this is the allowed list *) diff --git a/bin/reproducible_openwrt_common.sh b/bin/reproducible_openwrt_common.sh index 77649087..13150400 100644 --- a/bin/reproducible_openwrt_common.sh +++ b/bin/reproducible_openwrt_common.sh @@ -196,6 +196,33 @@ openwrt_compile() { ionice -c 3 $MAKE $OPTIONS package/index || true # don't let some packages fail the whole build } +# called by openwrt_two_times +# ssh $GENERIC_NODE1 reproducible_$TYPE node openwrt_download $TYPE $TARGET $CONFIG $TMPDIR +openwrt_download() { + local TYPE=$1 + local TARGET=$2 + local CONFIG=$3 + local TMPDIR=$4 + + mkdir -p $TMPDIR/download + cd $TMPDIR/download + + # checkout the repo + echo "=============================================================================" + echo "$(date -u) - Cloning $TYPE git repository." + echo "=============================================================================" + git clone -b $OPENWRT_GIT_BRANCH $OPENWRT_GIT_REPO $TYPE + cd $TYPE + + # update feeds + ./scripts/feeds update + ./scripts/feeds install -a + + # configure openwrt because otherwise it wont download everything + openwrt_config $CONFIG + make download -j $NUM_CPU +} + openwrt_get_banner() { TMPDIR=$1 TYPE=$2 @@ -225,17 +252,10 @@ openwrt_build() { export TMPDIR=$5 export TMPBUILDDIR=$TMPDIR/build/ - if [ -d $TMPDIR ] ; then - echo "=============================================================================" - echo "TMPDIR already exists! $TMPDIR" - echo "=============================================================================" - exit 1 - fi - mkdir -p $TMPBUILDDIR + mv "$TMPDIR/download" "$TMPBUILDDIR" trap node_cleanup_tmpdirs INT TERM EXIT - # we have also to set the TMP - + # openwrt/lede is checkouted under /download cd $TMPBUILDDIR # checkout the repo @@ -248,8 +268,6 @@ openwrt_build() { # set tz, date, core, .. openwrt_apply_variations $RUN - # configure openwrt - openwrt_config $CONFIG openwrt_build_toolchain # build images and packages openwrt_compile $TYPE $RUN $TARGET @@ -275,6 +293,11 @@ build_two_times() { TARGET=$2 CONFIG=$3 + # download and prepare openwrt on node b1 + ssh $GENERIC_NODE1 reproducible_$TYPE node openwrt_download $TYPE $TARGET $CONFIG $TMPDIR + rsync -a $GENERIC_NODE1:$TMPDIR/download/ $TMPDIR/download/ + rsync -a $TMPDIR/download/ $GENERIC_NODE2:$TMPDIR/download/ + ## first run RUN=b1 ssh $GENERIC_NODE1 reproducible_$TYPE node openwrt_build $TYPE $RUN $TARGET $CONFIG $TMPDIR |