How to open and repackage OSX .pkg files

How to open and repackage OSX .pkg files

pkgutil --expand /Volumes/xxx.pkg ~/Desktop/xxx.unpkg
...edit file(s)...
pkgutil --flatten ~/Desktop/xxx.unpkg ~/Desktop/xxx.pkg