From 2374064cb0b68b11293e093765f0fc3e0c1d7a67 Mon Sep 17 00:00:00 2001 From: bill-auger Date: Wed, 2 May 2018 13:53:41 -0400 Subject: preserve rebuild.sh package cache in 'wipe' mode --- configs/profile/rebuild.sh | 60 +++++++++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 24 deletions(-) (limited to 'configs') diff --git a/configs/profile/rebuild.sh b/configs/profile/rebuild.sh index 3f212c6..87c8143 100755 --- a/configs/profile/rebuild.sh +++ b/configs/profile/rebuild.sh @@ -1,18 +1,20 @@ #!/bin/bash -readonly MODE='wipe' # total wipe of work dir preserving package cache -# readonly MODE='rebuild' # full update rebuild preserving work dir -# readonly MODE='tweak' # chroot customization tweaks only -readonly TARGET='dual' # dual-arch (default) -# readonly TARGET='i686' # i686 target only -# readonly TARGET='x86_64' # x86_64 target only -# readonly EDITION='OpenRC/CLI' # OpenRC/CLI init/WM-DE pair -# readonly EDITION='OpenRC/LXDE' # OpenRC/LXDE init/WM-DE pair -readonly EDITION='SystemD/CLI' # SystemD/CLI init/WM-DE pair (default) -# readonly EDITION='SystemD/LXDE' # SystemD/LXDE init/WM-DE pair -readonly CACHE='' # net-install (default) -# readonly CACHE='-O' # offline install -readonly VERSION="`date +%Y.%m.%d-%H.%M`-alpha" # ISO filename like: parabola---.iso +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) +# readonly TARGET='i686' # i686 target only +# readonly TARGET='x86_64' # x86_64 target only +# readonly EDITION='OpenRC/CLI' # OpenRC/CLI init/WM-DE pair +# readonly EDITION='OpenRC/LXDE' # OpenRC/LXDE init/WM-DE pair +readonly EDITION='SystemD/CLI' # SystemD/CLI init/WM-DE pair (default) +# readonly EDITION='SystemD/LXDE' # SystemD/LXDE init/WM-DE pair +readonly CACHE='' # net-install (default) +# readonly CACHE='-O' # offline install +readonly VERSION="`date +%Y.%m.%d`" # for ISO filename (default) +# readonly VERSION="`date +%Y.%m.%d-%H.%M`-alpha" ((`id -u`)) && echo "This script must be run with root privileges." && exit @@ -31,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 @@ -55,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