diff --git a/clean.sh b/clean.sh index dec432b68..93077e79c 100755 --- a/clean.sh +++ b/clean.sh @@ -6,5 +6,5 @@ set -e -u test -f $HOME/.termuxrc && . $HOME/.termuxrc : ${TERMUX_TOPDIR:="$HOME/.termux-build"} -chmod +w -R $TERMUX_TOPDIR +[ -d "$TERMUX_TOPDIR" ] && chmod +w -R $TERMUX_TOPDIR rm -Rf /data/* $TERMUX_TOPDIR diff --git a/scripts/build/termux_step_start_build.sh b/scripts/build/termux_step_start_build.sh index 415249562..698753989 100644 --- a/scripts/build/termux_step_start_build.sh +++ b/scripts/build/termux_step_start_build.sh @@ -94,7 +94,8 @@ termux_step_start_build() { # Following directories may contain objects with RO-only permissions which # makes them undeletable. We need fix that. - chmod +w -R "$TERMUX_PKG_BUILDDIR" "$TERMUX_PKG_SRCDIR" + [ -d "$TERMUX_PKG_BUILDDIR" ] && chmod +w "$TERMUX_PKG_BUILDDIR" + [ -d "$TERMUX_PKG_SRCDIR" ] && chmod +w "$TERMUX_PKG_SRCDIR" # Cleanup old state: rm -Rf "$TERMUX_PKG_BUILDDIR" \