From cdbb47859292e1687436bf7bd30a0e0a734f2595 Mon Sep 17 00:00:00 2001 From: bill-auger Date: Wed, 2 May 2018 13:53:41 -0400 Subject: squashme - rebuild.sh --- configs/profile/rebuild.sh | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/configs/profile/rebuild.sh b/configs/profile/rebuild.sh index 1bfc1d4..87c8143 100755 --- a/configs/profile/rebuild.sh +++ b/configs/profile/rebuild.sh @@ -1,6 +1,7 @@ #!/bin/bash -readonly MODE='wipe' # total wipe of work dir preserving package cache +readonly MODE='wipe' # total wipe of work dir optionally preserving package cache +readonly PRESERVE_CACHE='false' # preserve package cache in 'wipe' mode # readonly MODE='rebuild' # full update rebuild preserving work dir # readonly MODE='tweak' # apply chroot customization tweaks only readonly TARGET='dual' # dual-arch (default) @@ -32,17 +33,27 @@ do declare -a mountpoints=() done if [ "$MODE" == 'wipe' ] -then for arch in i686 x86_64 - do isorepo=./work/${arch}/root-image/isorepo - [ -d $isorepo -a ! -d ./isorepo-${arch} ] && mv $isorepo ./isorepo-${arch} 2> /dev/null - done +then if [ "$PRESERVE_CACHE" == 'true' ] + then for arch in i686 x86_64 + do isorepo=./work/${arch}/root-image/isorepo + cache_dir=./work/isorepo-${arch} + mkdir -p $cache_dir + [ -d $isorepo ] && mv $isorepo/* $cache_dir/ 2> /dev/null + done + fi - rm -rf ./work/ 2> /dev/null + rm -rf ./work/${arch} 2> /dev/null for arch in i686 x86_64 - do if [ -d ./isorepo-${arch} ] && [ "$TARGET" == 'dual' -o "$TARGET" == "${arch}" ] - then mkdir -p ./work/${arch}/root-image - mv ./isorepo-${arch} ./work/${arch}/root-image/isorepo + do isorepo=./work/${arch}/root-image/isorepo + cache_dir=./work/isorepo-${arch} + if [ "$PRESERVE_CACHE" == 'true' ] + then if [ "$TARGET" == 'dual' -o "$TARGET" == "${arch}" ] + then mkdir -p $isorepo + mv $cache_dir/* $isorepo/ + rmdir $cache_dir + fi + else rmdir $cache_dir 2> /dev/null fi done @@ -56,10 +67,10 @@ then rm work/build.make_customize_root_image_$TARGET \ fi -CMD="./build.sh -v -E $EDITION -T $TARGET $CACHE -V $VERSION" +CMD="./build.sh -v -E $EDITION -T $TARGET $CACHE -V $VERSION $*" if ${CMD} then echo "success" ; rm ./continue.sh 2> /dev/null -else echo -e "failure - continue with: ./continue.sh" - echo -e "#!/bin/bash\n${CMD}" > ./continue.sh +else echo -e "failure executing:\n\t${CMD}\ncontinue with:\n\t./continue.sh [args-to-build.sh]" + echo -e "#!/bin/bash\n\n${CMD} \$*" > ./continue.sh chmod a+x ./continue.sh fi -- cgit v1.2.2