~ubuntu-branches/ubuntu/trusty/sblim-sfcb/trusty-proposed

« back to all changes in this revision

Viewing changes to sfcbrepos.sh.in

  • Committer: Bazaar Package Importer
  • Author(s): Thierry Carrez
  • Date: 2009-06-08 12:04:49 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090608120449-byfplk09rqz8rtg6
Tags: 1.3.3-0ubuntu1
* New upstream release.
* debian/rules: Removed rpath hacks, SFCB default build handles that now.
* Removed 1934753-remove-assignment.diff, now upstream.
* Refreshed patch cim-schema-location.diff

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
usage() 
4
4
{
5
 
    echo "usage: $0 [-h] [-f] [-c cimschemadir] [-s stagingdir] [-r registrationdir] " 1>&2 
 
5
    echo "usage: $0 [-h] [-f] [-i] [-c cimschemadir] [-s stagingdir] [-r registrationdir] " 1>&2 
6
6
}
7
7
 
8
 
args=`getopt fhs:r:c:X: $*`
 
8
args=`getopt fhis:r:c:X: $*`
9
9
rc=$?
10
10
 
11
11
if [ $rc = 127 ]
27
27
          shift;;
28
28
      -f) force=1
29
29
          shift;;
 
30
      -i) ignore_instances=1
 
31
          shift;;
30
32
      -X) xformat="-b $2"
31
33
          shift 2;;
32
34
      -s) stagingdir=$2
46
48
    usage
47
49
    echo -e "\t-h display help message"
48
50
    echo -e "\t-f force repository creation"
 
51
    echo -e "\t-i do not migrate instances from previous repository (default=do migrate)"
49
52
    echo -e "\t-X create repository in non-native format as specifed by argument"
50
53
    echo -e "\t-s specify staging directory [@localstatedir@/lib/sfcb/stage]"
51
54
    echo -e "\t-r specify repository directory [@localstatedir@/lib/sfcb/registration]"
57
60
 
58
61
if [ -z "$force" ]
59
62
then 
60
 
    echo Setting up sfcb Repository, Class and Provider Registration
 
63
    echo Setting up sfcb Repository, Class, and Provider Registration
61
64
    echo Your old repository and registration data will be deleted
62
 
    echo Do you want to proceed "(type yes to continue)"
 
65
    echo -n "(static instances will "
 
66
    if [ $ignore_instances ]
 
67
    then    echo -n "NOT "
 
68
    fi
 
69
    echo "be saved)"
 
70
    echo Do you want to proceed? "(type yes to continue)"
63
71
 
64
72
    read response
65
73
 
138
146
    fi
139
147
    
140
148
    # Compile all staged namespace directories
 
149
    instmigfile=/tmp/sfcbinst.mof
141
150
    mofsubdirs=`find $stagingdir/mofs/* -type d -print 2> /dev/null`
142
151
    if ls $stagingdir/mofs/*.mof > /dev/null 2>&1
143
152
    then
152
161
            namespace=`echo $mofdir | sed s?$stagingdir/mofs/??`
153
162
            repositorydir=$registrationdir/repository/
154
163
            [ -d $repositorydir ] || mkdir -p $repositorydir
155
 
            if ! sfcbmof -d $repositorydir -n $namespace -o classSchemas -I $cimschemadir -i CIM_Schema.mof $xformat $mofdir/*.mof $globalmofs
 
164
 
 
165
        #grab all non-mof static instances, output to /tmp/sfcbinst.mof
 
166
        if [ -z "$ignore_instances" ]
 
167
        then
 
168
            rm -f $instmigfile 2> /dev/null
 
169
            #get class names (from filenames), ignoring specific files, from repos.previous, as it's already been moved
 
170
            if [ -e $registrationdir/repository.previous/$namespace/ ]
 
171
            then
 
172
                static_inst_files=`ls $registrationdir/repository.previous/$namespace/ -I classSchemas -I qualifiers -I *.idx` > /dev/null 2>&1
 
173
                for instfile in $static_inst_files
 
174
                do
 
175
                    sfcbinst2mof -n $namespace -c $instfile -o $instmigfile -r $registrationdir/repository.previous/ -g ${DESTDIR}@sysconfdir@/sfcb/sfcb.cfg 2> /dev/null
 
176
                done
 
177
            fi
 
178
        fi
 
179
        if [ -e $instmigfile ]
 
180
        then
 
181
            instmigopt="-m $instmigfile"
 
182
        else
 
183
            instmigopt=""
 
184
        fi
 
185
            if ! sfcbmof -d $repositorydir -n $namespace -o classSchemas -I $cimschemadir -i CIM_Schema.mof $xformat $instmigopt $mofdir/*.mof $globalmofs
156
186
            then
157
 
                echo Failed compiling the MOF files. >&2
158
 
                exit 1
 
187
            rm -f $instmigfile 2> /dev/null
 
188
                    echo Failed compiling the MOF files. >&2
 
189
                    exit 1
159
190
            fi
 
191
        if [ -e $instmigfile ]
 
192
        then
 
193
            rm -f $instmigfile 2> /dev/null
 
194
        fi
160
195
        fi
161
196
    done
162
197