diff --git a/init.sh b/init.sh index cc47062..37a90eb 100755 --- a/init.sh +++ b/init.sh @@ -10,11 +10,15 @@ # --unattended Run in unattended mode (skip confirmations) # --skip-os-update Skip operating system update # --skip-prereqs Skip installing prerequisite apps -# --skip-docker-images On UNINSTALL: keep the rootless docker daemon, the -# docker-install user, and the image/build cache instead -# of tearing them down — so a following reinstall rebuilds -# the WebUI image from cache (fast) instead of from -# scratch. (No effect on install.) +# --skip-rootless On UNINSTALL: keep the entire rootless layer (the +# (also: --skip-docker-images) +# docker-install user, the rootless dockerd, the sysctl +# drop-ins, and the image/build cache) instead of tearing +# them down. A following reinstall then skips the slow +# `dockerd-rootless-setuptool.sh install` step entirely +# and rebuilds containers from the existing image cache, +# which on local dev iteration cuts reinstall time from +# minutes to seconds. (No effect on install.) # --system-dir=PATH Install root for the control plane (configs/logs/install/ # db). Default /libreportal-system. (Also: LP_SYSTEM_DIR.) # --containers-dir=PATH Root for live app data. Default /libreportal-containers. @@ -31,7 +35,7 @@ # ./init.sh --random-password --local init # ./init.sh --random-password --local --unattended init # ./init.sh --random-password --local --skip-os-update --skip-prereqs init -# ./init.sh --unattended --skip-docker-images uninstall # keep docker layer +# ./init.sh --unattended --skip-rootless uninstall # keep rootless layer for fast reinstall # ./init.sh init mypassword myuser mytoken https://github.com/user/repo.git # @@ -254,10 +258,17 @@ for ((i=1; i<=$#; i++)); do init_skip_prereqs=true ((init_shift_count++)) ;; - --skip-docker-images) + --skip-docker-images|--skip-rootless) # On uninstall: preserve the rootless docker layer (daemon + - # docker-install user + image/build cache) so the next reinstall's - # `docker build` is cache-fast. Honored in runFullUninstall. + # docker-install user + sysctl drop-ins + image/build cache) + # so the next reinstall's `docker build` is cache-fast AND + # the slow `dockerd-rootless-setuptool.sh install` step is + # skipped. Honored in runFullUninstall. + # + # Two spellings: --skip-docker-images is the original name; + # --skip-rootless is the clearer alias (the flag keeps a lot + # more than just images). Both set the same flag, so passing + # either or both has the same effect. init_skip_docker_images=true ((init_shift_count++)) ;; @@ -1641,11 +1652,12 @@ runFullUninstall() iuser=$(grep -h '^CFG_DOCKER_INSTALL_USER=' "${configs_dir}general/general_docker_install" 2>/dev/null | head -1 | cut -d= -f2 | awk '{print $1}') iuser="${iuser:-dockerinstall}" - # --skip-docker-images: keep the rootless docker layer (the daemon, the - # "$iuser" user, the image/build cache + the rootless sysctl drop-in) instead - # of tearing it down, so a following reinstall's `docker build` is cache-fast - # instead of from-scratch. Everything else (control plane, manager, footprint, - # /docker) is still removed. + # --skip-rootless (alias: --skip-docker-images): keep the entire rootless + # layer (the daemon, the "$iuser" user, the image/build cache, and the + # rootless sysctl drop-ins) instead of tearing it down, so a following + # reinstall skips the slow `dockerd-rootless-setuptool.sh install` AND + # rebuilds from the existing image cache. Everything else (control plane, + # manager, footprint, /docker) is still removed. local keep_docker="${init_skip_docker_images:-false}" isHeader "LibrePortal — FULL Uninstall" @@ -1675,7 +1687,7 @@ runFullUninstall() printf " ${GREEN}Left in place:${NC} ${DIM}docker engine, docker-compose, apt-installed deps, and your SSH config (so you can't get locked out).${NC}\n" echo "" if [[ "$keep_docker" == "true" ]]; then - isNotice "--skip-docker-images: KEEPING the rootless docker daemon, the '$iuser' user, and the image/build cache (for a faster reinstall)." + isNotice "--skip-rootless: KEEPING the rootless docker daemon, the '$iuser' user, sysctl drop-ins, and the image/build cache (for a faster reinstall)." echo "" fi if [[ "$init_unattended_mode" == true ]]; then