#!/bin/bash # 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 # who requests the project ? while [[ -z ${user_email} ]] do eask_str "email address (*.fu-berlin.de) of applicant" user_email=${REPLY} don (*.fu-berlin.de) of applicant" user_email=${REPLY} done 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." einfo "$(color yellow)private project:$(color) read and write access only for project members." einfo eask_bool "Should the project be private?" n project_closed=${REPLY} svn_home=${SVN_ROOT}/${project_name} 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} eheading "creating new trac project" eexec mysqladmin create ${trac_db} eexec trac-admin ${trac_home} initenv --inherit=${TRAC_INI} ${project_name} "mysql://${MYSQL_USER}:${MYSQL_PASS}@${MYSQL_HOST}/${trac_db}" svn ${svn_home} if [[ ${project_closed} == y ]] then for perm in BROWSER_VIEW CHANGESET_VIEW FILE_VIEW LOG_VIEW MILESTONE_VIEW \ REPORT_SQL_VIEW REPORT_VIEW ROADMAP_VIEW SEARCH_VIEW TICKET_VIEW \ TIMELINE_VIEW WIKI_VIEW do eexec trac-admin ${trac_home} permission remove anonymous ${perm} done fi for perm in TICKET_CREATE TICKET_MODIFY WIKI_CREATE WIKI_MODIFY do eexec trac-admin ${trac_home} permission remove authenticated ${perm} done eexec trac-admin ${trac_home} permission add authenticated TRAC_ADMIN eheading "setting up apache2" eexec sed -i -e "\$a\\# ${project_name} (added on $(date -R))\\" ${APACHE_PROJECT_CONF} eexec sed -i -e "\$a\\Use TracProject ${project_name}\\" ${APACHE_PROJECT_CONF} if [[ ${project_closed} == y ]] then eexec sed -i -e "\$a\\Use SVNProjectClosed ${project_name}\\" ${APACHE_PROJECT_CONF} else eexec sed -i -e "\$a\\Use SVNProject ${project_name}\\" ${APACHE_PROJECT_CONF} fi echo >> ${APACHE_PROJECT_CONF} eexec /etc/init.d/apache2 reload eheading "committing changes to our git-repository in /etc" pushd /etc > /dev/null eexec git add ${APACHE_PROJECT_CONF/\/etc\/} eexec git commit -m "added new project ${project_name}" popd > /dev/null eheading "requesting new mailinglist for the project" # register mailinglist (owner is user_email) for the new project eexec wget --no-check-certificate --post-data "name=commit-${project_name}&email=${user_email}" \ https://lists.spline.inf.fu-berlin.de/cgi-bin/neueliste.pl echo einfo einfo "done! success! jipii! neeeat!" einfo "you can find your project at $(color yellow)https://dev.spline.de/trac/${project_name}$(color)" einfo echo } # go to script dir pushd $(dirname $0) > /dev/null # get global functions source "./functions.sh" # load configuration source "./config.sh" # exit on errors set -e # start main program main "$@" # leave script dir popd > /dev/null