mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-12-10 17:37:15 +00:00
41 lines
720 B
Plaintext
Executable File
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
|
|
}
|