Ver código fonte

Standardized urinary comparisons^Cn tests

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@9324 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
DJ Lucas 15 anos atrás
pai
commit
559731897e

+ 1 - 0
bootscripts/contrib/lsb-v3/ChangeLog

@@ -1,6 +1,7 @@
 ChangeLog
 
 20100627 - [dj] * Sync to LFS-Bootscripts-20100627 (killall in new sysvinit).
+                * Standardized syntax for urinary comparisons in tests.
 
 20100529 - [matthew]
                 * Only copy /lib/udev/devices/null, as Udev >= 155 copies

+ 4 - 4
bootscripts/contrib/lsb-v3/init.d/checkfs

@@ -25,7 +25,7 @@ case "${1}" in
         fi
 
         mount -n -o remount,ro / >/dev/null
-        if [ ${?} != 0 ]
+        if [ ${?} -ne 0 ]
         then
             log_failure_msg "Mounting root file system in read-only mode"
             echo -e "${FAILURE}FAILURE:\n"
@@ -53,17 +53,17 @@ case "${1}" in
         fsck ${options} -a -A -C -T
         error_value=${?}
 
-        if [ "${error_value}" = 0 ]
+        if [ "${error_value}" -eq 0 ]
         then
             log_success_msg "Checking file systems..."
-        elif [ "${error_value}" = 1 ]
+        elif [ "${error_value}" -eq 1 ]
         then
             log_warning_msg "Checking file systems..."
             echo -e "${WARNING}WARNING:\n"
             echo -e "${WARNING}File system errors were found and have been"
             echo -e "${WARNING}corrected.  You may want to double-check that"
             echo -e "${WARNING}everything was fixed properly.${NORMAL}"
-        elif [ "${error_value}" = 2 -o "${error_value}" = 3 ]; then
+        elif [ "${error_value}" -eq 2 -o "${error_value}" -eq 3 ]; then
             log_warning_msg "Checking file systems..."
             echo -e "${WARNING}WARNING:\n"
             echo -e "${WARNING}File system errors were found and have been been"

+ 2 - 2
bootscripts/contrib/lsb-v3/init.d/lfs-functions

@@ -77,7 +77,7 @@ statusproc()
     pidlist=`pidofproc "${BIN_FILE}"`
     STATUS=$?
     echo "Checking ${MESSAGE} status:"
-    if [ "${STATUS}" = "0" ]; then
+    if [ "${STATUS}" -eq "0" ]; then
         log_success_msg "Running with PID(s) ${pidlist}"
     else
         log_warning_msg "Not running!"
@@ -202,7 +202,7 @@ evaluate_retval()
 
     # Print messages for the generic force-reload, reload, restart, 
     # and try-restart targets
-    if [ "${error_value}" = "0" ]
+    if [ "${error_value}" -eq "0" ]
     then
         log_success_msg "${message}${MESSAGE} "
         return "${error_value}"

+ 4 - 4
bootscripts/contrib/lsb-v3/init.d/localnet

@@ -22,7 +22,7 @@ case "${1}" in
     start)
         ip addr add 127.0.0.1/8 label lo dev lo
         ip link set lo up
-        if [ "${?}" = "0" ]
+        if [ "${?}" -eq "0" ]
                 then
                      log_success_msg "Bringing up the loopback interface..."
                 else
@@ -30,7 +30,7 @@ case "${1}" in
                 fi
 
         hostname "${HOSTNAME}"
-        if [ "${?}" = "0" ]
+        if [ "${?}" -eq "0" ]
                 then
                      log_success_msg "Setting hostname to ${HOSTNAME}..."
                 else
@@ -41,7 +41,7 @@ case "${1}" in
 
     stop)
         ip link set lo down
-        if [ "${?}" = "0" ]
+        if [ "${?}" -eq "0" ]
                 then
                      log_success_msg "Bringing down the loopback interface..."
                 else
@@ -60,7 +60,7 @@ case "${1}" in
                 retval=$(( "${retval}" + "${?}" ))
                 hostname "${HOSTNAME}"
                 retval=$(( "${retval}" + "${?}" ))
-                if [ "${retval}" = "0" ]
+                if [ "${retval}" -eq "0" ]
                 then
                     log_success_msg "Restarting local network..."
                 else

+ 1 - 1
bootscripts/contrib/lsb-v3/init.d/rc

@@ -119,7 +119,7 @@ if [ "${prevlevel}" != "N" ]; then
         ${link} stop
         error_value=${?}
 
-        if [ "${error_value}" != "0" ]; then
+        if [ "${error_value}" -ne "0" ]; then
             print_error_msg
         fi
     done

+ 4 - 4
bootscripts/contrib/lsb-v3/init.d/sendsignals

@@ -22,8 +22,8 @@ case "${1}" in
         killall5 -15
         error_value=${?}
         # Account for successful return value of 2
-        if [ ${error_value} = 2 ]
-            error_value="0"
+        if [ ${error_value} -eq 2 ]
+            error_value=0
         fi
         sleep 3
 
@@ -34,8 +34,8 @@ case "${1}" in
         killall5 -9
         error_value=${?}
         # Account for successful return value of 2
-        if [ ${error_value} = 2 ]
-            error_value="0"
+        if [ ${error_value} -eq 2 ]
+            error_value=0
         fi
 
         sleep 3

+ 1 - 1
bootscripts/contrib/lsb-v3/init.d/udev

@@ -40,7 +40,7 @@ case "${1}" in
 		if ! mountpoint /dev > /dev/null; then
 			mount -n -t tmpfs tmpfs /dev -o mode=755
 		fi
-		if [ ${?} != 0 ]; then
+		if [ ${?} -ne 0 ]; then
 			echo_failure
 			boot_mesg -n "FAILURE:\n\nCannot mount a tmpfs" ${FAILURE}
 			boot_mesg -n " onto /dev, this system will be halted."

+ 5 - 5
bootscripts/contrib/lsb-v3/lsb/init-functions

@@ -201,7 +201,7 @@ killproc()
 
     # Check for a valid signal
     check_signal "${signal}"
-    if [ "${?}" != "0" ]
+    if [ "${?}" -ne "0" ]
     then
         return 2
     fi
@@ -278,7 +278,7 @@ killproc()
                     kill "${signal}" "${pid}" 2> /dev/null
                     # Wait up to ${delay}/10 seconds to for "${pid}" to 
                     # terminate in 10ths of a second
-                    while [ "${delay}" != "0" ]
+                    while [ "${delay}" -ne "0" ]
                     do
                         kill -0 "${pid}" 2> /dev/null || piddead="1"
                         if [ "${piddead}" = "1" ]
@@ -413,7 +413,7 @@ local exitstatus="0"
     for pid in ${pidlist}
     do
         kill -0 ${pid} 2> /dev/null
-        if [ "${?}" = "0" ]; then
+        if [ "${?}" -eq "0" ]; then
             lpids="${pids}${pid} "
         else
             exitstatus="1"
@@ -534,7 +534,7 @@ check_signal()
     valsig="${valsig} -11 -13 -14 -15"
 
     echo "${valsig}" | grep -- " ${1} " > /dev/null
-    if [ "${?}" = "0" ]
+    if [ "${?}" -eq "0" ]
     then
         return 0
     else
@@ -566,7 +566,7 @@ check_sig_type()
     valsig="-ALRM -INT -KILL -TERM -PWR -STOP -ABRT -QUIT -2 -3 -6 -9 -14 -15"
 
     echo "${valsig}" | grep -- " ${1} " > /dev/null
-    if [ "${?}" = "0" ]
+    if [ "${?}" -eq "0" ]
     then
         return 0
     else