diff --git a/Makefile.work b/Makefile.work index 2dda7876c..bea20edb4 100644 --- a/Makefile.work +++ b/Makefile.work @@ -56,6 +56,10 @@ # * GZ_COMPRESS_PROGRAM: Select pigz to reduce build time # * Default: gzip # * Values: pigz,gzip +# * UNATTENDED: Don't wait for interactive input from terminal, setting this +# * value to anything will enable it +# * Default: unset +# * Value: y # ############################################################################### @@ -611,23 +615,28 @@ init : .ONESHELL : reset reset : - $(Q)echo && echo -n "Warning! All local changes will be lost. Proceed? [y/N]: " - $(Q)read ans && ( - if [ $$ans == y ]; then - echo "Resetting local repository. Please wait..."; - sudo rm -rf fsroot*; - if [ "$(MULTIARCH_QEMU_ENVIRON)" == y ] && [[ "$(CONFIGURED_ARCH)" == "armhf" || "$(CONFIGURED_ARCH)" == "arm64" ]]; then - echo "Stopping march $(CONFIGURED_ARCH) docker" - sudo kill -9 `sudo cat /var/run/march/docker.pid` || true - sudo rm -f /var/run/march/docker.pid || true - fi - git clean -xfdf; - git reset --hard; - git submodule foreach --recursive 'git clean -xfdf || true'; - git submodule foreach --recursive 'git reset --hard || true'; - git submodule foreach --recursive 'git remote update || true'; - git submodule update --init --recursive; - echo "Reset complete!"; - else - echo "Reset aborted"; - fi ) + $(Q)echo && ( + if [ -z "$(UNATTENDED)" ]; then + echo -n "Warning! All local changes will be lost. Proceed? [y/N]: " + @read ans + else + ans=y + fi + if [ $$ans == y ]; then + echo "Resetting local repository. Please wait..."; + sudo rm -rf fsroot*; + if [ "$(MULTIARCH_QEMU_ENVIRON)" == y ] && [[ "$(CONFIGURED_ARCH)" == "armhf" || "$(CONFIGURED_ARCH)" == "arm64" ]]; then + echo "Stopping march $(CONFIGURED_ARCH) docker" + sudo kill -9 `sudo cat /var/run/march/docker.pid` || true + sudo rm -f /var/run/march/docker.pid || true + fi + git clean -xfdf; + git reset --hard; + git submodule foreach --recursive 'git clean -xfdf || true'; + git submodule foreach --recursive 'git reset --hard || true'; + git submodule foreach --recursive 'git remote update || true'; + git submodule update --init --recursive; + echo "Reset complete!"; + else + echo "Reset aborted"; + fi )