Changeset 587
- Timestamp:
- 12/23/2011 15:18:16 (5 months ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
confman.8.in (modified) (1 diff)
-
confman.in (modified) (2 diffs)
-
confmandoc.sh (modified) (1 diff)
-
confmanlib.sh.in (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/confman.8.in
r569 r587 310 310 directories do not have to exist; they will be created automatically. This 311 311 command only affects your working copy. It does not commit the change. 312 .It Cm touch Ar file 313 Create a new version-controlled file in your working copy. Parent directories 314 must exist. This command only affects your working copy. It does not commit the 315 change. 312 316 .It Cm revert Ar 313 317 Restore the working copy files to the state before you began making edits. -
trunk/confman.in
r554 r587 654 654 } 655 655 656 function cnf_touch { 657 local file="$1" 658 659 local owner="${DEFAULT_OWNER}" 660 local group="${DEFAULT_GROUP}" 661 local mode="${DEFAULT_MODE_FILE}" 662 local comment="${DEFAULT_COMMENT}" 663 local wcopy_lock 664 local livefile 665 666 if [ -z "${file}" ]; then 667 print_usage 1 668 fi 669 670 wcopy_lock=$(conf_lock_wcopy) 671 672 # Resolve the absolute path to the file 673 file="$("${ABSPATH}" .)/${file}" 674 675 # If the filename doesn't begin with WORK_PATH, we can't operate here 676 if [ "${file#${WORK_PATH}}" = "${file}" ]; then 677 echo "Cannot operate on non-working-copy file: ${file}" >&4 678 fi 679 680 module=${file#${WORK_PATH}/} 681 module=${module%%/*} 682 livefile="/${file#${WORK_PATH}/*/}" 683 684 # If it exists on the live filesystem, pull the attributes from there 685 if [ -f "${livefile}" ]; then 686 eval `$SUDO ${stat_cmd} "${stat_opts}" "${livefile}"` 687 688 # TODO: Guess the comment character too 689 690 # Convert mode string to base 10: 691 mode=`echo "obase=10;ibase=8;${mode}" | bc` 692 # And use a bitmask to subtract off all write-access 693 # 3949d = 7555o 694 mode=$((${mode} & 3949)) 695 # And back to an octet: 696 mode=`printf '%04o\n' ${mode}` 697 698 echo "Touching file ${livefile} with ${owner}:${group}, ${mode}, comment string ${comment}" 699 conf_gen_file "${module}" "${livefile}" "${owner}" "${group}" "${mode}" "${comment}" "" "" 700 701 # Otherwise, prompt for attributes 702 else 703 # Prompt for file owner 704 echo "Who should be the file's owner? [ ${owner} ]" 705 read response 706 if [ -n "${response}" ]; then 707 owner="${response}" 708 fi 709 710 # Prompt for file group 711 echo "Who should be the file's group? [ ${group} ]" 712 read response 713 if [ -n "${response}" ]; then 714 group="${response}" 715 fi 716 717 # Prompt for file mode 718 echo "What should the file's permissions be? [ ${mode} ]" 719 read response 720 if [ -n "${response}" ]; then 721 mode="${response}" 722 fi 723 724 # Prompt for file comment 725 echo "What string starts comment lines? [ ${comment} ]" 726 read response 727 if [ -n "${response}" ]; then 728 comment="${response}" 729 fi 730 731 echo "Touching file ${livefile} with ${owner}:${group}, ${mode}, comment string ${comment}" 732 conf_gen_file "${module}" "${livefile}" "${owner}" "${group}" "${mode}" "${comment}" "" "" 733 fi 734 735 conf_unlock_wcopy "${wcopy_lock}" 736 } 737 656 738 function list { 657 739 local file item … … 1271 1353 rmmod ) rmmod "$@" ;; 1272 1354 mkdir|mkd* ) newdir "$@" ;; 1355 touch ) cnf_touch "$@" ;; 1273 1356 list|ls ) list "$@" ;; 1274 1357 link|ln ) mklink "$@" ;; -
trunk/confmandoc.sh
r512 r587 58 58 $MYNAME mv src_working_copy dest_working_copy 59 59 $MYNAME mkdir workingdirectory 60 $MYNAME touch workingfile 60 61 $MYNAME revert workingfile 61 62 $MYNAME chown owner [ workingfile | workingdirectory ] -
trunk/confmanlib.sh.in
r585 r587 1034 1034 echo $file 1035 1035 1036 if [ -z $usefile] ; then1036 if [ -z "${usefile}" ] ; then 1037 1037 echo -e "${warning}\n${morewarn}\n${revision}\n" > $myfile 1038 1038 elif head -n 1 ${usefile} | grep '^#!' >/dev/null ; then
Note: See TracChangeset
for help on using the changeset viewer.
