1
0
mirror of https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud.git synced 2025-12-16 11:52:43 +03:00
tiny-cloud/lib/tiny-cloud/init-common
Natanael Copa 4ba3ce17bc Refactor skip_action
micro optimization. No forks used

readability improved by avoiding regex.
2023-03-09 11:47:34 +01:00

30 lines
707 B
Bash

# Tiny Cloud - Common Initialization
# vim:set ts=4 et ft=sh:
# set defaults
: "${LIBDIR:=$PREFIX/lib}"
. "$LIBDIR"/tiny-cloud/common
: "${SKIP_INIT_ACTIONS:=}"
# is initial bootstrap already done?
is_bootstrapped() { [ -f "$TINY_CLOUD_VAR"/.bootstrap-complete ] ; }
# indicate bootstrap is done
bootstrap_complete() { touch "$TINY_CLOUD_VAR"/.bootstrap-complete ; }
# indicate bootstrap isn't done
bootstrap_incomplete() { rm -f "$TINY_CLOUD_VAR"/.bootstrap-complete ; }
# should we skip this action?
skip_action() {
local action="$1"
for i in $SKIP_INIT_ACTIONS; do
if [ "$i" = "$action" ]; then
printf " SKIPPING"
return 0
fi
done
return 1
}