Add -f/--force rebuild when no updates are available

This commit is contained in:
southerntofu 2020-04-19 08:42:48 -04:00
parent 23ef11c2a3
commit 6131357494
1 changed files with 10 additions and 2 deletions

View File

@ -18,11 +18,16 @@ run() {
# So scripts can know we're still running (for autoupdater)
touch $BASEDIR/.LOCK
FORCE=0
# Find targeted projects from args
PROJECTS=()
for arg in "$@"; do
[ -f $BASEDIR/$arg.source ] && PROJECTS+=("$arg")
# use elseif to match other arguments, so we can do else print arg not found
if [[ "$arg" = "-f" ]] || [[ "$arg" = "--force" ]]; then
FORCE=1
elif [ -f $BASEDIR/$arg.source ]; then
PROJECTS+=("$arg")
fi
done
# If no project argument passed, default to all projects
@ -61,6 +66,9 @@ for p_name in ${PROJECTS[*]}; do
git pull --quiet --recurse-submodules
[[ $? != 0 ]] && echo "[$p_name] PULL FAILED" && exit 1
run $p_name
# If no update was found, we can still force rebuild with -f/--force
elif [[ $FORCE = 1 ]]; then
run $p_name
fi
done