[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:16 UTC 2009


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

    Make the starting VT configurable

diff --git a/debian/nodm.config b/debian/nodm.config
index cb746a8..01f8cdc 100644
--- a/debian/nodm.config
+++ b/debian/nodm.config
@@ -13,6 +13,9 @@ 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"
 	fi
@@ -37,6 +40,9 @@ if [ "x$START" = "xtrue" ] ; then
 	db_input medium nodm/user || true
 	db_go
 
+	db_input low nodm/first_vt || true
+        db_go
+
         db_input low nodm/x_options || true
         db_go
 
diff --git a/debian/nodm.init b/debian/nodm.init
index edf5f34..0271792 100644
--- a/debian/nodm.init
+++ b/debian/nodm.init
@@ -20,8 +20,9 @@ PIDFILE=${PIDDIR}/${NAME}.pid
 
 NODM_ENABLED=no
 NODM_XINIT=/usr/bin/xinit
+NODM_FIRST_VT=7
 NODM_XSESSION=/etc/X11/Xsession
-NODM_X_OPTIONS="vt7 -nolisten tcp"
+NODM_X_OPTIONS="-nolisten tcp"
 NODM_USER=root
 NODM_MIN_SESSION_TIME=60
 
diff --git a/debian/nodm.postinst b/debian/nodm.postinst
index d0e8373..86b37cb 100644
--- a/debian/nodm.postinst
+++ b/debian/nodm.postinst
@@ -19,6 +19,8 @@ if [ "$1" = "configure" ] ; then
     NODM_ENABLED="$RET"
     db_get nodm/user
     NODM_USER="$RET"
+    db_get nodm/first_vt
+    NODM_FIRST_VT="$RET"
     db_get nodm/x_options
     NODM_X_OPTIONS="$RET"
     db_get nodm/min_session_time
@@ -31,6 +33,7 @@ if [ "$1" = "configure" ] ; then
     if [ -s /etc/default/nodm ] ; then
 	    sed -i -r -e "s,^NODM_ENABLED=.*,NODM_ENABLED=$NODM_ENABLED," \
 		      -e "s,^NODM_USER=.*,NODM_USER=$NODM_USER," \
+		      -e "s,^NODM_FIRST_VT=.*,NODM_FIRST_VT='$NODM_FIRST_VT'," \
 		      -e "s,^NODM_X_OPTIONS=.*,NODM_X_OPTIONS='$NODM_X_OPTIONS'," \
 		      -e "s,^NODM_MIN_SESSION_TIME=.*,NODM_MIN_SESSION_TIME=$NODM_MIN_SESSION_TIME," \
 		      -e "s,^NODM_XINIT=.*,NODM_XINIT=$NODM_XINIT," \
@@ -49,6 +52,9 @@ NODM_USER=$NODM_USER
 # xinit program
 NODM_XINIT=$NODM_XINIT
 
+# First vt to try when looking for free VTs
+NODM_FIRST_VT=$NODM_FIRST_VT
+
 # X session
 NODM_XSESSION=$NODM_XSESSION
 
diff --git a/debian/nodm.templates b/debian/nodm.templates
index e3c2d69..79cba0b 100644
--- a/debian/nodm.templates
+++ b/debian/nodm.templates
@@ -24,6 +24,18 @@ Default: root
 _Description: User to start a session for:
  Please enter the login name of the user that will automatically be logged into X by nodm.
 
+Template: nodm/first_vt
+Type: string
+Default: 7
+_Description: Lowest numbered vt on which X may start:
+ nodm needs to find a free virtual terminal on which to start the X server.
+ .
+ Since X and getty get to conflict, this parameter will specify the lowest
+ numbered virtual terminal on which to start the search.
+ .
+ This value should be set to one higher than the highest numbered virtual
+ terminal on which a getty may start.
+
 Template: nodm/x_options
 Type: string
 Default: vt7 -nolisten tcp
diff --git a/nodm.c b/nodm.c
index d9e38bf..041f77b 100644
--- a/nodm.c
+++ b/nodm.c
@@ -509,7 +509,7 @@ static int nodm_monitor(int argc, char **argv)
 	char* cp;
 	int mst;
 	int vt_fd = -1;
-	int vt_num = 3;
+	int vt_num;
 
 	/* Parse command line options */
 	while (1)
@@ -547,6 +547,11 @@ static int nodm_monitor(int argc, char **argv)
 
 	syslog(LOG_INFO, "Starting nodm monitor");
 
+	{
+		char startvt[BUFSIZ];
+		string_from_env(startvt, "NODM_FIRST_VT", "7");
+		vt_num = strtoul(startvt, NULL, 10, NULL);
+	}
 	if ((vt_fd = open_vt(&vt_num)) == -1)
 	{
 		fprintf (stderr, _("%s: cannot allocate a virtual terminal\n"), Prog);
@@ -558,6 +563,7 @@ static int nodm_monitor(int argc, char **argv)
 	mst = cp ? atoi(cp) : 60;
 	string_from_env(xinit, "NODM_XINIT", "/usr/bin/xinit");
 	string_from_env(xoptions, "NODM_X_OPTIONS", "");
+
 	if (xoptions[0] == 0)
 		snprintf(xoptions1, BUFSIZ, "vt%d", vt_num);
 	else

-- 
Automatic Display Manager



More information about the pkg-fso-commits mailing list