tags 354257 + patch
thanks
Hi,
I have now implemented this suggestion, and I have attached a diff for
you. This should apply to the 0.2.4 source tarball at
people.debian.org/~rleigh/. Otherwise, you could always apply it
directly to CVS (http://alioth.debian.org/scm/?group_id=30471 module
schroot).
If you enable run-setup-scripts for a plain chroot, it will now
start a session (try schroot -l --all-sessions), and you can use
-b/-r/-e properly.
Regards,
Roger
--
Roger Leigh
Printing on GNU/Linux? http://gutenprint.sourceforge.net/
Debian GNU/Linuxhttp://www.debian.org/
GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
Index: ChangeLog
===
RCS file: /cvsroot/buildd-tools/schroot/ChangeLog,v
retrieving revision 1.244
diff -u -r1.244 ChangeLog
--- ChangeLog 24 Feb 2006 20:26:07 - 1.244
+++ ChangeLog 25 Feb 2006 00:09:33 -
@@ -1,3 +1,28 @@
+2006-02-25 Roger Leigh [EMAIL PROTECTED]
+
+ * Update tests.
+
+ * schroot/setup/10mount: Allow plain chroots to run the mount
+ script. For plain chroots, bind mount LOCATION on MOUNT_LOCATION.
+
+ * schroot/setup/00check: For plain chroots, verify
+ CHROOT_LOCATION, rather than CHROOT_PATH (because CHROOT_PATH does
+ not exist at this point).
+
+ * schroot/sbuild-session.cc
+ (run_impl): In addition to all other chroot types, if chroot is a
+ chroot_plain chroot with setup scripts enabled, set the mount
+ location to the session id.
+
+ * schroot/sbuild-chroot-plain.cc
+ (get_path): New virtual method to override base class
+ implementation. When setup scripts are enabled, return the mount
+ location, or else the location.
+ (setup_lock): When setup scripts are enabled, write out a session
+ metadata.
+ (get_session_flags): When setup scripts are enabled, enable
+ SESSION_CREATE, or else 0.
+
2006-02-24 Roger Leigh [EMAIL PROTECTED]
* schroot/schroot.conf.5.in: Document location for block-device
Index: schroot/sbuild-chroot-plain.cc
===
RCS file: /cvsroot/buildd-tools/schroot/schroot/sbuild-chroot-plain.cc,v
retrieving revision 1.21
diff -u -r1.21 sbuild-chroot-plain.cc
--- schroot/sbuild-chroot-plain.cc 24 Feb 2006 20:26:07 - 1.21
+++ schroot/sbuild-chroot-plain.cc 25 Feb 2006 00:09:33 -
@@ -56,6 +56,17 @@
chroot::set_location(location);
}
+std::string
+chroot_plain::get_path () const
+{
+ // When running setup scripts, we are session-capable, so the path
+ // is the bind-mounted location, rather than the original location.
+ if (get_run_setup_scripts() == true)
+return get_mount_location();
+ else
+return get_location();
+}
+
std::string const
chroot_plain::get_chroot_type () const
{
@@ -77,12 +88,25 @@
bool lock)
{
/* By default, plain chroots do no locking. */
+ /* Create or unlink session information. */
+ if (get_run_setup_scripts() == true)
+{
+ if ((type == SETUP_START lock == true) ||
+ (type == SETUP_STOP lock == false))
+ {
+ bool start = (type == SETUP_START);
+ setup_session_info(start);
+ }
+}
}
sbuild::chroot::session_flags
chroot_plain::get_session_flags () const
{
- return static_castsession_flags(0);
+ if (get_run_setup_scripts() == true)
+return SESSION_CREATE;
+ else
+return static_castsession_flags(0);
}
void
Index: schroot/sbuild-chroot-plain.h
===
RCS file: /cvsroot/buildd-tools/schroot/schroot/sbuild-chroot-plain.h,v
retrieving revision 1.19
diff -u -r1.19 sbuild-chroot-plain.h
--- schroot/sbuild-chroot-plain.h 24 Feb 2006 20:26:07 - 1.19
+++ schroot/sbuild-chroot-plain.h 25 Feb 2006 00:09:33 -
@@ -59,6 +59,9 @@
virtual void
set_location (std::string const location);
+virtual std::string
+get_path () const;
+
virtual std::string const
get_chroot_type () const;
Index: schroot/sbuild-session.cc
===
RCS file: /cvsroot/buildd-tools/schroot/schroot/sbuild-session.cc,v
retrieving revision 1.37
diff -u -r1.37 sbuild-session.cc
--- schroot/sbuild-session.cc 24 Feb 2006 20:26:07 - 1.37
+++ schroot/sbuild-session.cc 25 Feb 2006 00:09:34 -
@@ -323,13 +323,16 @@
/* If a chroot mount location has not yet been set, and the
chroot is not a plain chroot, set a mount location with the
session id. */
- if (chroot-get_mount_location().empty()
- dynamic_castchroot_plain *(chroot.get()) == 0)
- {
- std::string location(std::string(SCHROOT_MOUNT_DIR) + / +
- this-session_id);
- chroot-set_mount_location(location);
- }
+ {
+ chroot_plain *plain = dynamic_castchroot_plain *(chroot.get());
+ if (chroot-get_mount_location().empty()
+ (plain == 0 || plain-get_run_setup_scripts() == true))
+ {
+ std::string