Add preinst and postrm for daemon mode
Generate config
Some changes for daemon mode