source: branches/confman-1.9/confadmin.in @ 556

Revision 556, 2.8 KB checked in by blee, 5 months ago (diff)

Merge fix for #114 into confman-1.9.

Closes #114

  • Property svn:executable set to *
  • Property svn:keywords set to Id
Line 
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
30if [ -r @pkgdatadir@/confmancommon.sh ] ; then
31    . @pkgdatadir@/confmancommon.sh
32else
33    echo "Can't find confmancommon.sh. Exiting." >&2
34    exit 17
35fi
36
37# Source the documentation library
38if [ -f $REPO_DOCS_CONFADMIN ] ; then
39        . $REPO_DOCS_CONFADMIN
40else
41    echo "Couldn't source the confman shell documentation library" >&2
42        exit 1
43fi
44
45# Set a default editor
46if [ -z ${EDITOR} ] ; then
47    EDITOR="vi"
48fi
49
50function 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?
66while 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
72done
73
74# Dispatch the subcommand. This must happen last and in the global context.
75subcommand=$1
76shift
77
78case $subcommand in
79    help )                          print_help "$@" ; conf_cleanExit 0 ;;
80    setup )                         repo_setup ;;
81    * )                             print_usage 1 ;;
82esac
83
84conf_cleanExit 0
85
86# vim:ts=4
Note: See TracBrowser for help on using the repository browser.