X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=initscripts%2Fpl_boot;h=eb233aac8849b3a3a3166c8c8cf03405c19b7cbc;hb=ab12c48e13809375bf18cb6c695293f95cb6b9dd;hp=247c8680d1ebba51bc7417ba19cf8ea40bccb342;hpb=b13a53f96597821cefa602ed2cbca5d87385ddc3;p=bootcd.git diff --git a/initscripts/pl_boot b/initscripts/pl_boot old mode 100644 new mode 100755 index 247c868..eb233aa --- a/initscripts/pl_boot +++ b/initscripts/pl_boot @@ -1,4 +1,12 @@ -#!/bin/sh +#!/bin/bash + +### make sure this output shows up in the console + +exec 2>&1 +exec > /dev/console + +### +. /etc/init.d/pl_functions . /tmp/planet.cnf @@ -20,11 +28,11 @@ ATTEMPTS_BEFORE_BACKUP=3 BOOT_DIR=/usr/boot/ # get the server we are going to be contacting -BOOT_SERVER=`cat $BOOT_DIR/boot_server` -BOOT_SERVER_PORT=`cat $BOOT_DIR/boot_server_port` +BOOT_SERVER=$(cat $BOOT_DIR/boot_server) +BOOT_SERVER_PORT=$(cat $BOOT_DIR/boot_server_port) # the file to request from the boot server -BOOT_SERVER_PATH=`cat $BOOT_DIR/boot_server_path` +BOOT_SERVER_PATH=$(cat $BOOT_DIR/boot_server_path) # location of the cacert for this boot server BOOT_SERVER_CACERT=$BOOT_DIR/cacert.pem @@ -33,11 +41,11 @@ BOOT_SERVER_CACERT=$BOOT_DIR/cacert.pem BOOT_SERVER_GPG_KEYRING=$BOOT_DIR/pubring.gpg # get the backup server we are going to be contacting -BACKUP_BOOT_SERVER=`cat $BOOT_DIR/backup/boot_server` -BACKUP_BOOT_SERVER_PORT=`cat $BOOT_DIR/backup/boot_server_port` +BACKUP_BOOT_SERVER=$(cat $BOOT_DIR/backup/boot_server) +BACKUP_BOOT_SERVER_PORT=$(cat $BOOT_DIR/backup/boot_server_port) # the file to request from the backup boot server -BACKUP_BOOT_SERVER_PATH=`cat $BOOT_DIR/backup/boot_server_path` +BACKUP_BOOT_SERVER_PATH=$(cat $BOOT_DIR/backup/boot_server_path) # location of the cacert for the backup boot server BACKUP_BOOT_SERVER_CACERT=$BOOT_DIR/backup/cacert.pem @@ -105,11 +113,7 @@ while : ; do if [[ $contact_count != 0 ]]; then - if [[ $on_backup_server == 1 ]]; then - echo $(date "+%H:%M:%S") " pl_boot: attempting to fetch script from backup server in 30s" - else - echo $(date "+%H:%M:%S") " pl_boot: attempting to fetch script from primary server in 30s" - fi + echo $(date "+%H:%M:%S") " pl_boot: next attempt in 30s, to fetch script from server at $CONNECT_BOOT_SERVER" /bin/sleep 30 fi @@ -161,6 +165,31 @@ while : ; do 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