1
0
mirror of https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud.git synced 2025-12-15 11:22:43 +03:00

Replace Broken --setup With Working --enable and --disable

This commit is contained in:
Jake Buchholz Göktürk 2023-06-16 10:04:36 -07:00
parent e7ea0e9e1b
commit e628e9817d
4 changed files with 24 additions and 12 deletions

View File

@ -1,5 +1,15 @@
# CHANGELOG
## UNRELEASED - Tiny Cloud v3.0.x
* Replace non-functioning `tiny-cloud --setup` with working `--enable` and
`--disable` to enable/disable the set of Tiny Cloud init scripts.
## 2023-06-12 - Tiny Cloud v3.0.1
* Adds support for additional `ssh-authorized-keys` via userdata for
experimental Alpine auto installer.
## 2023-05-31 - Tiny Cloud v3.0.0
### INIT SCRIPTS / PHASES

View File

@ -80,9 +80,9 @@ dependencies for Tiny Cloud to support _`<cloud>`_.
Alternately, you can download a release tarball, and use `make` to install it.
Next, set up the RC scripts...
Next, enable the RC scripts...
```
tiny-cloud --setup
tiny-cloud --enable
```
That's it! On the next boot, Tiny Cloud will bootstrap the instance.

View File

@ -27,7 +27,7 @@ log() {
shift
[ -n "$init" ] && echo "$@" >&2
logger $stderr -p "$facility.$level" -t "${tag}[$$]" "$@"
logger $stderr -p "$facility.$level" -t "${tag}[$$]" -- "$@"
case "$level" in
crit|alert|emerg) exit 1 ;;
esac

View File

@ -10,7 +10,7 @@ set -e
usage() {
cat <<-EOF
Usage: ${0##*/} [-h | --help] { boot | early | main | final | --bootstrap {complete|incomplete|status} | --setup }
Usage: ${0##*/} [-h | --help] { boot | early | main | final | --bootstrap {complete|incomplete|status} | --enable | --disable }
EOF
}
@ -24,7 +24,7 @@ is_bootstrap_complete() {
[ -f "$TINY_CLOUD_VAR/.bootstrap-complete" ]
}
args=$(getopt -o hsb: --long help,setup,bootstrap: -n ${0##*/} -- "$@") || { usage >&2; exit 1; }
args=$(getopt -o hEDb: --long help,enable,disable,bootstrap: -n ${0##*/} -- "$@") || { usage >&2; exit 1; }
if [ $# -eq 0 ]; then
usage >&2
exit 1
@ -45,17 +45,19 @@ while true; do
*) usage >&2; exit 1;;
esac
exit 0;;
-s|--setup) # just openrc for now
# for installing in mounted volumes
: "${ROOT:=}"
# start with a clean slate
log -i info "- tiny-cloud* services removed from all runlevels"
-[ED]|--enable|disable) # just openrc for now
: "${ROOT:=}" # for mounted volumes
# always start with a clean slate
rm -f "$ROOT"/etc/runlevels/*/tiny-cloud*
log -i info "+ tiny-cloud-boot service added to boot runlevel"
log -i info "- tiny-cloud* services removed from all runlevels"
if [ "$1" = '-D' ] || [ "$1" = '--disable' ]; then
exit 0
fi
ln -s /etc/init.d/tiny-cloud-boot "$ROOT"/etc/runlevels/boot
log -i info "+ tiny-cloud-boot service added to boot runlevel"
for p in early main final; do
log -i info "+ tiny-cloud-$p service added to default runlevel"
ln -s "/etc/init.d/tiny-cloud-$p" "$ROOT"/etc/runlevels/default
log -i info "+ tiny-cloud-$p service added to default runlevel"
done
exit 0;;
--) shift; break;;