Last active
June 15, 2016 17:45
-
-
Save ggreer/518d8ca82fb41d5ba1063519fe0ca097 to your computer and use it in GitHub Desktop.
/etc/rc.d/digitalocean
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# PROVIDE: digitalocean | |
# REQUIRE: var | |
# BEFORE: netif hostname | |
. /etc/rc.subr | |
name="digitalocean" | |
start_cmd="${name}_start" | |
stop_cmd=":" | |
digitalocean_start() | |
{ | |
check_startmsgs && echo "Generating DigitalOcean configuration." | |
/usr/local/sbin/avahi-autoipd -c vtnet0 | |
if [ $? != 0 ] | |
then | |
/usr/local/sbin/avahi-autoipd --force-bind -w -D vtnet0 | |
DROPLET_ID=$(/usr/local/bin/curl --retry 5 --retry-delay 2 --connect-timeout 2 -s http://169.254.169.254/metadata/v1/id) | |
if [ -e /etc/rc.digitalocean.d/$DROPLET_ID.conf ] | |
then | |
/bin/ln -s -f /etc/rc.digitalocean.d/$DROPLET_ID.conf /etc/rc.digitalocean.d/droplet.conf | |
else | |
/usr/local/bin/python2.7 /usr/local/bsd-cloudinit/run.py --log-file /var/log/bsd-cloudinit.log | |
/bin/ln -s -f /etc/rc.digitalocean.d/$DROPLET_ID.conf /etc/rc.digitalocean.d/droplet.conf | |
fi | |
fi | |
} | |
load_rc_config $name | |
run_rc_command "$1" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment