Implement dirty check and forcing option in build-and-install

Change-Id: Ie4b4c7967cd7d6811cf4124d33f549b5dc1cf400