Add quotes around variable in db script

Apparently, ash doesn't like "[ -z ${xxx} ]" if the content of $xxx
contains spaces.  Added quotes around ${xxx}.
Also fixed:
- a couple of "[" "]" mismatches
- a logic error in the selection of upgrade scripts

Issue-ID: POLICY-3117
Change-Id: I99c977825fe9df8a44c288b6307cd3e55c504f86
Signed-off-by: Jim Hahn <jrh3@att.com>
2 files changed