I've been playing with creating packages, and I've noticed a pesky problem.  My package works just fine when compiled and installed as a module, but when compiled into the firmware it attempts to run the 'preinst' and 'postinst' scripts without a chroot to the install dir.    What my preinst script does is goes through looking for symlinks to busybox and removing them (the package replaces several programs that usually exist in busybox).  The problem is that my preinst script is checking /bin, /sbin/, etc for the files - when this is run within the buildroot, it references my system's /bin, etc instead of blah/root/bin/, etc.

Are there any exported variables I can be using to tell my script where root/ is?  Is there a 'standard' solution to this problem?