Files
linuxkit/alpine/packages/gcp/etc/init.d/gcp-startup
David Gageot d36d9b5c1b Ignore non existant startup script (http/404)
Signed-off-by: David Gageot <david@gageot.net>
2017-01-04 17:59:08 +01:00

41 lines
720 B
Plaintext
Executable File

#!/sbin/openrc-run
description="Run startup/shudown scripts on Docker GCP edition"
depend()
{
need net
}
metadata() {
curl -sfH 'Metadata-Flavor: Google' http://metadata.google.internal/computeMetadata/v1/${1}
}
start()
{
[ "$(mobyplatform)" != "gcp" ] && exit 0
ebegin "Run startup script"
temp_file=$(mktemp)
metadata /instance/attributes/startup-script > ${temp_file}
[ -s "${temp_file}" ] && sh "${temp_file}"
rm -f "${temp_file}"
eend 0
}
stop()
{
[ "$(mobyplatform)" != "gcp" ] && exit 0
ebegin "Run shutdown script"
temp_file=$(mktemp)
metadata /instance/attributes/shutdown-script > ${temp_file}
[ -s "${temp_file}" ] && sh "${temp_file}"
rm -f "${temp_file}"
eend 0
}