Changeset 75
- Timestamp:
- 04/14/2006 18:15:57 (6 years ago)
- Location:
- confman
- Files:
-
- 1 added
- 2 edited
-
Makefile (modified) (1 diff)
-
confman (modified) (5 diffs)
-
confmandoc.sh (added)
Legend:
- Unmodified
- Added
- Removed
-
confman/Makefile
r72 r75 11 11 install -Sp -o root -g staff -m 0444 confmanlib.sh \ 12 12 $(PREFIX)/lib/confmanlib.sh 13 install -Sp -o root -g staff -m 0444 confmandoc.sh \ 14 $(PREFIX)/lib/confmandoc.sh 13 15 install -Sp -o root -g staff -m 0444 bash_completions \ 14 16 $(PREFIX)/etc/env.d/confman_completions -
confman/confman
r72 r75 40 40 fi 41 41 42 # And the documentation library 43 if [ -f $REPO_DOCS ] ; then 44 . $REPO_DOCS 45 else 46 echo "Error: Couldn't source the confman shell library" >&2 47 exit 1 48 fi 49 42 50 # And we read in the layers that make this host 43 51 if [ -f $RECIPE_PATH ] ; then … … 50 58 # Set a default editor 51 59 if [ -z ${EDITOR} ] ; then 52 EDITOR="vi" 60 if `which vim 2>/dev/null` ; then 61 EDITOR="vim" 62 else 63 EDITOR="vi" 64 fi 53 65 fi 54 66 … … 59 71 # And we'll set a trap: 60 72 trap "cleanexit" SIGINT SIGTERM 61 62 function print_usage {63 cat <<EOF64 $MYNAME provides a command-line interface to Rescomp's server65 configuration management system.66 67 Usage:68 $MYNAME [ help | -h | --help ] [ command ]69 $MYNAME setup70 $MYNAME update71 $MYNAME commit72 $MYNAME diff [ working_copy ]73 $MYNAME log [ working_copy ]74 $MYNAME create module75 $MYNAME rmmod module76 $MYNAME import module livefile77 $MYNAME rm workingfile78 $MYNAME cp src_working_copy dest_working_copy79 $MYNAME mv src_working_copy dest_working_copy80 $MYNAME mkdir workingdirectory81 $MYNAME ls [ workingfile | workingdirectory ]82 $MYNAME chown owner [ workingfile | workingdirectory ]83 $MYNAME chgrp group [ workingfile | workingdirectory ]84 $MYNAME chmod mode [ workingfile | workingdirectory ]85 $MYNAME chcom comment-character [ workingfile | workingdirectory ]86 $MYNAME checklook module87 $MYNAME checknew module name88 $MYNAME checkclear module name89 $MYNAME rollback module [ checkpoint | YYYYMMDD [HHMM] ]90 91 For specific information on a particular $MYNAME subcommand, please run92 $MYNAME help subcommand93 94 eg: $MYNAME help rollback95 96 EOF97 98 exit $199 }100 101 function print_help {102 case $1 in103 se* )104 cat <<EOF105 $MYNAME provides a command-line interface to Rescomp's server106 configuration management system.107 108 Usage:109 $MYNAME setup110 111 The setup command is intended to be run the first time you use $MYNAME.112 It will generate your working copy. setup takes no additional arguments.113 114 EOF115 ;;116 cr* )117 cat <<EOF118 $MYNAME provides a command-line interface to Rescomp's server119 configuration management system.120 121 Usage:122 $MYNAME create module123 124 The create command will cause a new module, named module, to appear as a125 top-level-directory in your working copy. This change will also be made to126 the repositry at the same time.127 128 EOF129 ;;130 rmm* )131 cat <<EOF132 $MYNAME provides a command-line interface to Rescomp's server133 configuration management system.134 135 Usage:136 $MYNAME rmmod module137 This command will delete the specified module from your working copy. Use with138 care.139 EOF140 ;;141 u* )142 cat <<EOF143 $MYNAME provides a command-line interface to Rescomp's server144 configuration management system.145 146 Usage:147 $MYNAME update148 149 The update command will update your working copy of all the modules150 appearing in the current host's recipe file. This command does not alter151 the repository.152 153 EOF154 ;;155 d* )156 cat <<EOF157 $MYNAME provides a command-line interface to Rescomp's server158 configuration management system.159 160 Usage:161 $MYNAME diff [ working_copy ]162 163 Look at the changes you've made to your working copy of a file or directory.164 EOF165 ;;166 lo* )167 cat <<EOF168 $MYNAME provides a command-line interface to Rescomp's server169 configuration management system.170 171 Usage:172 $MYNAME log [ working_copy ]173 174 Look at the log entries for the file or directory specified by working_copy.175 EOF176 ;;177 st* )178 cat <<EOF179 $MYNAME provides a command-line interface to Rescomp's server180 configuration management system.181 182 Usage:183 $MYNAME status [ working_copy ]184 185 Look at the status entries for the file or directory specified by working_copy.186 EOF187 ;;188 cp )189 cat <<EOF190 $MYNAME provides a command-line interface to Rescomp's server191 configuration management system.192 193 Usage:194 $MYNAME cp src_working_copy dest_working_copy195 196 Copy source to destination. Arguments must be working copies.197 EOF198 ;;199 mv )200 cat <<EOF201 $MYNAME provides a command-line interface to Rescomp's server202 configuration management system.203 204 Usage:205 $MYNAME mv src_working_copy dest_working_copy206 207 Move source to destination. Arguments must be working copies.208 EOF209 ;;210 co* )211 cat <<EOF212 $MYNAME provides a command-line interface to Rescomp's server213 configuration management system.214 215 Usage:216 $MYNAME commit217 218 The commit command causes your changes to take effect. This means that219 first, your working copy of all of the modules in the current host's220 recipe will be committed to the repository. This happens after we've run221 a $MYNAME update to prevent out-of-date conflicts. If there are any222 conflicts that require human intervention, the command will fail and exit223 non-zero.224 225 Once $MYNAME is satisfied that all of your changes have been propogated to226 the repository, we will roll-out your working copy to the live filesystem.227 Every module appearing in the host's recipe file will be rolled out IN THE228 ORDER OF APPEARANCE.229 230 EOF231 ;;232 i* )233 cat <<EOF234 $MYNAME provides a command-line interface to Rescomp's server235 configuration management system.236 237 Usage:238 $MYNAME import module livefile239 240 The import subcommand adds the specified file to your working copy of the241 repository.242 243 EOF244 ;;245 rm )246 cat <<EOF247 $MYNAME provides a command-line interface to Rescomp's server configuration248 management system.249 250 Usage:251 $MYNAME rm file252 253 The remove subcommand removes a file from version control It will NOT remove254 the file from the live filesystem.255 256 EOF257 ;;258 mk* )259 cat <<EOF260 $MYNAME provides a command-line interface to Rescomp's server configuration261 management system.262 263 Usage:264 $MYNAME mkdir directory265 266 This command will create a new version-controlled directory in your working267 copy. Parent directories do not have to exist; they will be created268 automagically. This command only affects your working copy. It does not commit269 the change.270 271 EOF272 ;;273 ls )274 cat<<EOF275 $MYNAME provides a command-line interface to Rescomp's server configuration276 management system.277 278 Usage:279 $MYNAME ls [ file | directory ]280 281 The ls subcommand lists out the contents, in modified long form, of the282 current working directory. If a file or directory is specified, it will list283 that instead.284 285 EOF286 ;;287 cho* )288 cat <<EOF289 $MYNAME provides a command-line interface to Rescomp's server configuration290 management system.291 292 Usage:293 $MYNAME chown [ -R ] owner [ file | directory ]294 295 The chown command works like it's unix equivalent. It does not support296 user:group notation. The only option it will take is -R for recursive.297 298 EOF299 ;;300 chg* )301 cat <<EOF302 $MYNAME provides a command-line interface to Rescomp's server configuration303 management system.304 305 Usage:306 $MYNAME chgrp group [ file | directory ]307 308 The chgrp command works like it's unix equivalent. The only option it will take309 is -R for recursive.310 311 EOF312 ;;313 chm* )314 cat <<EOF315 $MYNAME provides a command-line interface to Rescomp's server configuration316 management system.317 318 Usage:319 $MYNAME chmod mode [ file | directory ]320 321 The chmod command works like it's unix equivalent. Note that it will only322 accept octets as permissions -- it will not interpret symbolic permissions323 correctly. The only option it will take is -R for recursive.324 325 EOF326 ;;327 chc* )328 cat <<EOF329 $MYNAME provides a command-line interface to Rescomp's server configuration330 management system.331 332 Usage:333 $MYNAME chcom comment-character [ file | directory ]334 335 The chcom subcommand takes a file or directory as an argument and changes the336 comment string associated with it. This will typically only be useful when337 confman has guessed the comment character of your file incorrectly.338 339 EOF340 ;;341 checkl* )342 cat <<EOF343 $MYNAME provides a command-line interface to Rescomp's server344 configuration management system.345 346 Usage:347 $MYNAME checklook module348 349 The checklook command peeks into the checkpoints for the specified module350 and gives you a listing of current checkpoints with some other cool info.351 This command does not alter the repository.352 353 EOF354 ;;355 checkn* )356 cat <<EOF357 $MYNAME provides a command-line interface to Rescomp's server358 configuration management system.359 360 Usage:361 $MYNAME checknew module name362 363 The newcheck command creates a named checkpoint for the specified module.364 This change is committed to the repository immediately.365 366 EOF367 ;;368 checkc* )369 cat <<EOF370 $MYNAME provides a command-line interface to Rescomp's server371 configuration management system.372 373 Usage:374 $MYNAME checkclear module name375 376 The rmcheck command clears a named checkpoint from the specified module.377 This change is committed to the repository immediately.378 379 EOF380 ;;381 ro* )382 cat <<EOF383 $MYNAME provides a command-line interface to Rescomp's server384 configuration management system.385 386 Usage:387 $MYNAME rollback module [ checkpoint | YYYYMMDD [HHMM] ]388 389 The rollback command first rolls your working copy of module back to the390 named checkpoint. You can optionally roll-back to a specific point in time391 using a date (and optionally time) as specified in the usage statement.392 This change is immediately committed to the repository.393 394 After the rollback is complete, we perform the equivalent of a:395 $MYNAME commit396 397 EOF398 ;;399 * )400 print_usage 1401 ;;402 esac403 exit $2404 }405 73 406 74 … … 472 140 473 141 function import { 142 143 # Check for a force 144 local item OPTIND 145 force=0 146 while getopts "f" opt ; do 147 case $opt in 148 f) 149 force=1 150 shift 151 ;; 152 *) 153 print_help 1 154 ;; 155 esac 156 done 157 474 158 local module=$1 475 local response usefile suffix file 159 local response usefile suffix file layer 476 160 local mode=$DEFAULT_MODE_FILE 477 161 local owner=$DEFAULT_OWNER … … 508 192 "copy of $module." 509 193 cleanexit 194 fi 195 196 if [ $force = 0 ] ; then 197 for layer in $LAYERS ; do 198 if [ -f ${WORK_PATH}/${layer}${file}${suffix} ] ; then 199 echo "$MYNAME: Error: $file already exists in" \ 200 "the ${layer} module." >&2 201 echo "Did you mean -f ?" >&2 202 cleanexit 203 fi 204 done 510 205 fi 511 206
Note: See TracChangeset
for help on using the changeset viewer.
