1
0
mirror of https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud.git synced 2025-12-14 19:02:45 +03:00

update tiny-cloud --help slightly and otherwise mostly tab/space adjustments

This commit is contained in:
Jake Buchholz Göktürk 2023-05-21 14:22:08 -07:00
parent c4195b5e8b
commit 69733fbedd
7 changed files with 30 additions and 29 deletions

View File

@ -20,12 +20,12 @@ test-oksh:
- apk add oksh
- ln -sf /bin/oksh /bin/sh
# disabling for now - yash now hates 'local'
.test-yash:
extends: test-default
before_script:
- apk add yash
- ln -sf /usr/bin/yash /bin/sh
# disabled - yash hates 'local'
#test-yash:
# extends: test-default
# before_script:
# - apk add yash
# - ln -sf /usr/bin/yash /bin/sh
test-zsh:
extends: test-default

View File

@ -101,19 +101,19 @@ imds() {
key="$1"; shift
case $key in
# error handling
-e) err=0; continue ;; # ignore
+e) err=1; continue ;; # return
-e) err=0; continue ;; # ignore
+e) err=1; continue ;; # return
# TODO: retry/deadline
# output control
+n) printf "\n"; continue ;; # insert newline
+s) printf " "; continue ;; # insert space
+t) printf "\t"; continue ;; # insert tab
+n) printf "\n"; continue ;; # insert newline
+s) printf " "; continue ;; # insert space
+t) printf "\t"; continue ;; # insert tab
# key aliasing
@hostname) args="$IMDS_HOSTNAME" ;;
@local-hostname) args="$IMDS_LOCAL_HOSTNAME" ;;
@ssh-keys) cmd=_imds_ssh_keys ;;
@userdata) cmd=_imds_userdata ;;
@nics) args="$IMDS_NICS" ;;
@hostname) args="$IMDS_HOSTNAME" ;;
@local-hostname) args="$IMDS_LOCAL_HOSTNAME" ;;
@ssh-keys) cmd=_imds_ssh_keys ;;
@userdata) cmd=_imds_userdata ;;
@nics) args="$IMDS_NICS" ;;
@nic:*)
cmd=imds
args=$(_imds_nic_args $(echo "${key#@nic:}" | tr , ' '))

View File

@ -2,7 +2,7 @@
# vim:set ft=sh:
# NOTE: The mdev-conf APK handles this now, but only for xvd or sd links (not
# both)
# both)
: "${LIBDIR:=$PREFIX/lib}"
. "$LIBDIR/tiny-cloud/common"

View File

@ -15,7 +15,7 @@ log() {
local tag=$(basename "$0")
while [ "${1#-}" != "$1" ]; do
case "$1" in
-i) init=1 ;; # TODO: value = indent?
-i) init=1 ;;
-f) facility="$2"; shift ;;
-s) stderr=-s ;;
-t) tag="$tag/$2"; shift ;;

View File

@ -72,7 +72,7 @@ init__install_hotplugs() {
for module in $HOTPLUG_MODULES; do
result='unknown'
level='err'
printf " >> " >&2
printf " >> " >&2
log -i -t "$phase/$ACTION" info "$module: installing"
if type "mod__$module" | grep -q -w "function"; then
if "mod__$module"; then
@ -83,7 +83,7 @@ init__install_hotplugs() {
rc=1
fi
fi
printf " >> " >&2
printf " >> " >&2
log -i -t "$phase/$ACTION" info "$module: $result"
done
return $rc

View File

@ -10,7 +10,7 @@ set -e
usage() {
cat <<-EOF
Usage: ${0##*/} [-h | --help] { early | net | main | final | --bootstrap [complete|incomplete|status] | --setup }
Usage: ${0##*/} [-h | --help] { early | net | main | final | --bootstrap {complete|incomplete|status} | --setup }
EOF
}
@ -35,17 +35,17 @@ while true; do
-h|--help) usage; exit 0;;
-b|--bootstrap) shift
case "$1" in
complete) # indicate bootstrap is done
complete) # indicate bootstrap is done
bootstrap_complete
log -i notice 'bootstrap marked complete';;
incomplete) # indicate bootstrap isn't done
incomplete) # indicate bootstrap isn't done
bootstrap_incomplete
log -i warn 'bootstrap marked incomplete';;
status) is_bootstrap_complete && echo 'complete' || echo 'incomplete' ;;
*) usage >&2; exit 1;;
esac
exit 0;;
-s|--setup) # just openrc for now
-s|--setup) # just openrc for now
for phase in -early -net '' -final; do
rc-update -a del "tiny-cloud$phase" || true
done
@ -97,11 +97,11 @@ INIT_ACTIONS_FINAL="${INIT_ACTIONS_FINAL} bootstrap_complete"
### let's do stuff!
case "$phase" in
early) INIT_ACTIONS="$INIT_ACTIONS_EARLY";;
early) INIT_ACTIONS="$INIT_ACTIONS_EARLY";;
net) INIT_ACTIONS="$INIT_ACTIONS_NET";;
main) INIT_ACTIONS="$INIT_ACTIONS_MAIN";;
final) INIT_ACTIONS="$INIT_ACTIONS_FINAL";;
*) usage >&2; exit 1
main) INIT_ACTIONS="$INIT_ACTIONS_MAIN";;
final) INIT_ACTIONS="$INIT_ACTIONS_FINAL";;
*) usage >&2; exit 1;;
esac
printf '\n' >&2

View File

@ -8,7 +8,8 @@ post-up)
/sbin/imds-net-sync
;;
pre-down)
/sbin/imds-net-sync -k
# TODO: someday make imds-net-sync a daemon
# /sbin/imds-net-sync -k
;;
*) ;;
esac