mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-09 22:16:58 +02:00
[crosutils] Add confirmation warning to cros_workon_make --scrub
BUG=9717 TEST=run cros_workon_make --scrub and ensure that it only scrubs if the user types y or yes (case insensitive) Change-Id: Ic1f8020fcca8bd57924391fcbf075d3e2adc5e4a Review URL: http://codereview.chromium.org/5265009
This commit is contained in:
parent
6fbd3d123c
commit
330375f692
@ -58,12 +58,18 @@ if ! pkgfile=$("${EQUERYCMD}" which "${workon_name}" 2> /dev/null); then
|
||||
fi
|
||||
|
||||
if [ "${FLAGS_scrub}" = "${FLAGS_TRUE}" ]; then
|
||||
eval $(${EBUILDCMD} $(${EQUERYCMD} which ${workon_name}) info)
|
||||
srcdir=$(readlink -m ${CROS_WORKON_SRCDIR})
|
||||
trunkdir=$(readlink -m ${CHROOT_TRUNK_DIR})
|
||||
project_path=${srcdir#${trunkdir}/}
|
||||
if ! (cd "${GCLIENT_ROOT}/${project_path}" && git clean -xf); then
|
||||
die "Could not scrub source directory"
|
||||
warn "--scrub will destroy ALL FILES unknown to git!"
|
||||
read -p "Are you sure you want to do this? [y|N]" resp
|
||||
if egrep -qi "^y(es)?$" <(echo -n "${resp}"); then
|
||||
eval $(${EBUILDCMD} $(${EQUERYCMD} which ${workon_name}) info)
|
||||
srcdir=$(readlink -m ${CROS_WORKON_SRCDIR})
|
||||
trunkdir=$(readlink -m ${CHROOT_TRUNK_DIR})
|
||||
project_path=${srcdir#${trunkdir}/}
|
||||
if ! (cd "${GCLIENT_ROOT}/${project_path}" && git clean -xf); then
|
||||
die "Could not scrub source directory"
|
||||
fi
|
||||
else
|
||||
info "Not scrubbing; exiting gracefully"
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user