Ticket #6772: cpsvndir_themes3.patch

File cpsvndir_themes3.patch, 1.7 KB (added by mythtv@…, 13 years ago)
  • themes.pro

     
    77TEMPLATE = app
    88CONFIG -= moc qt
    99
    10 !macx:QMAKE_COPY_DIR = sh ./cpsvndir
     10QMAKE_COPY_DIR = sh ./cpsvndir
    1111
    1212themes.path = $${PREFIX}/share/mythtv/themes/
    1313themes.files  = ProjectGrayhem ProjectGrayhem-wide ProjectGrayhem-OSD
  • 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# Do similarly for EGID
     19if [ -z "$EGID" ]; then
     20    if [ -x /usr/bin/id ]; then EGID=`id -g` ;fi
     21    if [ -z "$EGID" ];     then EGID=0       ;fi  # Will fail if not root
     22fi
    2023
    21 mkdir -p $DESTDIR/$SOURCE || exit 1
     24# Build directory structure
     25IFS=$'\012'
     26for directory in $(find "$1" -path '*/.svn' -prune -or -type d -print); do
     27    mkdir -p "$2/${1##*/}/${directory/#$1}"
     28done
    2229
    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/{} \;
     30# Copy files
     31for file in $(find "$1" -path '*/.svn' -prune -or ! -type d -print); do
     32    cp -pR "$file" "$2/${1##*/}/${file/#$1}"
     33    chown $EUID:$EGID "$2/${1##*/}/${file/#$1}" &> /dev/null
     34    chmod +r "$2/${1##*/}/${file/#$1}" &> /dev/null
     35done
    2836
    29 
    3037exit 0