diff options
Diffstat (limited to 'bin/addproject')
-rwxr-xr-x | bin/addproject | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/bin/addproject b/bin/addproject index 7f853d1..53640b6 100755 --- a/bin/addproject +++ b/bin/addproject @@ -23,6 +23,15 @@ main() { eask_str "a project description" project_desc=${REPLY} + # svn_name may not be an empty string and must be >= 3 characters + eask_str "a gforge svn repository name (LEAVE BLANK if this is a new project)" + gforge_name=${REPLY} + + if [[ -n ${gforge_name} && ! -d /mnt/gforge/var/lib/gforge/svn/${gforge_name} ]] + then + eerror "Repository ${gforge_name} does not exists." + fi + # who requests the project ? while [[ -z ${user_name} ]] do @@ -48,13 +57,23 @@ main() { trac_home=${TRAC_ROOT}/${project_name} trac_db=trac_${project_name} - eheading "creating new subversion directory" - eexec svnadmin create ${svn_home} - tmpdir=$(mktemp -d) - eexec mkdir -p ${tmpdir}/{trunk,tags,branches} - eexec svn -q import -m "initial import for project ${project_name}" ${tmpdir} file://${svn_home} - eexec chown -R apache:apache ${svn_home} - eexec rm -rf ${tmpdir} + if [[ -z ${gforge_name} ]] + then + eheading "creating new subversion directory" + eexec svnadmin create ${svn_home} + tmpdir=$(mktemp -d) + eexec mkdir -p ${tmpdir}/{trunk,tags,branches} + eexec svn -q import -m "initial import for project ${project_name}" ${tmpdir} file://${svn_home} + eexec chown -R apache:apache ${svn_home} + eexec rm -rf ${tmpdir} + else + eheading "using existing gforge repository" + eexec svnadmin create ${svn_home} + tmpfile=$(mktemp) + svnadmin dump /mnt/gforge/var/lib/gforge/svn/${gforge_name} > ${tmpfile} + svnadmin load ${svn_home} < ${tmpfile} + rm -f ${tmpfile} + fi eheading "creating new trac project" eexec mysqladmin create ${trac_db} |