[pkg-fso-commits] [SCM] Automatic Display Manager branch, master, updated. nodm/0.3-2-25-g6b59ed6

Enrico Zini enrico at enricozini.org
Thu Jul 23 23:44:17 UTC 2009


The following commit has been merged in the master branch:
commit d360c4c051e9439fa54511edfccfaec4f8f1ec22
Author: Enrico Zini <enrico at enricozini.org>
Date:   Fri Jul 24 01:01:32 2009 +0200

    Provide a migration path from older nodm

diff --git a/debian/nodm.config b/debian/nodm.config
index 01f8cdc..5f43648 100644
--- a/debian/nodm.config
+++ b/debian/nodm.config
@@ -13,11 +13,38 @@ if [ -s /etc/default/nodm ] ; then
 	if [ -n "$NODM_USER" ] ; then
 		db_set nodm/user "$NODM_USER"
 	fi
-	if [ -n "$NODM_FIRST_VT" ] ; then
-		db_set nodm/first_vt "$NODM_FIRST_VT"
-	fi
-	if [ -n "$NODM_X_OPTIONS" ] ; then
-		db_set nodm/x_options "$NODM_X_OPTIONS"
+
+	if [ -n "$2" ] && dpkg --compare-versions "$2" lt "0.5"
+	then
+		# If I'm coming from <0.5, remove vtN from NODM_X_OPTIONS and
+		# set first_vt to N
+		if [ -n "$NODM_X_OPTIONS" ] ; then
+			# Try to extract vtN from NODM_X_OPTIONS
+			VTNUM=`echo "$NODM_X_OPTIONS" | sed -re 's/^.*\<vt([0-9]+)\>.*$/\1/'`
+			if [ "$VTNUM" = "$NODM_X_OPTIONS" ]
+			then
+				VTNUM=
+			else
+				# If it found vtN, strip it away from NODM_X_OPTIONS
+				NODM_X_OPTIONS=`echo "$NODM_X_OPTIONS" | sed -r -e 's/[[:blank:]]*\<vt([0-9]+)\>[[:blank:]]//' -e 's/^[[:blank:]]*//' -e 's/[[:blank:]]*$//'`
+			fi
+			db_set nodm/x_options "$NODM_X_OPTIONS"
+		fi
+		if [ -n "$NODM_FIRST_VT" ] ; then
+			db_set nodm/first_vt "$NODM_FIRST_VT"
+		elif [ -n "$VTNUM" ]; then
+			# If VTNUM was not set but we found it in NODM_X_OPTIONS, set it here
+			db_set nodm/first_vt "$VTNUM"
+		fi
+	else
+		if [ -n "$NODM_FIRST_VT" ] ; then
+			db_set nodm/first_vt "$NODM_FIRST_VT"
+		fi
+		if [ -n "$NODM_X_OPTIONS" ] ; then
+			# If I'm  going from <0.5 to >= 0.5, remove vt? from the line
+			# And set first_vt to vtN
+			db_set nodm/x_options "$NODM_X_OPTIONS"
+		fi
 	fi
 	if [ -n "$NODM_MIN_SESSION_TIME" ]; then
 		db_set nodm/min_session_time "$NODM_MIN_SESSION_TIME"

-- 
Automatic Display Manager



More information about the pkg-fso-commits mailing list