Changeset 461


Ignore:
Timestamp:
10/07/2009 23:40:21 (3 years ago)
Author:
ccowart
Message:

Merging link fixes from trunk.

Fixes #51

Location:
branches/confman-1.9
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/confman-1.9

  • branches/confman-1.9/confman.8.in

    r455 r461  
    244244.Ar destination .  
    245245Arguments must be working copies. 
     246.It Cm link [ Fl f ] Ar target link_name  
     247The link command creates a symbolic link (See  
     248.Xr ln 1) pointing to the  
     249.Ar target  
     250file or directory. If  
     251.Ar link_name  
     252is a  
     253directory, the link will be created with the same  
     254.Xr basename 1 as  
     255.Ar target .  
     256The most common use of repository symlinks is to reconcile path differences 
     257between operatings systems. You can create freebsd/usr/local/etc/sudoers as 
     258a normal file. You can then create the link linux/etc/sudoers to point 
     259to the former file (in the freebsd module). This allows you to have a 
     260single copy of the file in different locations for different modules. 
    246261.It Cm mkdir Ar directory 
    247262Create a new version-controlled directory in your working copy. Parent 
     
    362377.Pp 
    363378And our host-specific configurations in the marvin portion 
    364 (www/etc/rc.conf-marvin): 
     379(marvin/etc/rc.conf-marvin): 
    365380.Pp 
    366381.Dl apache22_enable="YES" 
  • branches/confman-1.9/confmanlib.sh.in

    r459 r461  
    544544    local link=$2 
    545545    local forced=$3 
    546     local opts isdir 
    547     local WD=`pwd` 
     546    local opts isdir linkdir rtarget rlink 
    548547 
    549548    if [ "$forced" == "true" ] ; then 
     
    554553    fi 
    555554 
    556     if [ -d "$link" ]; then 
    557         isdir="true" 
    558         if [[ "$link" =~ /$ ]]; then 
    559             link=${link%\/} 
    560         fi 
    561     fi 
    562  
    563     ABS_WORK=`${readlink_cmd} -m $WORK_PATH` 
     555    if [ -d "$link" ] ; then 
     556        link="${link}/$(basename "${target}")" 
     557    fi 
     558 
     559    # target needs to be transformed to be relative to the link. In order 
     560    # to do this, we need to cannonicalize filenames relative to the 
     561    # working copy root 
     562 
     563    ABS_WORK=$(${readlink_cmd} -m "$WORK_PATH") 
    564564    target=`${readlink_cmd} -m $target` 
    565     target=${target/$ABS_WORK\//} 
    566     WD="${WD/$ABS_WORK\//}/" 
     565    rtarget=${target#${ABS_WORK}/} 
     566 
     567    if [ "$target" = "$rtarget" ] ; then 
     568        echo "target $target does not appear to be in your working copy." >&4 
     569        return 1 
     570    fi 
     571 
    567572    link=`${readlink_cmd} -m $link` 
    568  
    569     while [[ ${WD} =~ "^.+/" ]]; do 
    570         target="../$target" 
    571         WD=${WD#*/} 
     573    rlink="${link#${ABS_WORK}/}" 
     574 
     575    if [ "$link" = "$rlink" ] ; then 
     576        echo "link $link does not appear to be in your working copy." >&4 
     577        return 1 
     578    fi 
     579 
     580    linkdir="${rlink%/*}/" 
     581 
     582    while [[ ${linkdir} =~ ^.+/ ]]; do 
     583        rtarget="../$rtarget" 
     584        linkdir=${linkdir#*/} 
    572585    done 
    573586 
    574     if [ -n "$isdir" ] ; then 
    575         link="${link}/${target/*\//}" 
    576     fi 
    577  
    578     ln -s $opts "$target" "$link" 
    579     @SVN@ add "$link" 
     587    ln -s $opts "$rtarget" "${WORK_PATH}/$rlink" 
     588    @SVN@ add "${WORK_PATH}/$rlink" 
    580589} 
    581590 
Note: See TracChangeset for help on using the changeset viewer.