build: add an env var to run make reset unattended (#13821)

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

- Why I did it
This is the backport to 202211 from master (see PR #12207)
When doing automated builds of SONiC images, we need to reset the working repositories between each build.

- How I did it
Adding an environment variable that is read by Makefile.work

- How to verify it
running
UNATTENDED=1 make reset 
should make an automatic reset of all working directories
This commit is contained in:
mathieulaunay 2023-02-21 17:40:25 +01:00 committed by GitHub
parent f42d017183
commit 2866a0e47e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -53,6 +53,10 @@
# * ENABLE_BOOTCHART: Enable SONiC bootchart # * ENABLE_BOOTCHART: Enable SONiC bootchart
# * Default: n # * Default: n
# * Values: y,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
# #
############################################################################### ###############################################################################
@ -585,8 +589,13 @@ init :
.ONESHELL : reset .ONESHELL : reset
reset : reset :
$(Q)echo && echo -n "Warning! All local changes will be lost. Proceed? [y/N]: " $(Q)echo && (
$(Q)read ans && ( 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 if [ $$ans == y ]; then
echo "Resetting local repository. Please wait..."; echo "Resetting local repository. Please wait...";
sudo rm -rf fsroot*; sudo rm -rf fsroot*;