summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeppia <seppia@seppia.net>2018-05-30 01:47:52 +0200
committerSeppia <seppia@seppia.net>2018-05-30 01:47:52 +0200
commit34197addaeb85f5a51dde716265309643b769961 (patch)
tree271769bb60484e8454bac6b457bad71c00a41b9a
parent643050c24c76f20ea7eaa76c57e52d285b217a14 (diff)
downloadrepofish-34197addaeb85f5a51dde716265309643b769961.tar.gz
repofish-34197addaeb85f5a51dde716265309643b769961.tar.bz2
repofish-34197addaeb85f5a51dde716265309643b769961.zip
Variable and input checks
Now checks if hardcoded variables have been set and eventually if their values are acceptable.
-rwxr-xr-xrepo.sh12
1 files changed, 11 insertions, 1 deletions
diff --git a/repo.sh b/repo.sh
index 0003ddb..1b11af2 100755
--- a/repo.sh
+++ b/repo.sh
@@ -109,7 +109,11 @@ print_help() {
echo
}
-if [ "$1" == '' ]; then
+if [ "${SRC_PATH}" == '' ];then
+ echo 'ERROR: SRC_PATH variable not set.'
+elif [ ! -d "${SRC_PATH}" ]; then
+ echo 'ERROR: SRC_PATH variable set to invalid path.'
+elif [ "$1" == '' ]; then
echo 'warning: no command called.'
elif [ "$1" == 'add' ]; then
if [ "$3" != '' ]; then
@@ -144,6 +148,12 @@ elif [ "$1" == 'list' ]; then
elif [ "$1" == 'update' ]; then
if [ "$3" != '' ]; then
echo 'error: too many arguments.'
+ elif [ "${REPO_PATH}" == '' ];then
+ echo 'ERROR: REPO_PATH variable not set.'
+ elif [ ! -d "${REPO_PATH}" ]; then
+ echo 'ERROR: REPO_PATH variable set to invalid path.'
+ elif [ "${REPO_NAME}" == '' ];then
+ echo 'ERROR: REPO_NAME variable not set.'
elif [ "$2" != '' ]; then
update_repo $2
else