Ticket #6772: cpsvndir_themes.patch

File cpsvndir_themes.patch, 1.1 KB (added by mythtv@…, 13 years ago)
  • cpsvndir

     
    22#
    33# cpsvndir: recursive directory copy excluding .svn sub dirs.
    44
    5 DESTDIR=$2
    6 SOURCE=$(basename "$1")
    75
    86if [ -z "$1" -o -z "$2" ]; then
    97    echo "Usage: $0 source-dir destination-dir"
     
    1715    if [ -z "$EUID" ];     then EUID=0       ;fi  # Will fail if not root
    1816fi
    1917
     18# Build directory structure
     19IFS=$'\012'
     20for directory in $(find "$1" -path '*/.svn' -prune -or -type d -print); do
     21    mkdir -p "$2/${1##*/}/${directory/#$1}"
     22done
    2023
    21 mkdir -p $DESTDIR/$SOURCE || exit 1
     24# Copy files
     25for file in $(find "$1" -path '*/.svn' -prune -or ! -type d -print); do
     26    cp -a "$file" "$2/${1##*/}/${file/#$1}"
     27    chown $EUID "$2/${1##*/}/${file/#$1}"
     28    chmod +r "$2/${1##*/}/${file/#$1}"
     29done
    2230
    23 find $SOURCE -path '*/.svn' -prune -or -type d -exec mkdir -p $DESTDIR/{} \;
    24 find $SOURCE -path '*/.svn' -prune -or ! -type d \
    25              -exec cp -p {}    $DESTDIR/{} \; \
    26              -exec chown $EUID $DESTDIR/{} \; \
    27              -exec chmod +r    $DESTDIR/{} \;
    28 
    29 
    3031exit 0