|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
#!/bin/sh
|
|
|
|
|
#
|
|
|
|
|
# Initialize an uncloud VM. This script depends on:
|
|
|
|
|
# curl grep getent (i.e. glibc) curl,dirname (i.e. coreutils)
|
|
|
|
|
# curl grep getent (i.e. glibc) curl,dirname (i.e. coreutils) mktemp
|
|
|
|
|
|
|
|
|
|
# TODO: complete other tasks even if one fail.
|
|
|
|
|
# TODO: do not up ALL network interfaces.
|
|
|
|
@ -65,7 +65,28 @@ deploy_ssh_authorized_keys () {
|
|
|
|
|
return
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
curl "$UNCLOUD_METADATA_SERVER/fnux" --output "$authorized_keys_file"
|
|
|
|
|
if [ ! -x "$(command -v curl)" ]; then
|
|
|
|
|
echo "Could not find or execute curl. Exiting." >&2
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ ! -x "$(command -v mktemp)" ]; then
|
|
|
|
|
echo "Could not find or execute mktemp. Exiting." >&2
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
curl_output=$(mktemp)
|
|
|
|
|
if curl "$UNCLOUD_METADATA_SERVER/fnux" --output "$curl_output"; then
|
|
|
|
|
echo "Something went wrong fetching the authorized_keys file from the \
|
|
|
|
|
metedata server." >&2
|
|
|
|
|
echo "CURL Output: $(cat "$curl_output")"
|
|
|
|
|
rm "$curl_output"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
mv "$curl_output" "$authorized_keys_file"
|
|
|
|
|
echo "Deployed $(wc -l < "$authorized_keys_file") entries in \
|
|
|
|
|
$authorized_keys_file."
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
grow_root_partition () {
|
|
|
|
|