[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

d-l: please warn on missing files specified by lh_config



Two things:

 . it would be useful to warn when a file is missing at configure
   time;
 . the abundant commandline parameters can be handled together with
   "eval".  Some of them should be separate (eg. when the argument is
   a file and its existence can be checked).  If it's agreed that this
   is a change in the right direction I can provide further patches
   which can be expected to considerably reduce rather than increase
   the code size.

--- /usr/bin/lh_config
+++ /tmp/tmp.TfbYk14421/lh_config	2007-11-04 13:12:18.000000000 -0500
@@ -505,23 +505,29 @@
 				;;
 
 			--net-cow-server)
+
 				LH_NET_COW_SERVER="${2}"
 				shift 2
 				;;
 
 			--syslinux-splash)
-				LH_SYSLINUX_SPLASH="${2}"
-				shift 2
-				;;
-
-			--syslinux-timeout)
-				LH_SYSLINUX_TIMEOUT="${2}"
-				shift 2
+				shift
+				[ -f "$1" ] ||
+					echo "$0: warning: $1 doesn't exist" >&2
+				LH_SYSLINUX_SPLASH="${1}"
+				shift
 				;;
 
-			--syslinux-menu)
-				LH_SYSLINUX_MENU="${2}"
-				shift 2
+			--syslinux-timeout|--syslinux-menu)
+				a=`echo "${1#--}" |
+					tr '[[:lower:]]' '[[:upper:]]' |
+					tr '-' '_'`
+				# TODO: shift || { echo: error; exit # 1; } >&2
+				shift
+				set -x
+				eval "LH_$a=$1"
+				set +x
+				shift
 				;;
 
 			--username)

-------------- next part --------------
--- /usr/bin/lh_config
+++ /tmp/tmp.TfbYk14421/lh_config	2007-11-04 13:12:18.000000000 -0500
@@ -505,23 +505,29 @@
 				;;
 
 			--net-cow-server)
+
 				LH_NET_COW_SERVER="${2}"
 				shift 2
 				;;
 
 			--syslinux-splash)
-				LH_SYSLINUX_SPLASH="${2}"
-				shift 2
-				;;
-
-			--syslinux-timeout)
-				LH_SYSLINUX_TIMEOUT="${2}"
-				shift 2
+				shift
+				[ -f "$1" ] ||
+					echo "$0: warning: $1 doesn't exist" >&2
+				LH_SYSLINUX_SPLASH="${1}"
+				shift
 				;;
 
-			--syslinux-menu)
-				LH_SYSLINUX_MENU="${2}"
-				shift 2
+			--syslinux-timeout|--syslinux-menu)
+				a=`echo "${1#--}" |
+					tr '[[:lower:]]' '[[:upper:]]' |
+					tr '-' '_'`
+				# TODO: shift || { echo: error; exit # 1; } >&2
+				shift
+				set -x
+				eval "LH_$a=$1"
+				set +x
+				shift
 				;;
 
 			--username)


Reply to: