| 1 | #!@BASH@ |
|---|
| 2 | # |
|---|
| 3 | # Copyright (c) 2008, Christopher Cowart and contributors |
|---|
| 4 | # All rights reserved. |
|---|
| 5 | # |
|---|
| 6 | # Redistribution and use in source and binary forms, with or without |
|---|
| 7 | # modification, are permitted provided that the following conditions |
|---|
| 8 | # are met: |
|---|
| 9 | # * Redistributions of source code must retain the above copyright |
|---|
| 10 | # notice, this list of conditions and the following disclaimer. |
|---|
| 11 | # * Redistributions in binary form must reproduce the above copyright |
|---|
| 12 | # notice, this list of conditions and the following disclaimer in the |
|---|
| 13 | # documentation and/or other materials provided with the distribution. |
|---|
| 14 | # |
|---|
| 15 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|---|
| 16 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|---|
| 17 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|---|
| 18 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|---|
| 19 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|---|
| 20 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED |
|---|
| 21 | # TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
|---|
| 22 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
|---|
| 23 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
|---|
| 24 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
|---|
| 25 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|---|
| 26 | # |
|---|
| 27 | # $Id$ |
|---|
| 28 | # |
|---|
| 29 | |
|---|
| 30 | if [ -r @pkgdatadir@/confmancommon.sh ] ; then |
|---|
| 31 | . @pkgdatadir@/confmancommon.sh |
|---|
| 32 | else |
|---|
| 33 | echo "Can't find confmancommon.sh. Exiting." >&2 |
|---|
| 34 | exit 17 |
|---|
| 35 | fi |
|---|
| 36 | |
|---|
| 37 | # Source the documentation library |
|---|
| 38 | if [ -f $REPO_DOCS_CONFADMIN ] ; then |
|---|
| 39 | . $REPO_DOCS_CONFADMIN |
|---|
| 40 | else |
|---|
| 41 | echo "Couldn't source the confman shell documentation library" >&2 |
|---|
| 42 | exit 1 |
|---|
| 43 | fi |
|---|
| 44 | |
|---|
| 45 | # Set a default editor |
|---|
| 46 | if [ -z ${EDITOR} ] ; then |
|---|
| 47 | EDITOR="vi" |
|---|
| 48 | fi |
|---|
| 49 | |
|---|
| 50 | function repo_setup { |
|---|
| 51 | local short_dirs="/trunk /tags /branches /trunk/checkpoints" |
|---|
| 52 | short_dirs="${short_dirs} /trunk/meta /trunk/meta/recipes" |
|---|
| 53 | local dir dirs |
|---|
| 54 | local msg="Initial confman directory setup." |
|---|
| 55 | if @SVN@ ls "`conf_repo_uri`/trunk/checkpoints" >/dev/null 2>&1 ; then |
|---|
| 56 | echo "It looks like this repository has already been setup." >&2 |
|---|
| 57 | exit 1 |
|---|
| 58 | fi |
|---|
| 59 | for dir in ${short_dirs} ; do |
|---|
| 60 | dirs="${dirs} `conf_repo_uri`/${dir}" |
|---|
| 61 | done |
|---|
| 62 | @SVN@ mkdir -m "$msg" ${dirs} |
|---|
| 63 | } |
|---|
| 64 | |
|---|
| 65 | # Debug mode? |
|---|
| 66 | while getopts "hd" opt ; do |
|---|
| 67 | case $opt in |
|---|
| 68 | d) DEBUG="true" ;; |
|---|
| 69 | h) shift ; print_help "$@" ; conf_cleanExit 0 ;; |
|---|
| 70 | *) print_usage 1 ;; |
|---|
| 71 | esac |
|---|
| 72 | done |
|---|
| 73 | |
|---|
| 74 | # Dispatch the subcommand. This must happen last and in the global context. |
|---|
| 75 | subcommand=$1 |
|---|
| 76 | shift |
|---|
| 77 | |
|---|
| 78 | case $subcommand in |
|---|
| 79 | help ) print_help "$@" ; conf_cleanExit 0 ;; |
|---|
| 80 | setup ) repo_setup ;; |
|---|
| 81 | * ) print_usage 1 ;; |
|---|
| 82 | esac |
|---|
| 83 | |
|---|
| 84 | conf_cleanExit 0 |
|---|
| 85 | |
|---|
| 86 | # vim:ts=4 |
|---|