Add tests for C++ compiler
[hvlinux.git] / stage1 / bootscripts / functions
index 3d8ffb5..90d0c03 100644 (file)
@@ -14,12 +14,12 @@ export PATH="/tools/bin:/tools/sbin:/bin:/sbin"
 ## Screen Dimensions
 # Find current screen size
 if [ -z "${COLUMNS}" ]; then
-    COLUMNS=$(stty size)
+    COLUMNS=$(stty size < /dev/console)
     COLUMNS=${COLUMNS##* }
 fi
 
 # When using remote connections, such as a serial port, stty size returns 0
-if [ "${COLUMNS}" = "0" ]; then 
+if [ "${COLUMNS}" = "0" ]; then
     COLUMNS=80
 fi
 
@@ -51,7 +51,7 @@ BRACKET="\\033[1;34m"
 #   LOGLEVEL="1" --> Prevents all messages, expect panic messages, from
 #                    appearing on the console.
 #   LOGLEVEL="8" --> Allow all messages to appear on the console.
-LOGLEVEL="4"
+LOGLEVEL="3"
 
 # Timezone
 export TZ="America/Montreal"
@@ -76,7 +76,7 @@ print_status()
        echo "Usage: print_status {success|warning|failure}"
        return ${EXIT_CODE_FAILURE}
     fi
-    
+
     case "$1" in
        success)
            ${SUCCESS}
@@ -268,7 +268,7 @@ loadproc()
            pid="${pid} ${apid}"
        fi
     done
-    
+
     # If the $pid variable contains anything (from the previous for loop) it
     # means the daemon is already running.
     if [ ! -n "${pid}" ]; then
@@ -301,7 +301,7 @@ killproc()
     fi
 
     killproc_path ${1} /var/run ${2}
-    
+
     return ${?}
 }
 
@@ -316,7 +316,7 @@ killproc_path()
        msg_log "Usage: killproc_path {program} {pid-directory} [signal]"
        return ${EXIT_CODE_FAILURE}
     fi
-    
+
     # Find the basename of the first parameter (the daemon's name without the
     # path).
     base=$(/usr/bin/basename ${1})
@@ -330,7 +330,7 @@ killproc_path()
     else
        nolevel=1
     fi
-    
+
     # The pidlist variable will contains the output of the pidof command. pidof
     # will try to find the PID's that belong to a certain string; $base in this
     # case.
@@ -342,7 +342,7 @@ killproc_path()
          pid="${pid} ${apid}"
       fi
     done
-    
+
     # If $pid contains something from the previous for loop it means one or
     # more PID's were found that belongs to the processes to be killed.
     if [ -n "${pid}" ]; then
@@ -414,7 +414,7 @@ reloadproc()
        msg_log "Usage: reloadproc {program} [signal]"
        return ${EXIT_CODE_FAILURE}
     fi
-    
+
     # Find the basename of the first parameter (the daemon's name without
     # the path that was provided so /usr/sbin/syslogd becomes plain 'syslogd'
     # after basename ran).
@@ -429,7 +429,7 @@ reloadproc()
     else
        killlevel="-SIGHUP"
     fi
-    
+
     # The pidlist variable will contains the output of the pidof command. pidof
     # will try to find the PID's that belong to a certain string; $base in this
     # case.
@@ -441,7 +441,7 @@ reloadproc()
          pid="${pid} ${apid}"
       fi
     done
-    
+
     # If $pid contains something from the previous for loop it means one or
     # more PID's were found that belongs to the processes to be reloaded.
     if [ -n "${pid}" ]; then
@@ -449,7 +449,7 @@ reloadproc()
 
        if [ ${?} -ne 0 ]; then
            sleep 2
-           if statusproc ${base} | grep "not running" 1> /dev/null 2>&1; then
+           if statusproc ${base} | grep -q "stopped"; then
                return ${EXIT_CODE_FAILURE}
            fi
        fi
@@ -458,7 +458,7 @@ reloadproc()
        msg_log "Not running"
         return ${EXIT_CODE_WARNING}
     fi
-    
+
     return ${EXIT_CODE_SUCCESS}
 }
 
@@ -474,7 +474,7 @@ statusproc()
     fi
 
     statusproc_path ${1} /var/run
-    
+
     return ${?}
 }
 
@@ -489,7 +489,7 @@ statusproc_path()
        msg_log "Usage: status {program} {pid-directory}"
        return ${EXIT_CODE_FAILURE}
     fi
-    
+
     # Find the basename of the first parameter (the daemon's name without the
     # path).
     base=$(/usr/bin/basename ${1})
@@ -510,10 +510,11 @@ statusproc_path()
     if [ -f ${piddir}/${base}.pid ]; then
        pid=$(head -1 ${piddir}/${base}.pid)
        if [ -n "${pid}" ]; then
-           echo "${base} not running but ${piddir}/${base}.pid exists"
+           echo "${base} stopped but ${piddir}/${base}.pid exists"
            return ${EXIT_CODE_FAILURE}
        fi
-    else
-       echo "${base} is not running"
     fi
+
+    echo "${base} is stopped"
+    return ${EXIT_CODE_FAILURE}
 }