mirror of
https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud.git
synced 2025-12-15 11:22:43 +03:00
* numerous imds script enhancements, including -h/--help * check imds for secondary ipv4 & ipvs via ifupdown-ng executor * simplify shell source to things /etc/conf.d/ and /lib/tiny-cloud/ * move log function to /lib/tiny-cloud/common
44 lines
1.2 KiB
Bash
44 lines
1.2 KiB
Bash
# Tiny Cloud - Early Phase Functions
|
|
# vim:set ts=4 et ft=sh:
|
|
|
|
source /etc/conf.d/tiny-cloud
|
|
source /lib/tiny-cloud/init-common
|
|
|
|
expand_root() {
|
|
# explicitly use busybox, in case util-linux is also installed
|
|
local mountpoint=$(busybox mountpoint -n / | cut -d' ' -f1)
|
|
local volume=$(echo "$mountpoint" |
|
|
sed -Ee "s/(nvme\d+n\d|(xv|s)d[a-z])p?\d?$/\1/"
|
|
)
|
|
local partition
|
|
|
|
if [ "$mountpoint" != "$volume" ]; then
|
|
# it's a partition, resize it
|
|
partition=$(echo "$mountpoint" | sed -Ee "s/.*(\d+)$/\1/")
|
|
echo ", +" | sfdisk -q --no-reread -N "$partition" "$volume"
|
|
partx -u "$volume"
|
|
fi
|
|
# resize filesystem
|
|
mount -orw,remount /
|
|
resize2fs "$mountpoint"
|
|
}
|
|
|
|
assemble_interfaces() { /lib/tiny-cloud/network-interfaces; }
|
|
|
|
has_cloud_hotplugs() { [ -n "$HOTPLUG_MODULES" ]; }
|
|
|
|
install_hotplugs() {
|
|
local result
|
|
|
|
for module in $HOTPLUG_MODULES; do
|
|
result='-'
|
|
echo -n " $module"
|
|
if type "mod__$module" | grep -q "is a function"; then
|
|
"mod__$module" && result='+' || result='!'
|
|
fi
|
|
echo -n "($result)"
|
|
done
|
|
}
|
|
|
|
HOTPLUG_TYPE=${HOTPLUG_TYPE:-mdev}
|
|
source /lib/tiny-cloud/"$HOTPLUG_TYPE" |