performs various sanity checks at network init and if curl fails
[bootcd.git] / initscripts / pl_boot
index 16b7fa2..ce685c9 100755 (executable)
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+. /etc/init.d/pl_functions
+
 . /tmp/planet.cnf
 
 # Run gpg once to create default options
@@ -20,11 +22,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 +35,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
@@ -168,11 +170,6 @@ while : ; do
                     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."
-                    for file in $(ls /etc/sysconfig/network-scripts/ifcfg-eth* /etc/resolv.conf) ; do 
-                        echo $(date "+%H:%M:%S") contents of $file :
-                        cat $file
-                        echo $(date "+%H:%M:%S") end of $file :
-                    done
                 ;;
                 60)
                     echo $(date "+%H:%M:%S") " This error likely indicates that the hardware clock is likely not set "
@@ -188,6 +185,9 @@ while : ; do
                     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