Creating custom BT4 USB stick installations
This is a how-to guide containing instructions for the creation of modified USB-stick BT4 installations (i.e. linux live distros). It is based entirely on my own experiences; there are certainly other ways to do it, and there are probably better ways as well. However, I've found relatively little information on the process, so I put together this guide for other newbies. I do not guarantee or support it in any way.
The situation: You've got a BT4 USB install and you love it, but you find that there are a couple of key things missing. You may want Nessus installed without having to reregister each boot, or Compiz, or... whatever. How do you modify those darned LZMs appropriately?
The answer: mksquashfs is your friend. dir2lzm is just a wrapper for it, and tar2lzm doesn't function under backtrack because certain executables aren't included in the distro. So install your files, makesquashfs the directories and put the file in the BT4/modules (or base) directory so they get loaded automatically.
However, there are caveats:
1) mksquashfs needs the -keep-as-directory option, else you'll find your files thrown all around the / directory.
2) It appears that the process used for mounting lzm files always mounts them in the root directory (/). So your best bet is to either install all new packages in a new root directory (i.e. /mynessus instead of /opt/mynessus) or else remake the entire filesystem image for that directory. I've chosen the latter, though it can be a slow process.
So, the steps. These assume you're currently running from your USB stick, and that it's mounted at /mnt/sdb1 (yours will likely vary somewhat):
1) Install your packages. Take note of all directories that are modified(by which I mean note down all top level directories modified).
2) Move the corresponding images of those directories from /mnt/sdb1/BT4/base/<whatever>.lzm to somewhere safe. If you have a large USB stick, /mnt/sdb1 would be fine. Backups are a good thing. Note that I said move, not copy.
3) Ensure that you're at a console, NOT in KDE or such. That means files are less likely to be changed as you make the image.
4) Let's assume that /opt is the only directory modified for this example (but in reality, do this step for all directories involved). Make a new image: mksquashfs /opt /mnt/sdb1/BT4/base/opt.lzm -keep-as-directory
5) Wait. If it's /usr, wait a very long time.
6) Reboot. If you grabbed all the modified directories, your applications should work just fine.
Note that I'm saving directly to the USB stick (which, of course, needs to be sufficiently sized; you can probably get by with 2 gigs, but I don't recommend anything less than 4). Saving anywhere else will likely fail due to the immense size of the image and the limited system RAM.
Now, if you don't want to modify the original files, or you don't want the creation process to take as long, there is another option. You can delete all the unmodified directories within the top level directory, then make an image of that directory using the same syntax as above. Call it something else, preferably beginning with a z or such. As the images are loaded alphabetically, that ensures that the other images are loaded first, then that directory is placed over the top. Note that I have no idea how this works with partial directories (i.e. if you delete everything except for a single file from /usr/bin, then make an image from /usr, I don't know if you'll see a single file or all files with the single file overlaid on top when you reboot).
If there's anything I missed here, please let me know. It's not a difficult process, but it can be frustrating when you're trying to figure it out!