stop using awk for file editing(should be compatible with non-darwin platforms now). some refactoring of install phase