Originally Posted by GregorRichards
Presumably it's preferable to avoid modifying sysd ... there is an IPC command to unmount the filesystem, I'm sure if you were careful to use daemon(3) first you could survive it (the shutdown app would have to be in C to do this of course). Without having the time right now to look through sysd, does it send all the same cleanup signals when it's asked explicitly to unmount the card, or only when it's shutting down?
The changes required to sysd are pretty simple. I wouldn't modify any of the existing functions, but clone one that will only be called by the new userShutdown. That way any existing code that is using sysd shouldn't be effected.