More reset fixes

This commit is contained in:
2023-02-16 13:30:40 -05:00
parent 42cbbd43c3
commit 25c317c4d0

View File

@@ -368,7 +368,7 @@ getImageBuilder() {
echo "Downloading Image Builder archive using $DL_TOOL" echo "Downloading Image Builder archive using $DL_TOOL"
debug "$DL_TOOL -o $IB_ARCHIVE $url" debug "$DL_TOOL -o $IB_ARCHIVE $url"
"$DL_TOOL" -o "$IB_ARCHIVE" "$url" execute "$DL_TOOL" "-o" "$IB_ARCHIVE" "$url"
} }
@@ -438,7 +438,7 @@ makeImages() {
# Reuse the existing output # Reuse the existing output
if [[ -d "$BINDIR" ]]; then if [[ -d "$BINDIR" ]]; then
if askOk "$BINDIR exists. Rebuild?"; then if askOk "$BINDIR exists. Rebuild?"; then
rm -rf "$BINDIR" execute rm -rf "$BINDIR"
else else
return 0 return 0
fi fi
@@ -758,12 +758,14 @@ main() {
declare -g GITDIR="$BUILDROOT/src/openwrt" declare -g GITDIR="$BUILDROOT/src/openwrt"
if (( RESET )); then if (( RESET )); then
for d in "$BUILDDIR" "$SOURCEDIR" "$BINDIR"; do if [[ -d $SOURCEDIR ]] && askOk "Remove $SOURCEDIR?"; then
askOk "Remove $d?" && execute rm -rf "$d" execute git worktree remove --force "$SOURCEDIR"
done execute rm -rf "$SOURCEDIR"
fi
if [[ -d $BUILDDIR ]] && askOk "Remove $BUILDDIR?"; then
execute rm -rf "$BUILDDIR"
fi
fi fi
[[ -d $BUILDDIR ]] || mkdir -p "$BUILDDIR"
if [[ "$RELEASE" == "snapshot" ]]; then if [[ "$RELEASE" == "snapshot" ]]; then
declare url_prefix="https://downloads.openwrt.org/snapshots/targets/$TARGET" declare url_prefix="https://downloads.openwrt.org/snapshots/targets/$TARGET"
@@ -811,6 +813,7 @@ main() {
if (( FROM_SOURCE )); then if (( FROM_SOURCE )); then
fromSource || return $? fromSource || return $?
else else
[[ -d $BUILDDIR ]] || mkdir -p "$BUILDDIR"
getImageBuilder "$ib_url" && getImageBuilder "$ib_url" &&
getImageBuilderChecksum && getImageBuilderChecksum &&
verify "$IB_ARCHIVE" "$IB_SHA256_FILE" && verify "$IB_ARCHIVE" "$IB_SHA256_FILE" &&