diff options
author | bill-auger <mr.j.spam.me@gmail.com> | 2018-05-02 13:53:41 -0400 |
---|---|---|
committer | bill-auger <mr.j.spam.me@gmail.com> | 2018-07-02 10:50:36 -0400 |
commit | cdbb47859292e1687436bf7bd30a0e0a734f2595 (patch) | |
tree | 0461fa04d17cf79c8749d73f2bf0328c87489243 /configs | |
parent | f55c754b8d6923cdda9937839fca293b0e710f1d (diff) |
squashme - rebuild.sh
Diffstat (limited to 'configs')
-rwxr-xr-x | configs/profile/rebuild.sh | 35 |
1 files 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 |