diff options
author | root <root@dev.spline.de> | 2008-10-17 16:05:52 +0200 |
---|---|---|
committer | root <root@dev.spline.de> | 2008-10-17 16:05:52 +0200 |
commit | fb2f15e2bed219a9bd06cf851898d7213f69a765 (patch) | |
tree | 0708bf1e2c2abdc80497de8fc6d4beea5dbb2124 | |
parent | 8807ed07091e28a266aade53140b7dd4ab3f2da8 (diff) | |
download | dev-scripts-fb2f15e2bed219a9bd06cf851898d7213f69a765.tar.gz dev-scripts-fb2f15e2bed219a9bd06cf851898d7213f69a765.tar.xz dev-scripts-fb2f15e2bed219a9bd06cf851898d7213f69a765.zip |
add script to open project
-rwxr-xr-x | bin/openproject | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/bin/openproject b/bin/openproject new file mode 100755 index 0000000..faa29ca --- /dev/null +++ b/bin/openproject @@ -0,0 +1,62 @@ +#!/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 [[ -z $(dbquery "SELECT id FROM project WHERE project_name = '${project_name}'") ]] + then + eerror "Project ${project_name} does not exists." + fi + + svn_home=${SVN_ROOT}/${project_name} + trac_home=${TRAC_ROOT}/${project_name} + trac_db=trac_${project_name} + + eheading "setting trac permissions" + 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 add anonymous ${perm} + done + + # apply changes to /etc/apache2/vhosts.d/dev_vhost.include + eexec sed -i -e "s/Use SVNProjectClosed ${project_name}/Use SVNProject ${project_name}/" /etc/apache2/vhosts.d/dev_vhost.include + 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 "opened project ${project_name}" + popd > /dev/null +} + +# 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 |