From 128c141843491b54a65c32f9bbae776d87a175bf Mon Sep 17 00:00:00 2001 From: bryan Date: Thu, 16 Feb 2023 14:59:44 -0500 Subject: [PATCH] Make reset more specific --- openwrtbuilder | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/openwrtbuilder b/openwrtbuilder index 71e1453..ad7cb35 100755 --- a/openwrtbuilder +++ b/openwrtbuilder @@ -572,7 +572,7 @@ fromSource() { seed_file="$SOURCEDIR/.config" debug "seed_file: $seed_file" - execute pushd "$SOURCEDIR" || return 1 + pushd "$SOURCEDIR" || return 1 # Update package feed ./scripts/feeds update -a && @@ -648,7 +648,7 @@ fromSource() { debug "make ${make_opts[*]} -j$(nproc) world" make "${make_opts[@]}" -j"$(nproc)" world - execute popd || return 1 + popd || return 1 # Provide symlinks to images in root of BINDIR (to match Image Builder) shopt -s nullglob @@ -758,11 +758,11 @@ main() { declare -g GITDIR="$BUILDROOT/src/openwrt" if (( RESET )); then - if [[ -d $SOURCEDIR ]] && askOk "Remove $SOURCEDIR?"; then - execute git worktree remove --force "$SOURCEDIR" - execute rm -rf "$SOURCEDIR" - fi - if [[ -d $BUILDDIR ]] && askOk "Remove $BUILDDIR?"; then + if (( FROM_SOURCE )); then + [[ -d $SOURCEDIR ]] && askOk "Remove $SOURCEDIR?" + execute git worktree remove --force "$SOURCEDIR" + execute rm -rf "$SOURCEDIR" + elif [[ -d $BUILDDIR ]] && askOk "Remove $BUILDDIR?"; then execute rm -rf "$BUILDDIR" fi fi