install: fix unbound variable error
install: fix getopts usage bug

Calling getopts more than once requires a reset of the OPTIND variable.