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

Re: How to detect if inside a buildd chroot



Mike Hommey <mh@glandium.org> wrote:
> > chroot without any admin intervention.  If it's not appropriate to run
> > inside a chroot, then the init script should IMHO detect that and not
> > start/restart/stop the service.
> 
> The fact is, not all chroot are buildd chroots, and many chroots
> actually do run services...

  Yep... but I still find it a bit annoying that I have to override binaries
like start-stop-daemon or invoke-rc.d when building a chroot. I wish there
was a way to just set a flag that means "dpkg, don't start/stop any
services!"... instead I end up doing stuff like:


invoke="/usr/sbin/invoke-rc.d"

cdebootstrap -f "standard" "$SUITE" "$TARGET" "$MIRROR"
mount -t proc proc "$TARGET/proc"
$chroot "$TARGET" $aptitude update || throw
$chroot "$TARGET" /usr/sbin/dpkg-divert \
  --add --rename --divert $invoke.orig $invoke || throw
ln -sf /bin/true "$TARGET/$invoke"

 [bootstrap code...]

/bin/rm -f "$TARGET/$invoke"
$chroot "$TARGET" /usr/sbin/dpkg-divert \
  --remove --rename --divert $invoke.orig $invoke || throw
umount "$TARGET/proc"


	- Tyler



Reply to: