Wednesday, November 28, 2007

I enjoy awking

Automounting is one of the things I am working on for the CD. I do it with awk.

sudo fdisk -l | grep NTFS | awk '{print $1}'

That lists all the the drives (fdisk -l), filters the results to show only the lines that have NTFS in them, then prints out the first section (the device and partition) of those lines. This gives me the information I need to mount the drives with ntfs-3g. The same goes for FAT partition (replace grep NTFS with grep W95).

So, with this, you can do:

for i in $(sudo fdisk -l | grep NTFS | awk '{print $1}')

and go ahead and mount the partitions.

I am also using something similar to this to write GUI version for ntfsundelete.

In other news, I spent ~3 hours today rooting through header files, forums, and mailing list archives trying to figure out how to write a (simple) C/C++ program that just checks to see if the .NET Framework is installed in the registry. I guess I could give and just use a batch file (this is for the autorun program). All the resources I found on reading the registry required the .NET Framework, so that just puts me back where I was before.

I fixed the Edit your partitions option on the LiveCD and added new tools, so v1.1 will be uploaded tomorrow night once I get rid of a couple rough edges. More details tomorrow.

No comments:

Post a Comment