[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to detect if inside a buildd chroot



Sebastian Dröge <slomo@circular-chaos.org> writes:

> does somebody know about a solution to check whether one runs in a
> buildd chroot or not?

You can't reliably (or portably) check if you are in a chroot.  You
could (for example) check for the existance of /etc/debian_chroot.
However, this is not guaranteed to be present.  It might even be
present on the host system if it is also used as a chroot under some
circumstances.

> I need this to prevent hal from starting in buildd chroots (via
> invoke-rc.d from postinst) as it breaks there because of several
> reasons, including no /sys mounted.

Well, in that case simply check if /sys is mounted before starting it,
perhaps even in the init script.  Rather than checking you are in a
chroot, check for the conditions required to run hal before running
it.


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.

Attachment: pgpr54maOPWP8.pgp
Description: PGP signature


Reply to: