From e99b6a131ea08829da26d62d498c33f3129683e3 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Thu, 28 Jul 2011 13:07:25 -0400 Subject: [PATCH 1/2] scripts/repo-add: show usage when no DB file specified Signed-off-by: Dave Reisner --- scripts/repo-add.sh.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in index c598ad9b..48f221b8 100644 --- a/scripts/repo-add.sh.in +++ b/scripts/repo-add.sh.in @@ -609,8 +609,12 @@ while (( $# )); do shift done - REPO_DB_FILE=${args[0]} +if [[ -z $REPO_DB_FILE ]]; then + usage + exit 1 +fi + LOCKFILE=$REPO_DB_FILE.lck verify_repo_extension "$REPO_DB_FILE" >/dev/null From e42d97b7370c9e30d9ae66a33f42d27460eaf137 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Thu, 28 Jul 2011 13:08:37 -0400 Subject: [PATCH 2/2] scripts/pkgdelta: exit properly on missing args Removes usage of 'nounset' which, when combined with 'errexit' can cause undesirable early exits. Signed-off-by: Dave Reisner --- scripts/pkgdelta.sh.in | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/pkgdelta.sh.in b/scripts/pkgdelta.sh.in index 46c6f4ff..0f3472b6 100644 --- a/scripts/pkgdelta.sh.in +++ b/scripts/pkgdelta.sh.in @@ -20,7 +20,6 @@ # # bash options -set -o nounset set -o errexit # gettext initialization @@ -130,7 +129,7 @@ esac if (( $# != 2 )); then usage - exit 0 + exit 1 fi if [[ ! -f $1 ]]; then