Changeset 464
- Timestamp:
- 10/12/2009 20:15:29 (3 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
confman.8.in (modified) (6 diffs)
-
confman.in (modified) (12 diffs)
-
confmandoc.sh (modified) (3 diffs)
-
confmanlib.sh.in (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/confman.8.in
r463 r464 97 97 .El 98 98 .Ss FLAGS 99 .Bl -tag -width "FLAGS " 100 .It Global flags 99 101 The following flags can be specified before the commands: 100 102 .Bl -tag -width indent … … 107 109 .Nm 108 110 to print the version string and exit. 111 .El 112 .It Log flags 113 The following flags can be used where 114 .Ar log_flags 115 appears in the usage statements (See 116 .Sx COMMANDS ) : 117 .Bl -tag -width indent 109 118 .It Fl m Ar message 110 119 The string in the … … 121 130 .Ar filename 122 131 instead of the command line. 132 .El 123 133 .El 124 134 .Ss COMMANDS … … 150 160 that will cause the latest repository revision to be reflected in your working 151 161 copy. command does not alter the repository or the system. 152 .It Cm commit 162 .It Cm commit Oo log_flags Oc 153 163 The commit command causes your changes to take effect. 154 164 .Bl -bullet … … 196 206 working copy of 197 207 .Ar module . 198 .It Cm install Ar208 .It Cm install Oo Ar log_flags Oc Ar 199 209 Roll out the specified working files and directories to the live filesystem. 200 210 Note that recipe ordering will be respected, so using install in a low-priority 201 211 module will still cause the highest priority module's copy of the file to 202 212 ultimately be installed. 203 .It Cm status [ Ar working_copy ]213 .It Cm status Oo Ar working_copy Oc 204 214 Look at the status entries for the file or directory specified by 205 215 .Ar working_copy . … … 208 218 .It Cm recipe 209 219 .Brq Cm get | list 210 .It Cm recipe create Oo Fl R Ar filename Oc Ar recipe220 .It Cm recipe create Oo Fl R Ar filename Oc Oo Ar log_flags Oc Ar recipe 211 221 .It Cm recipe print Oo Ar recipe Oc 212 .It Cm recipe Bro Cm edit | remove | set Brc Ar recipe 222 .It Cm recipe Bro Cm edit | remove Brc Oo Ar log_flags Oc Ar recipe 223 .It Cm recipe set Ar recipe 213 224 .Bl -tag -width indent 214 225 .It Cm create -
trunk/confman.in
r463 r464 185 185 186 186 function commit { 187 if [ -z "$*" ] ; then 188 conf_require_recipe 189 conf_lock_system 190 conf_lock_wcopy 191 local msg status modules module modpath 192 local nocommit=true 193 194 for module in $(conf_get_recipe) ; do 195 modpath=$(${readlink_cmd} -m ${WORK_PATH}/${module}) 196 modules=${modules:+${modules} }${modpath} 197 done 198 199 $SUDO ${SUDO:+-v} 200 conf_update_tree || conf_cleanExit 201 202 if status=$(get_status $modules) ; then 203 nocommit=false 204 msg=$(get_log "$status") || conf_cleanExit 205 rm -f "$status" 206 fi 207 208 $SUDO ${SUDO:+-v} 209 210 echo "Commit operation started" >&2 211 $nocommit || conf_commit "$(conf_get_recipe)" $msg || return $? 212 for layer in $(conf_get_recipe) ; do 213 echo "Rolling on $layer..." 214 conf_rollout $layer || return $? 215 done 216 for file in $SINGULARITIES ; do 217 conf_assemble_sing $file || return $? 218 done 219 conf_recordAction commit 220 conf_markclean 221 echo "Commit operation finished successfully" >&2 222 rm -f $msg 223 conf_unlock_wcopy 224 conf_unlock_system 225 else 226 print_usage 1 227 fi 187 local msg status modules module modpath 188 local nocommit=true 189 local opt OPTIND OPTARG 190 191 while getopts ":m:F:" opt ; do 192 case $opt in 193 m) LOG_MESSAGE="$OPTARG"; LOG_MESSAGE_SET="true" ;; 194 F) LOG_FILE="$OPTARG" ;; 195 *) echo "Invalid option '-${OPTARG}'." >&4 196 print_usage 1 197 ;; 198 esac 199 done 200 shift $(($OPTIND - 1)) 201 202 [ -z "$1" ] || print_usage 1 203 204 conf_require_recipe 205 conf_lock_system 206 conf_lock_wcopy 207 208 for module in $(conf_get_recipe) ; do 209 modpath=$(${readlink_cmd} -m ${WORK_PATH}/${module}) 210 modules=${modules:+${modules} }${modpath} 211 done 212 213 $SUDO ${SUDO:+-v} 214 conf_update_tree || conf_cleanExit 215 216 if status=$(get_status $modules) ; then 217 nocommit=false 218 msg=$(get_log "$status") || conf_cleanExit 219 rm -f "$status" 220 fi 221 222 $SUDO ${SUDO:+-v} 223 224 echo "Commit operation started" >&2 225 $nocommit || conf_commit "$(conf_get_recipe)" $msg || return $? 226 for layer in $(conf_get_recipe) ; do 227 echo "Rolling on $layer..." 228 conf_rollout $layer || return $? 229 done 230 for file in $SINGULARITIES ; do 231 conf_assemble_sing $file || return $? 232 done 233 conf_recordAction commit 234 conf_markclean 235 echo "Commit operation finished successfully" >&2 236 rm -f $msg 237 conf_unlock_wcopy 238 conf_unlock_system 228 239 } 229 240 … … 231 242 function inst { 232 243 local file livefile 233 234 if [ -z "$*" ] ; then 235 print_usage 1 236 else 237 conf_require_recipe 238 conf_lock_wcopy 239 conf_lock_system 240 local msg status files file 241 local nocommit=true 242 243 for file in "$@"; do 244 files="${files:+${files} }$(${readlink_cmd} -m "$file")" 245 done 246 247 248 $SUDO ${SUDO:+-v} 249 conf_update_tree || conf_cleanExit 250 251 if status=$(get_status $files) ; then 252 nocommit=false 253 msg=$(get_log "$status") || conf_cleanExit 254 rm -f "$status" 255 fi 256 257 echo "Installation operation started." >&2 258 $nocommit || conf_commit_file "$msg" "$files" || return $? 259 for layer in $(conf_get_recipe) ; do 260 conf_install $layer "$@" 261 done 262 for file in $SINGULARITIES ; do 263 conf_assemble_sing $file || conf_cleanExit 264 done 265 conf_recordAction install 266 if ! conf_isclean ; then 267 echo "WARNING: Recent 'install' operations prevented a 'sync'" >&2 268 echo "Running a 'commit' is highly recommended." >&2 269 fi 270 echo "Installation operation succeeded." >&2 271 conf_unlock_wcopy 272 conf_unlock_system 273 fi 244 local msg status files file 245 local nocommit=true 246 local opt OPTIND OPTARG 247 248 while getopts ":m:F:" opt ; do 249 case $opt in 250 m) LOG_MESSAGE="$OPTARG"; LOG_MESSAGE_SET="true" ;; 251 F) LOG_FILE="$OPTARG" ;; 252 *) echo "Invalid option '-${OPTARG}'." >&4 253 print_usage 1 254 ;; 255 esac 256 done 257 shift $(($OPTIND - 1)) 258 259 conf_require_recipe 260 conf_lock_wcopy 261 conf_lock_system 262 263 for file in "$@"; do 264 files="${files:+${files} }$(${readlink_cmd} -m "$file")" 265 done 266 267 268 $SUDO ${SUDO:+-v} 269 conf_update_tree || conf_cleanExit 270 271 if status=$(get_status $files) ; then 272 nocommit=false 273 msg=$(get_log "$status") || conf_cleanExit 274 rm -f "$status" 275 fi 276 277 echo "Installation operation started." >&2 278 $nocommit || conf_commit_file "$msg" "$files" || return $? 279 for layer in $(conf_get_recipe) ; do 280 conf_install $layer "$@" 281 done 282 for file in $SINGULARITIES ; do 283 conf_assemble_sing $file || conf_cleanExit 284 done 285 conf_recordAction install 286 if ! conf_isclean ; then 287 echo "WARNING: Recent 'install' operations prevented a 'sync'" >&2 288 echo "Running a 'commit' is highly recommended." >&2 289 fi 290 echo "Installation operation succeeded." >&2 291 conf_unlock_wcopy 292 conf_unlock_system 274 293 } 275 294 … … 935 954 936 955 function recipe_edit { 956 local recipe 957 local new_recipe_file recipe_file 958 local repeat msg status 959 local opt OPTIND OPTARG 960 961 while getopts ":m:F:" opt ; do 962 case $opt in 963 m) LOG_MESSAGE="$OPTARG"; LOG_MESSAGE_SET="true" ;; 964 F) LOG_FILE="$OPTARG" ;; 965 *) echo "Invalid option '-${OPTARG}'." >&4 966 print_usage 1 967 ;; 968 esac 969 done 970 shift $(($OPTIND - 1)) 971 972 echo "$@" >&2 973 937 974 if [ -z "$1" ] ; then print_usage 1 ; fi 938 local recipe="$1" 939 local new_recipe_file=$(conf_tmp_file) 940 local recipe_file=$(conf_recipe_dir)/${recipe} 941 local repeat msg status 975 976 conf_lock_wcopy 977 recipe="$1" 978 recipe_file=$(conf_recipe_dir)/${recipe} 979 new_recipe_file=$(conf_tmp_file) 942 980 943 981 cat "$recipe_file" > "$new_recipe_file" … … 956 994 if status=$(get_status "${recipe_file#${WORK_PATH}/}") ; then 957 995 msg=$(get_log "$status") || return 1 958 conf_commit_recipe "$ recipe" "$msg"996 conf_commit_recipe "$msg" "$recipe" 959 997 fi 960 998 rm -f "$new_recipe_file" 999 conf_unlock_wcopy 961 1000 } 962 1001 963 1002 function recipe_create { 964 1003 local recipe recipe_file opt OPTIND msg status 965 local recipe_file 966 while getopts ":R:" opt ; do 1004 while getopts ":m:F:R:" opt ; do 967 1005 case $opt in 968 1006 R) new_recipe_file="$OPTARG" ;; 1007 m) LOG_MESSAGE="$OPTARG"; LOG_MESSAGE_SET="true" ;; 1008 F) LOG_FILE="$OPTARG" ;; 969 1009 *) echo "Invalid option '-${OPTARG}' for recipe create." >&4 970 1010 print_usage 1 … … 972 1012 esac 973 1013 done 974 975 eval recipe=\$$OPTIND 976 recipe_file=$(conf_recipe_dir)/${recipe}1014 shift $(($OPTIND - 1)) 1015 1016 eval recipe=$1 977 1017 978 1018 if [ -z "$recipe" ] ; then … … 980 1020 fi 981 1021 1022 conf_lock_wcopy 1023 recipe_file=$(conf_recipe_dir)/${recipe} 982 1024 conf_recipe_create "$recipe" || return 1 983 1025 … … 985 1027 if ! recipe_edit "$recipe" ; then 986 1028 conf_rm_file --force "${new_recipe_file}" 1029 conf_unlock_wcopy 987 1030 return 1 988 1031 fi 1032 conf_unlock_wcopy 989 1033 return 0 990 1034 fi … … 994 1038 if status=$(get_status "${recipe_file#${WORK_PATH}/}") ; then 995 1039 msg=$(get_log "$status") || return 1 996 conf_commit_recipe "$ recipe" "$msg"1040 conf_commit_recipe "$msg" "$recipe" 997 1041 fi 1042 conf_unlock_wcopy 998 1043 return 0 999 1044 else 1000 1045 conf_rm_file --force "${recipe_file}" 1046 conf_unlock_wcopy 1001 1047 return 1 1002 1048 fi … … 1004 1050 1005 1051 function recipe_remove { 1006 if [ -z "$*" ] ; then print_usage 1 ; fi 1052 local opt OPTIND OPTARG 1053 local msg status recipes recipe 1054 local nocommit=true 1055 while getopts ":m:F:" opt ; do 1056 case $opt in 1057 m) LOG_MESSAGE="$OPTARG"; LOG_MESSAGE_SET="true" ;; 1058 F) LOG_FILE="$OPTARG" ;; 1059 *) echo "Invalid option '-${OPTARG}'." >&4 1060 print_usage 1 1061 ;; 1062 esac 1063 done 1064 shift $(($OPTIND - 1)) 1065 1066 conf_lock_wcopy 1067 1007 1068 conf_remove_recipes "$@" || exit 1 1069 1070 for recipe in "$@" ; do 1071 recipes="${recipes:+${recipes} }$(conf_recipe_dir)/${recipe}" 1072 done 1073 1074 if status=$(get_status $recipes) ; then 1075 nocommit=false 1076 msg=$(get_log "$status") || conf_cleanExit 1077 rm -f "$status" 1078 fi 1079 1080 $nocommit || conf_commit_recipes "$msg" "$@" 1081 1082 conf_unlock_wcopy 1008 1083 } 1009 1084 … … 1022 1097 exit 1 1023 1098 fi 1099 conf_lock_wcopy 1100 conf_lock_system 1024 1101 conf_set_recipe "$recipe" 1102 conf_unlock_system 1103 conf_unlock_wcopy 1025 1104 } 1026 1105 … … 1041 1120 1042 1121 function recipe_list { 1043 cd $(conf_recipe_dir) 1044 ls 1122 ( 1123 cd $(conf_recipe_dir) 1124 ls 1125 ) 1045 1126 } 1046 1127 … … 1065 1146 1066 1147 # Debug mode? 1067 while getopts ":h:dv m:F:-" opt ; do1148 while getopts ":h:dv-" opt ; do 1068 1149 case $opt in 1069 1150 d) DEBUG="true" ;; 1070 1151 h) print_help "$OPTARG" ; conf_cleanExit 0 ;; 1071 1152 v) print_version ; conf_cleanExit 0 ;; 1072 m) LOG_MESSAGE="$OPTARG"; LOG_MESSAGE_SET="true" ;;1073 F) LOG_FILE="$OPTARG" ;;1074 1153 *) echo "Invalid options '-${OPTARG}'." >&4 1075 1154 print_usage 1 -
trunk/confmandoc.sh
r463 r464 224 224 225 225 Usage: 226 $MYNAME [ -F filename | -m message ] commit226 $MYNAME commit [ -F filename | -m message ] 227 227 228 228 The commit command causes your changes to take effect. This means that … … 260 260 261 261 Usage: 262 $MYNAME [-F filename | -m message] installworkingfile [workingfile [...]]262 $MYNAME install [-F filename | -m message] workingfile [workingfile [...]] 263 263 264 264 The install subcommand allows you to roll out a single file from your working … … 502 502 $MYNAME recipe [ get | list ] 503 503 $MYNAME recipe print [ recipe_name ] 504 $MYNAME recipe [ create | edit | print | remove | set ] recipe_name 504 $MYNAME recipe set recipe_name 505 $MYNAME recipe [ create | edit | remove ] [ -F file | -m msg ] recipe_name 505 506 506 507 The recipe command provides an interface to manage confman recipes. -
trunk/confmanlib.sh.in
r462 r464 980 980 } 981 981 982 function conf_commit_recipe { 983 local recipe="$1" 984 local logfile="$2" 985 @SVN@ commit -F "$logfile" "$(conf_recipe_dir)/${recipe}" 982 function conf_commit_recipes { 983 local recipe recipes 984 985 local logfile="$1" 986 shift 987 988 for recipe in "$@" ; do 989 recipes="${recipes:+${recipes} }$(conf_recipe_dir)/${recipe}" 990 done 991 992 @SVN@ commit -F "$logfile" $recipes 986 993 } 987 994 988 995 function conf_remove_recipes { 989 local recipe 996 local recipe recipe_file 990 997 local oldrecipes 991 998 local rc=0 … … 993 1000 for recipe in "$@"; do 994 1001 if conf_remove_recipe "$recipe"; then 995 # Keep track of the recipes that were successfully removed 996 # to avoid inadvertent commits 997 if [ -z "$oldrecipes" ]; then 998 oldrecipes="$recipe" 999 else 1000 oldrecipes="$oldrecipes,$recipe" 1001 fi 1002 recipe_file="$(conf_recipe_dir)/${recipe}" 1003 oldrecipes="${oldrecipes:+${oldrecipes} }${recipe_file}" 1002 1004 else 1003 1005 rc=1 1004 1006 fi 1005 1007 done 1006 1007 # $oldrecipes is in the form foo,bar,baz. This eval trick forces1008 # curly brace expansion.1009 if echo "$oldrecipes" | grep -q ','; then1010 @SVN@ commit $(eval echo $(conf_recipe_dir)/{$oldrecipes})1011 else1012 @SVN@ commit "$(conf_recipe_dir)/$oldrecipes"1013 fi1014 1008 1015 1009 return $rc
Note: See TracChangeset
for help on using the changeset viewer.
