Roger Leigh <[EMAIL PROTECTED]> writes:

> Roger Leigh <[EMAIL PROTECTED]> writes:
>
>> Roger Leigh <[EMAIL PROTECTED]> writes:
>>
>>> dchroot has support for switching between PER_LINUX and PER_LINUX32
>>> personalities.  schroot should also provide this support (it's
>>> currently provided via the command-prefix option, but more explicit
>>> support would be useful).
>>
>> I looked at Jeff Bailey's patch for dchroot, and the attached patch
>> introduces preliminary support for different process execution
>> domains.  You can then set the personality in the config file:
>>
>> personality=linux
>> personality=linux32
>> personality=svr4
>> personality=xenix
>
> I've now made a much more comprehensive patch, including
> documentation.  It applies to SVN or the current schroot in unstable.

This next patch adds the same support to dchroot.


-- 
Roger Leigh
                Printing on GNU/Linux?  http://gutenprint.sourceforge.net/
                Debian GNU/Linux        http://www.debian.org/
                GPG Public Key: 0x25BFB848.  Please sign and encrypt your mail.
Index: schroot/dchroot-chroot-config.cc
===================================================================
--- schroot/dchroot-chroot-config.cc	(revision 714)
+++ schroot/dchroot-chroot-config.cc	(working copy)
@@ -87,9 +87,14 @@
 								 cend);
 	  std::string::size_type lend = line.find_first_of(whitespace, lstart);
 
+	  // Get chroot personality
+	  std::string::size_type pstart = line.find_first_not_of(whitespace,
+								 lend);
+	  std::string::size_type pend = line.find_first_of(whitespace, pstart);
+
 	  // Check for trailing non-whitespace.
 	  std::string::size_type tstart = line.find_first_not_of(whitespace,
-								 lend);
+								 pend);
 
 	  if (cstart == std::string::npos ||
 	      cend == std::string::npos ||
@@ -103,12 +108,17 @@
 
 	  std::string chroot_name = line.substr(cstart, cend - cstart);
 	  std::string location = line.substr(lstart, lend - lstart);
+	  std::string personality;
+	  if (pstart != std::string::npos)
+	    personality = line.substr(pstart, pend - pstart);
 
 	  /* Create chroot object. */
 	  sbuild::chroot::ptr chroot = sbuild::chroot::create("plain");
 	  chroot->set_active(active);
 	  chroot->set_name(chroot_name);
 	  chroot->set_description(chroot_name + " chroot (dchroot compatibility)");
+	  if (pstart != std::string::npos)
+	    chroot->set_persona(sbuild::personality(personality));
 
 	  sbuild::chroot_plain *plain =
 	    dynamic_cast<sbuild::chroot_plain *>(chroot.get());
Index: schroot/dchroot.1.in
===================================================================
--- schroot/dchroot.1.in	(revision 714)
+++ schroot/dchroot.1.in	(working copy)
@@ -86,8 +86,9 @@
 .IP \[bu]
 Blank lines are ignored.
 .IP \[bu]
-Chroot definitions are a single line containing an \fIidentifier\fP and a
-\fIpath\fP, separated by whitespace.  The first chroot is also the default.
+Chroot definitions are a single line containing an \fIidentifier\fP,
+\fIpath\fP, and an optional \fIpersonality\fP separated by whitespace.  The
+first chroot is also the default.
 .PP
 An example file:
 .PP
@@ -98,13 +99,14 @@
 .br
 \f[CR]sarge /srv/chroot/sarge\fP
 .br
-\f[CR]sid /srv/chroot/sid\fP
+\f[CR]sid /srv/chroot/sid linux32\fP
 .br
 .RE
 .PP
 This file defines a chroot called \[oq]sarge\[cq], located at
 \fI/srv/chroot/sarge\fP, and a second chroot called \[oq]sid\[cq], located at
-\fI/srv/chroot/sid\fP.
+\fI/srv/chroot/sid\fP.  The second chroot uses the \[lq]linux32\[rq]
+personality, which allows a 32-bit chroot to be used on a 64-bit system.
 .SH INCOMPATIBILITIES
 .IP \[bu]
 Log messages are worded and formatted differently.
Index: debian/changelog
===================================================================
--- debian/changelog	(revision 714)
+++ debian/changelog	(working copy)
@@ -5,6 +5,9 @@
     (Closes: #354344).
   * root is no longer denied access when root is not in the groups or
     root_groups lists (Closes: #372569).
+  * schroot.conf supports a personality option to set the process
+    execution domain, and dchroot.conf supports an additional third
+    personality option to do the same (Closes: #372874).
 
  --
 
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 714)
+++ ChangeLog	(working copy)
@@ -1,5 +1,18 @@
 2006-06-13  Roger Leigh  <[EMAIL PROTECTED]>
 
+	* debian/changelog: Close #372874.
+
+	* NEWS: Document dchroot.conf change.
+
+	* schroot/dchroot.1.in: Document the new personality field in
+	dchroot.conf.
+
+	* schroot/dchroot-chroot-config.cc (parse_data): Parse a third
+	optional "personality" field, and if present, set the chroot
+	personality.
+
+2006-06-13  Roger Leigh  <[EMAIL PROTECTED]>
+
 	* debian/changelog: Close #372569.
 
 	* NEWS: Document changed authorisation behaviour.
Index: NEWS
===================================================================
--- NEWS	(revision 714)
+++ NEWS	(working copy)
@@ -14,8 +14,12 @@
      "linux32" to run a 32-bit Linux chroot on an amd64 system, for
      example.
 
-  2) The root user can access all chroots, even when the root group is
-     ommitted from the groups or root_groups lists.  Authentication is
+  2) dchroot has an additional personality field in dchroot.conf.
+     This may also be set to linux32 to achieve the same effect as the
+     personality setting in schroot.conf.
+
+  3) The root user can access all chroots, even when the root group is
+     omitted from the groups or root_groups lists.  Authentication is
      still required, but by default is skipped due to using
      pam_rootok.so in the PAM configuration.
 

Attachment: pgpQCASxqxuXN.pgp
Description: PGP signature

Reply via email to