1
0
mirror of https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud.git synced 2026-06-21 00:07:16 +03:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Justin
4862f1de82 Merge branch 'systemd' into 'main'
Add Systemd init system support

Closes #77

See merge request alpine/cloud/tiny-cloud!148
2026-06-15 23:55:14 +00:00
Jake Buchholz Göktürk
fbb910acc1 fix error when non-root user tries to cache latest endpoint, also don't need to re-cache same endpoint 2026-06-15 16:26:44 -07:00
Justin Zobel
9e2e6d63af Add Systemd init system support
Fixes #77
2026-04-16 15:58:57 +09:30
7 changed files with 60 additions and 7 deletions

View File

@ -1,6 +1,6 @@
# CHANGELOG
## 2026-06-XX - Tiny Cloud v3.3.3
## 2026-06-15 - Tiny Cloud v3.3.3
* Support IPv6 and multiple endpoints
[#68](https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud/-/work_items/68)
@ -9,6 +9,10 @@
routable. Fixes race condition between `dhcpcd` starting and attempting to
reach IMDS before routes are resolved.
* Currently the most recent IMDS endpoint that worked is cached, but only if
**root** is running `imds`. We may consider keeping track of this per user
in the future
## 2026-06-08 - Tiny Cloud v3.3.2
* Fixes an autodetect regression introduced in v3.3.1

View File

@ -5,7 +5,7 @@ MAN1PAGES = docs/imds.1
MAN5PAGES = docs/tiny-cloud.conf.5 docs/cloud-config.5 docs/alpine-config.5
MAN8PAGES = docs/tiny-cloud.8
SUBPACKAGES = core openrc $(CLOUDS)
SUBPACKAGES = core init $(CLOUDS)
.PHONY: check install $(SUBPACKAGES)
@ -31,9 +31,13 @@ core: $(MAN1PAGES) $(MAN5PAGES) $(MAN8PAGES)
install -Dm755 -t "$(PREFIX)"/usr/sbin \
sbin/tiny-cloud
openrc:
install -Dm755 -t "$(PREFIX)"/etc/init.d \
dist/openrc/*
init:
[ $(command -v rc-status) ] && \
install -Dm755 -t "$(PREFIX)"/etc/init.d \
dist/openrc/*
[ $(command -v systemctl) ] && \
install -Dm755 -t "$(PREFIX)"/etc/systemd/system \
dist/systemd/*
$(CLOUDS):
install -Dm644 -t "$(PREFIX)"/usr/lib/tiny-cloud/cloud/$@ \

View File

@ -120,7 +120,7 @@ _imds_has_route() {
}
_imds() {
local endpoint endpoints routed attempts=1
local endpoint endpoints routed attempts=1 cached
if [ "$IMDS_ENDPOINT_WAIT_ATTEMPTS" -le 0 ]; then
endpoints="$(_imds_endpoints)"
fi
@ -148,7 +148,8 @@ _imds() {
wget --quiet --timeout 1 --output-document - \
--header "$(_imds_header)" \
"http://$endpoint/$IMDS_URI/$1$IMDS_QUERY" && {
echo "$endpoint" > "$IMDS_ENDPOINT_CACHE"
cached="$(cat "$IMDS_ENDPOINT_CACHE" 2>/dev/null)" || :
[ "$endpoint" = "$cached" ] || echo "$endpoint" 2>/dev/null > "$IMDS_ENDPOINT_CACHE" || :
return 0
}
done

10
dist/systemd/tiny-cloud-boot.service vendored Normal file
View File

@ -0,0 +1,10 @@
[Unit]
Description=Tiny Cloud Bootstrap - boot phase
[Service]
Type=oneshot
ExecStart=tiny-cloud boot
Restart=no
[Install]
WantedBy=multi-user.target

11
dist/systemd/tiny-cloud-early.service vendored Normal file
View File

@ -0,0 +1,11 @@
[Unit]
Description=Tiny Cloud Bootstrap - early phase
After=network.target
[Service]
Type=oneshot
ExecStart=tiny-cloud early
Restart=no
[Install]
WantedBy=multi-user.target

11
dist/systemd/tiny-cloud-final.service vendored Normal file
View File

@ -0,0 +1,11 @@
[Unit]
Description=Tiny Cloud Bootstrap - final phase
After=tiny-cloud-boot.service tiny-cloud-main.service tiny-cloud-early.service
[Service]
Type=oneshot
ExecStart=tiny-cloud final
Restart=no
[Install]
WantedBy=multi-user.target

12
dist/systemd/tiny-cloud-main.service vendored Normal file
View File

@ -0,0 +1,12 @@
[Unit]
Description=Tiny Cloud Bootstrap - main phase
After=network.target sshd.service
[Service]
Type=oneshot
ExecStart=tiny-cloud main
Restart=no
[Install]
WantedBy=multi-user.target