isolate initscript-related stuff in initscript.py and minor cleanups