why not:
```bash
pkgin ls | grep "^$1" || return $?
```
although I do not know the output format of `pkgin ls` just read a bit here: http://wiki.smartos.org/display/DOC/Working+with+Packages