--- voyage-current/usr/local/sbin/voyage-install.sh-x	2009-09-29 13:06:52.675119561 +0200
+++ voyage-current/usr/local/sbin/voyage-install.sh	2009-09-29 14:49:41.290134961 +0200
@@ -356,24 +356,29 @@
 
 doopt "$@"
 
-# The logic here is a little confusing.  Basically, we may or may
-# not have a stored $CONFIGFILE [.voyage-install.conf] which
-# contains data saved from previous invocations.  If we do have it,
-# we need to read it to find out where to look for the distribution
-# directory.  After that we will read in 'voyage.conf' from the
-# distribution.  However, if on previous invocations the user has
-# changed some of the profile settings, those changed settings will
-# be lost.  To solve this, we will re-read the stored config after
-# reading the distribution profile.
+# The logic here is a little confusing. First, we may or may not have
+# a stored $CONFIGFILE [.voyage-install.conf] # which contains data
+# saved from previous invocations.  If we do have it, we need to read
+# it just to find out where to look for the distribution directory
+# -- except for $CLA_DISTDIR being set by the command line option "-d"
+# which would override any setting of $DISTDIR.  After that we will
+# read in 'voyage.conf' from the distribution.  However, if on previous
+# invocations the user has changed some of the profile settings, those
+# changed settings will be lost.  To solve this, we will re-read the
+# stored config after reading the distribution profile.
 read_config "$CONFIGFILE" CONFIGLIST
 
-# Set the defaults in case there are no saved values
-if [ -z $DISTDIR ]; then
-	ask_work_dir "$RUNDIR" "distribution"
-	DISTDIR=$w
-	save_config_var DISTDIR CONFIGLIST
-#	export DISTDIR
+if [ ! -z "$CLA_DISTDIR" ]; then
+	DISTDIR="$CLA_DISTDIR"
+else
+	# Set the defaults in case there are no saved values
+	if [ -z "$DISTDIR" ]; then
+		ask_work_dir "$RUNDIR" "distribution"
+		DISTDIR=$w
+		save_config_var DISTDIR CONFIGLIST
+	fi
 fi
+#	export DISTDIR
 
 # Initialise the configuration from voyage.conf
 if [ ! -f ${DISTDIR}/etc/voyage.conf ]; then
