Various fixes

* change IMG_FORMAT= to IMAGE_TYPE= (g.i.i uses the latter)
* actually call cleanup at the end of two hooks
* remove extra CLEANUP=() in one hook (which resets cleanup tasks)
* remove unneeded setting of cleanup traps at start of hooks (already set
  in common.sh)
* add missing $ in two variable tests
* use $MKDIR_P instead of hardcoded mkdir -p in two files