You don't really need getopt to handle script long-options. The getopts builtin function can do it as well (and usually without subshells). The trick is to use - as an option. That way --dry-run (for example) becomes optvar=- and OPTARG=-dry-run. Here's a functional example of how you might do it specifically for this case:
#!/bin/sh
help(){ echo usage; } #dummy help
unset user dryrun pass _o o #ensure all flag vars are unset
while getopts :-:u:p:d o && #getopts loop
o=${o#-} _o=${o:+$OPTARG} #empty $o if $o==-
do case $o$OPTARG in #test concatenated $o$OPTARG
(u*|-user) user=${_o:-$2} ;; #set $user to $_o or $2
(p*|-pass) pass=${_o:-$2} ;; #ditto for $pass
(d*|-dryrun) o=d dryrun=1 ;; #no $OPTARG either way - o=d base
(*) ! help ;; #no usage options met - opt error
esac || exit #quit with error if opt == ! help
shift "$((!${#o}+(OPTIND-(OPTIND=1))))" #shift params as they're read
done
This will run as is. In fact I tried several different option possibilities with it. For example:
~/getopts.sh -p-user --user me -uyou -d --dry-run
...when run w/ a #!/bin/sh -x bangline printed this to my stderr:
+ unset user dryrun pass _o o
+ getopts :-:u:p:d o
+ o=p _o=-user
+ pass=-user
+ shift 1
+ getopts :-:u:p:d o
+ o= _o=
+ user=me
+ shift 2
+ getopts :-:u:p:d o
+ o=u _o=you
+ user=you
+ shift 1
+ getopts :-:u:p:d o
+ o=d _o=
+ o=d dryrun=1
+ shift 1
+ getopts :-:u:p:d o
+ o= _o=
+ o=d dryrun=1
+ shift 1
+ getopts :-:u:p:d o
After completing the getopts loop you can just do...
[ "$((dryrun))" -eq 0 ] && production || dryrun
...if you have declared the production() and dryrun() functions. They'll find any command-line values specified for $pass and/or $user assigned as necessary. If either of those has not been declared on the command-line, you might consider referencing them like:
echo "${user=default_username}" "${pass=default_password}"
...just to cover all of your bases.