diff options
author | root <root@dev.spline.de> | 2008-08-17 15:20:12 +0200 |
---|---|---|
committer | root <root@dev.spline.de> | 2008-08-17 15:20:12 +0200 |
commit | 4f886b2cbbc86353c81364710f187cc07aec0305 (patch) | |
tree | c81cb46c7c6c3d4feafe5a67c0895ebb023a09fb | |
parent | f27184e291baddcc572ddd2db7ccbafd42278620 (diff) | |
download | dev-scripts-4f886b2cbbc86353c81364710f187cc07aec0305.tar.gz dev-scripts-4f886b2cbbc86353c81364710f187cc07aec0305.tar.xz dev-scripts-4f886b2cbbc86353c81364710f187cc07aec0305.zip |
add some sanity checks
Diffstat (limited to '')
-rwxr-xr-x | bin/addproject | 27 | ||||
-rw-r--r-- | bin/functions.sh | 1 |
2 files changed, 21 insertions, 7 deletions
diff --git a/bin/addproject b/bin/addproject index 4a038dd..660a245 100755 --- a/bin/addproject +++ b/bin/addproject @@ -1,25 +1,38 @@ #!/bin/bash +dbquery() { + mysql -s -s -e "$@" trac +} + # main function main() { echo - + # project_name may not be an empty string and must be >= 3 characters while [[ ${#project_name} -lt 3 ]] do eask_str "a project name (min 3 chars)" project_name=${REPLY} done - + + if [[ -n $(dbquery "SELECT id FROM project WHERE project_name = '${project_name}'") ]] + then + eerror "Project ${project_name} already exists." + fi + # who requests the project ? - while [[ -z ${user_email} ]] + while [[ -z ${user_name} ]] do - eask_str "email address (*.fu-berlin.de) of applicant" - user_email=${REPLY} - don (*.fu-berlin.de) of applicant" - user_email=${REPLY} + eask_str "username of applicant" + user_name=${REPLY} done + user_email=$(dbquery "SELECT email FROM user WHERE login = '${user_name}'") + if [[ -z ${user_email} ]] + then + eerror "Username ${user_name} does not exist." + fi + einfo einfo "$(color yellow)public project:$(color) read access for everyone with a spline-dev account." \ "write access only for project members. this is the default." diff --git a/bin/functions.sh b/bin/functions.sh index 3dbbb7c..f872c77 100644 --- a/bin/functions.sh +++ b/bin/functions.sh @@ -86,6 +86,7 @@ ewarn() { } eerror() { + echo _ewrap eerror "$*" return 1 } |