build: add an env var to run make reset unattended (#13820)
- previously "make reset" was expecting user input from the terminal to do its job - setting UNATTENDED to any non-zero string will allow "make reset" to run without interactive confirmation Signed-off-by: Mathieu Launay <m.launay@criteo.com>
This commit is contained in:
parent
35a4410f86
commit
bda91a19e3
@ -44,6 +44,16 @@
|
|||||||
# * ENABLE_AUTO_TECH_SUPPORT: Enable the configuration for event-driven techsupport & coredump mgmt feature
|
# * ENABLE_AUTO_TECH_SUPPORT: Enable the configuration for event-driven techsupport & coredump mgmt feature
|
||||||
# * Default: y
|
# * Default: y
|
||||||
# * Values: y,n
|
# * Values: y,n
|
||||||
|
# * INCLUDE_BOOTCHART: Install SONiC bootchart
|
||||||
|
# * Default: y
|
||||||
|
# * Values: y,n
|
||||||
|
# * ENABLE_BOOTCHART: Enable SONiC bootchart
|
||||||
|
# * Default: n
|
||||||
|
# * Values: y,n
|
||||||
|
# * UNATTENDED: Don't wait for interactive input from terminal, setting this
|
||||||
|
# * value to anything will enable it
|
||||||
|
# * Default: unset
|
||||||
|
# * Value: y
|
||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
@ -482,23 +492,28 @@ init :
|
|||||||
|
|
||||||
.ONESHELL : reset
|
.ONESHELL : reset
|
||||||
reset :
|
reset :
|
||||||
@echo && echo -n "Warning! All local changes will be lost. Proceed? [y/N]: "
|
@echo && (
|
||||||
@read ans && (
|
if [ -z "$(UNATTENDED)" ]; then
|
||||||
if [ $$ans == y ]; then
|
echo -n "Warning! All local changes will be lost. Proceed? [y/N]: "
|
||||||
echo "Resetting local repository. Please wait...";
|
@read ans
|
||||||
sudo rm -rf fsroot*;
|
else
|
||||||
if [ "$(MULTIARCH_QEMU_ENVIRON)" == y ] && [[ "$(CONFIGURED_ARCH)" == "armhf" || "$(CONFIGURED_ARCH)" == "arm64" ]]; then
|
ans=y
|
||||||
echo "Stopping march $(CONFIGURED_ARCH) docker"
|
fi
|
||||||
sudo kill -9 `sudo cat /var/run/march/docker.pid` || true
|
if [ $$ans == y ]; then
|
||||||
sudo rm -f /var/run/march/docker.pid || true
|
echo "Resetting local repository. Please wait...";
|
||||||
fi
|
sudo rm -rf fsroot*;
|
||||||
git clean -xfdf;
|
if [ "$(MULTIARCH_QEMU_ENVIRON)" == y ] && [[ "$(CONFIGURED_ARCH)" == "armhf" || "$(CONFIGURED_ARCH)" == "arm64" ]]; then
|
||||||
git reset --hard;
|
echo "Stopping march $(CONFIGURED_ARCH) docker"
|
||||||
git submodule foreach --recursive 'git clean -xfdf || true';
|
sudo kill -9 `sudo cat /var/run/march/docker.pid` || true
|
||||||
git submodule foreach --recursive 'git reset --hard || true';
|
sudo rm -f /var/run/march/docker.pid || true
|
||||||
git submodule foreach --recursive 'git remote update || true';
|
fi
|
||||||
git submodule update --init --recursive;
|
git clean -xfdf;
|
||||||
echo "Reset complete!";
|
git reset --hard;
|
||||||
else
|
git submodule foreach --recursive 'git clean -xfdf || true';
|
||||||
echo "Reset aborted";
|
git submodule foreach --recursive 'git reset --hard || true';
|
||||||
fi )
|
git submodule foreach --recursive 'git remote update || true';
|
||||||
|
git submodule update --init --recursive;
|
||||||
|
echo "Reset complete!";
|
||||||
|
else
|
||||||
|
echo "Reset aborted";
|
||||||
|
fi )
|
||||||
|
Reference in New Issue
Block a user