mirror of
https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud.git
synced 2025-12-15 19:32:44 +03:00
update tiny-cloud --help slightly and otherwise mostly tab/space adjustments
This commit is contained in:
parent
c4195b5e8b
commit
69733fbedd
@ -20,12 +20,12 @@ test-oksh:
|
|||||||
- apk add oksh
|
- apk add oksh
|
||||||
- ln -sf /bin/oksh /bin/sh
|
- ln -sf /bin/oksh /bin/sh
|
||||||
|
|
||||||
# disabling for now - yash now hates 'local'
|
# disabled - yash hates 'local'
|
||||||
.test-yash:
|
#test-yash:
|
||||||
extends: test-default
|
# extends: test-default
|
||||||
before_script:
|
# before_script:
|
||||||
- apk add yash
|
# - apk add yash
|
||||||
- ln -sf /usr/bin/yash /bin/sh
|
# - ln -sf /usr/bin/yash /bin/sh
|
||||||
|
|
||||||
test-zsh:
|
test-zsh:
|
||||||
extends: test-default
|
extends: test-default
|
||||||
|
|||||||
20
bin/imds
20
bin/imds
@ -101,19 +101,19 @@ imds() {
|
|||||||
key="$1"; shift
|
key="$1"; shift
|
||||||
case $key in
|
case $key in
|
||||||
# error handling
|
# error handling
|
||||||
-e) err=0; continue ;; # ignore
|
-e) err=0; continue ;; # ignore
|
||||||
+e) err=1; continue ;; # return
|
+e) err=1; continue ;; # return
|
||||||
# TODO: retry/deadline
|
# TODO: retry/deadline
|
||||||
# output control
|
# output control
|
||||||
+n) printf "\n"; continue ;; # insert newline
|
+n) printf "\n"; continue ;; # insert newline
|
||||||
+s) printf " "; continue ;; # insert space
|
+s) printf " "; continue ;; # insert space
|
||||||
+t) printf "\t"; continue ;; # insert tab
|
+t) printf "\t"; continue ;; # insert tab
|
||||||
# key aliasing
|
# key aliasing
|
||||||
@hostname) args="$IMDS_HOSTNAME" ;;
|
@hostname) args="$IMDS_HOSTNAME" ;;
|
||||||
@local-hostname) args="$IMDS_LOCAL_HOSTNAME" ;;
|
@local-hostname) args="$IMDS_LOCAL_HOSTNAME" ;;
|
||||||
@ssh-keys) cmd=_imds_ssh_keys ;;
|
@ssh-keys) cmd=_imds_ssh_keys ;;
|
||||||
@userdata) cmd=_imds_userdata ;;
|
@userdata) cmd=_imds_userdata ;;
|
||||||
@nics) args="$IMDS_NICS" ;;
|
@nics) args="$IMDS_NICS" ;;
|
||||||
@nic:*)
|
@nic:*)
|
||||||
cmd=imds
|
cmd=imds
|
||||||
args=$(_imds_nic_args $(echo "${key#@nic:}" | tr , ' '))
|
args=$(_imds_nic_args $(echo "${key#@nic:}" | tr , ' '))
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
# vim:set ft=sh:
|
# vim:set ft=sh:
|
||||||
|
|
||||||
# NOTE: The mdev-conf APK handles this now, but only for xvd or sd links (not
|
# NOTE: The mdev-conf APK handles this now, but only for xvd or sd links (not
|
||||||
# both)
|
# both)
|
||||||
|
|
||||||
: "${LIBDIR:=$PREFIX/lib}"
|
: "${LIBDIR:=$PREFIX/lib}"
|
||||||
. "$LIBDIR/tiny-cloud/common"
|
. "$LIBDIR/tiny-cloud/common"
|
||||||
|
|||||||
@ -15,7 +15,7 @@ log() {
|
|||||||
local tag=$(basename "$0")
|
local tag=$(basename "$0")
|
||||||
while [ "${1#-}" != "$1" ]; do
|
while [ "${1#-}" != "$1" ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-i) init=1 ;; # TODO: value = indent?
|
-i) init=1 ;;
|
||||||
-f) facility="$2"; shift ;;
|
-f) facility="$2"; shift ;;
|
||||||
-s) stderr=-s ;;
|
-s) stderr=-s ;;
|
||||||
-t) tag="$tag/$2"; shift ;;
|
-t) tag="$tag/$2"; shift ;;
|
||||||
|
|||||||
@ -72,7 +72,7 @@ init__install_hotplugs() {
|
|||||||
for module in $HOTPLUG_MODULES; do
|
for module in $HOTPLUG_MODULES; do
|
||||||
result='unknown'
|
result='unknown'
|
||||||
level='err'
|
level='err'
|
||||||
printf " >> " >&2
|
printf " >> " >&2
|
||||||
log -i -t "$phase/$ACTION" info "$module: installing"
|
log -i -t "$phase/$ACTION" info "$module: installing"
|
||||||
if type "mod__$module" | grep -q -w "function"; then
|
if type "mod__$module" | grep -q -w "function"; then
|
||||||
if "mod__$module"; then
|
if "mod__$module"; then
|
||||||
@ -83,7 +83,7 @@ init__install_hotplugs() {
|
|||||||
rc=1
|
rc=1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
printf " >> " >&2
|
printf " >> " >&2
|
||||||
log -i -t "$phase/$ACTION" info "$module: $result"
|
log -i -t "$phase/$ACTION" info "$module: $result"
|
||||||
done
|
done
|
||||||
return $rc
|
return $rc
|
||||||
|
|||||||
@ -10,7 +10,7 @@ set -e
|
|||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
cat <<-EOF
|
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
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,17 +35,17 @@ while true; do
|
|||||||
-h|--help) usage; exit 0;;
|
-h|--help) usage; exit 0;;
|
||||||
-b|--bootstrap) shift
|
-b|--bootstrap) shift
|
||||||
case "$1" in
|
case "$1" in
|
||||||
complete) # indicate bootstrap is done
|
complete) # indicate bootstrap is done
|
||||||
bootstrap_complete
|
bootstrap_complete
|
||||||
log -i notice 'bootstrap marked complete';;
|
log -i notice 'bootstrap marked complete';;
|
||||||
incomplete) # indicate bootstrap isn't done
|
incomplete) # indicate bootstrap isn't done
|
||||||
bootstrap_incomplete
|
bootstrap_incomplete
|
||||||
log -i warn 'bootstrap marked incomplete';;
|
log -i warn 'bootstrap marked incomplete';;
|
||||||
status) is_bootstrap_complete && echo 'complete' || echo 'incomplete' ;;
|
status) is_bootstrap_complete && echo 'complete' || echo 'incomplete' ;;
|
||||||
*) usage >&2; exit 1;;
|
*) usage >&2; exit 1;;
|
||||||
esac
|
esac
|
||||||
exit 0;;
|
exit 0;;
|
||||||
-s|--setup) # just openrc for now
|
-s|--setup) # just openrc for now
|
||||||
for phase in -early -net '' -final; do
|
for phase in -early -net '' -final; do
|
||||||
rc-update -a del "tiny-cloud$phase" || true
|
rc-update -a del "tiny-cloud$phase" || true
|
||||||
done
|
done
|
||||||
@ -97,11 +97,11 @@ INIT_ACTIONS_FINAL="${INIT_ACTIONS_FINAL} bootstrap_complete"
|
|||||||
### let's do stuff!
|
### let's do stuff!
|
||||||
|
|
||||||
case "$phase" in
|
case "$phase" in
|
||||||
early) INIT_ACTIONS="$INIT_ACTIONS_EARLY";;
|
early) INIT_ACTIONS="$INIT_ACTIONS_EARLY";;
|
||||||
net) INIT_ACTIONS="$INIT_ACTIONS_NET";;
|
net) INIT_ACTIONS="$INIT_ACTIONS_NET";;
|
||||||
main) INIT_ACTIONS="$INIT_ACTIONS_MAIN";;
|
main) INIT_ACTIONS="$INIT_ACTIONS_MAIN";;
|
||||||
final) INIT_ACTIONS="$INIT_ACTIONS_FINAL";;
|
final) INIT_ACTIONS="$INIT_ACTIONS_FINAL";;
|
||||||
*) usage >&2; exit 1
|
*) usage >&2; exit 1;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
printf '\n' >&2
|
printf '\n' >&2
|
||||||
|
|||||||
@ -8,7 +8,8 @@ post-up)
|
|||||||
/sbin/imds-net-sync
|
/sbin/imds-net-sync
|
||||||
;;
|
;;
|
||||||
pre-down)
|
pre-down)
|
||||||
/sbin/imds-net-sync -k
|
# TODO: someday make imds-net-sync a daemon
|
||||||
|
# /sbin/imds-net-sync -k
|
||||||
;;
|
;;
|
||||||
*) ;;
|
*) ;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user