summaryrefslogtreecommitdiff
path: root/configs
diff options
context:
space:
mode:
authorbill-auger <mr.j.spam.me@gmail.com>2018-05-02 13:53:41 -0400
committerbill-auger <mr.j.spam.me@gmail.com>2020-03-27 19:32:36 -0400
commit2374064cb0b68b11293e093765f0fc3e0c1d7a67 (patch)
tree740d9579743a35171c4db5b47333c80177a61ba5 /configs
parent100839d32ddc0737885685bdec5576a824f89e33 (diff)
preserve rebuild.sh package cache in 'wipe' mode
Diffstat (limited to 'configs')
-rwxr-xr-xconfigs/profile/rebuild.sh60
1 files changed, 36 insertions, 24 deletions
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-<EDITION>-<TARGET>-<VERSION>.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