[Lunar-commits] <lunar-tools> Properly quote the variables or the check will be a false positive

Stefan Wold ratler at lunar-linux.org
Mon Aug 6 10:15:49 CEST 2012


commit 562fc0ef834df16e87a04c0e3d3133ad067ae8de
Author: Stefan Wold <ratler at lunar-linux.org>
Date: Mon, 06 Aug 2012 01:15:49 -0700
URL: https://github.com/lunar-linux/lunar-tools/commit/562fc0ef834df16e87a04c0e3d3133ad067ae8de

Properly quote the variables or the check will be a false positive
---
  lnet/lnet                                                    +7/-7     
  lservices/lservices                                          +2/-2     
  ltime/ltime                                                  +1/-1     
  3 files changed, 10 insertions (+), 10 deletions (-)

--- a/lnet/lnet
+++ b/lnet/lnet
@@ -239,7 +239,7 @@ function gateway_config() {
    GATEWAY=$(cat /etc/config.d/gateway)
    GATEWAY=`inputbox "$GATEWAY_PROMPT" "$GATEWAY"`
    echo "$GATEWAY" > /etc/config.d/gateway
-   if [ -n $SYSTEMDUNITDIR ]; then
+   if [ -n "$SYSTEMDUNITDIR" ]; then
      if [ -n "$GATEWAY" ]; then
        systemd_gw_template
        systemctl daemon-reload &> /dev/null
@@ -352,7 +352,7 @@ function ethernet_manage_device() {
     case  $COMMAND  in
       S)
         # Assume systemd is running
-        if [ -n $SYSTEMDUNITDIR ]; then
+        if [ -n "$SYSTEMDUNITDIR" ]; then
           SERVICETYPE=$(get_systemd_servicetype)
           systemctl ${TOGGLE/S/s} ${SERVICETYPE}@${1}.service
         else
@@ -361,7 +361,7 @@ function ethernet_manage_device() {
         ;;
       R)
         # Assume systemd is running
-        if [ -n $SYSTEMDUNITDIR ]; then
+        if [ -n "$SYSTEMDUNITDIR" ]; then
           SERVICETYPE=$(get_systemd_servicetype)
           systemctl restart ${SERVICETYPE}@${1}.service
         else
@@ -453,7 +453,7 @@ while true ; do
 				 --default-item "$DEFAULT" \
 				 --menu "" 0 0 0 \
 				 "A" "Automatically start?    [${AUTO:-Y}]" \
-         $(if [ -z $SYSTEMDUNITDIR ]; then
+         $(if [ -z "$SYSTEMDUNITDIR" ]; then
 				 echo "L"
          echo "kernel module to Load   [${MODULE:-}]"
          echo "Z"
@@ -488,7 +488,7 @@ while true ; do
 					echo "Netmask                 [${NETMASK}]"
 					echo "B"
 					echo "Broadcast               [${BROADCAST}]"
-          if [ -z $SYSTEMDUNITDIR ]; then
+          if [ -z "$SYSTEMDUNITDIR" ]; then
 					  echo "F"
 					  echo "Ifconfig options        [${IFCONF_OPTS:-}]"
           fi
@@ -498,7 +498,7 @@ while true ; do
 
 	if [ $? != 0 ]; then
     # Assume systemd is running if SYSTEMDUNITDIR variable is set
-    if [ -n $SYSTEMDUNITDIR ]; then
+    if [ -n "$SYSTEMDUNITDIR" ]; then
       DHCP_TIMEOUT="This device uses DHCP. If no DHCP servers are available to give an IP address\nyou may need to wait for the device to timeout."
       [ "$ADDRESS" = "dhcp" ] && $DIALOG --infobox "$DHCP_TIMEOUT" 0 0
       [ "$AUTO" = "Y" ] && systemd_enable $DEVICE $(get_systemd_servicetype) || systemd_disable_existing $DEVICE
@@ -587,7 +587,7 @@ done
 }
 
 . /etc/lunar/config
-. $BOOTSTRAP
+[ -n "$BOOTSTRAP" ] && . $BOOTSTRAP
 
 root_check
 
--- a/lservices/lservices
+++ b/lservices/lservices
@@ -197,7 +197,7 @@ main_menu() {
 		  --menu                          \
 		  "( Legend: +=enabled, -=disabled, 1=started, 0=stopped)" \
 		  0 0 0                           \
-		  $(if [ -n $SYSTEMDUNITDIR ]; then
+		  $(if [ -n "$SYSTEMDUNITDIR" ]; then
           list_systemd_services
         else
           list_initd_services
@@ -214,7 +214,7 @@ main_menu() {
 }
 
 . /etc/lunar/config
-[ -n $BOOTSTRAP ] && . $BOOTSTRAP
+[ -n "$BOOTSTRAP" ] && . $BOOTSTRAP
 
 export IFS="$TAB_ENTER_IFS"
 export LC_ALL=C
--- a/ltime/ltime
+++ b/ltime/ltime
@@ -77,7 +77,7 @@ timezone_menu()
 }
 
 . /etc/lunar/config
-[ -n $BOOTSTRAP ] && . $BOOTSTRAP
+[ -n "$BOOTSTRAP" ] && . $BOOTSTRAP
 
 export IFS="$TAB_ENTER_IFS"
 




More information about the Lunar-commits mailing list