qpkg does not work with bourne shell compliant shells such as ash, so the first line should be changed to read #!/bin/bash
works here can't reproduce
I bet you have only tried running it with /bin/sh pointing to bash, so you wont notice that it includes bash-specific stuff. However, it does, so the magic number should be #!/bin/bash, and nothing else. Is it such a hard fix?
gentoolkit-0.1.19-r4 fixes this