#!/bin/bash . /etc/init.d/pl_functions . /tmp/planet.cnf # Run gpg once to create default options GNUPGHOME=/root export GNUPGHOME /usr/bin/gpg --yes 2>/dev/null /tmp/nonce echo $(date "+%H:%M:%S") " pl_boot: fetching script from boot server $CONNECT_BOOT_SERVER" ((contact_count++)) rm -f $UNVERIFIED_SCRIPT $CURL_CMD curl_err=$? if [ $curl_err -ne 0 ]; then echo $(date "+%H:%M:%S") " pl_boot: curl request failed with error $curl_err:" cat /tmp/curl_errors echo if [ -n "$DISCONNECTED_OPERATION" ]; then mkdir /tmp/boot-media mount -U "$DISCONNECTED_OPERATION" /tmp/boot-media cp /tmp/boot-media/bootscript.gpg $UNVERIFIED_SCRIPT umount /tmp/boot-media rmdir /tmp/boot-media else case $curl_err in 6) echo $(date "+%H:%M:%S") " This error likely indicates a networking configuration error. " echo $(date "+%H:%M:%S") " Please, check whether you can ping this machine. If you can, " echo $(date "+%H:%M:%S") " we recommend checking your DNS settings. If you cannot, then " echo $(date "+%H:%M:%S") " please double check your network settings registered at PLC and " echo $(date "+%H:%M:%S") " stored on this Boot Image." ;; 60) echo $(date "+%H:%M:%S") " This error likely indicates that the hardware clock is likely not set " echo $(date "+%H:%M:%S") " to GMT. The result is that authentication between the local and " echo $(date "+%H:%M:%S") " remote site fails. Please double check this machine's system " echo $(date "+%H:%M:%S") " clock, and set it to GMT in the BIOS. If after rebooting the same " echo $(date "+%H:%M:%S") " error occurs, please report the situation to support@planet-lab.org " echo $(date "+%H:%M:%S") " with as much detail as possible." ;; *) echo $(date "+%H:%M:%S") " The best-practice approach for handling this error is not yet " echo $(date "+%H:%M:%S") " documented. Please report this error to support@planet-lab.org " echo $(date "+%H:%M:%S") " with as much detail as possible." ;; esac # in any case display as much info as we can (see pl_functions) pl_network_sanity_checks # retry continue fi elif [ -n "$DISCONNECTED_OPERATION" ]; then mkdir /tmp/boot-media mount -U "$DISCONNECTED_OPERATION" /tmp/boot-media cp $UNVERIFIED_SCRIPT /tmp/boot-media umount /tmp/boot-media rmdir /tmp/boot-media fi echo $(date "+%H:%M:%S") " pl_boot: verifying downloaded script" rm -f $VERIFIED_SCRIPT $GPG_CMD 2> /tmp/gpg_errors if [ $? -ne 0 ]; then echo $(date "+%H:%M:%S") " pl_boot: failed to verify file:" cat /tmp/gpg_errors echo continue fi echo $(date "+%H:%M:%S") " pl_boot: decrypted and verified script succesfully" echo $(date "+%H:%M:%S") " pl_boot: handing control to download script" rm -f $UNVERIFIED_SCRIPT chmod +x $VERIFIED_SCRIPT $VERIFIED_SCRIPT echo $(date "+%H:%M:%S") " pl_boot: downloaded script has returned" done echo $(date "+%H:%M:%S") " pl_boot: automatic boot process canceled by user"