isolate: Replace system() calls with implementations

Vanilla bash doesn't like being run suid. And this is probably safer anyway.