David C. Rankin
2009-Mar-14 21:44 UTC
AARGH! I can't make rsync not copy dirs with --files-from option
Listmates I'm running rsync 3.02 and I have a simple thing I'm trying to do, but rsync won't let me do it. What I'm trying to do is consolidate saved rpms on openSuSE 11.0 to a central server for local updates. openSuSE saves the rpms in: /var/cache/zypp/packages/<repository name> I have written a script that parses all the file names and creates temp files that holds the full path to the rpms. The rpms are separated into 5 files which are used to categorize the rpms (delta i586 noarch src x86_64). An example of the file contents is: 17:34 alchemy:~/linux/scripts/config/zypp> tail -n3 /tmp/zyppcon/* ==> /tmp/zyppcon/delta <=/var/cache/zypp/packages/openSUSE-11.0-Updates/rpm/x86_64/satsolver-tools-0.9.5_0.9.6-0.1.x86_64.delta.rpm /var/cache/zypp/packages/openSUSE-11.0-Updates/rpm/x86_64/glibc-info-2.8-14.1_14.2.x86_64.delta.rpm /var/cache/zypp/packages/openSUSE-11.0-Updates/rpm/i586/flash-player-9.0.151.0_9.0.152.0-0.1.i586.delta.rpm ==> /tmp/zyppcon/i586 <=/var/cache/zypp/packages/kde/i586/kdebase3-nsplugin-3.5.10-40.3.i586.rpm /var/cache/zypp/packages/kde/i586/kdebase3-nsplugin-3.5.10-97.3.i586.rpm /var/cache/zypp/packages/kde/i586/kdebase3-nsplugin-3.5.10-40.2.i586.rpm ==> /tmp/zyppcon/noarch <=/var/cache/zypp/packages/tools/noarch/inst-source-utils-2009.1.25-2.3.noarch.rpm /var/cache/zypp/packages/tools/noarch/build-2009.02.20-30.2.noarch.rpm /var/cache/zypp/packages/backports/noarch/digikam-doc-0.9.4-3.2.noarch.rpm ==> /tmp/zyppcon/src <=/var/cache/zypp/packages/multimedia-photo/src/exiftool-7.56-1.1.src.rpm /var/cache/zypp/packages/packman/SRPMS/qps-1.10.2-0.pm.1.src.rpm ==> /tmp/zyppcon/x86_64 <=/var/cache/zypp/packages/backports/x86_64/digikam-lang-0.9.4-54.3.x86_64.rpm /var/cache/zypp/packages/backports/x86_64/kipi-plugins-lang-0.1.6-3.2.x86_64.rpm /var/cache/zypp/packages/backports/x86_64/kio_iso-1.99.1.svn6082-7.1.x86_64.rpm These files are on host 'alchemy'. I want to rsync them to host 'nirvana' under /home/backup/rpms/(delta,i586,noarch,src,x86_64), respectively. The rsync call in the script is is: REPOHOST=nirvana.3111skyline.com REPOPATH=/home/backup/rpms TEMPDIR=/tmp/zyppcon TMPDIREXISTS=0 RUSER=david /usr/bin/rsync -auv --files-from=${TEMPDIR}/${i} / ${RUSER}@${REPOHOST}:${REPOPATH}/${i} rsync is called from within a for loop where $i iterates through the files (delta,i586,noarch,src,x86_64) All I am trying to do is to rsync (say for example this file): /var/cache/zypp/packages/openSUSE-11.0-Updates/rpm/x86_64/satsolver-tools-0.9.5_0.9.6-0.1.x86_64.delta.rpm from alchemy and have it end up in nirvana:/home/backup/rpms/delta. (it would be rsync'ed when $i=delta. For the life of me I *can't make it work*. I have tried every combination of --no-relative, --no-dirs and --no-implied-dirs (I know, but I was desperate), and no matter what I do, the files end up in: nirvana:/home/backup/rpms/var/cache/packages/openSUSE-11.0-Updates/rpm/x86_64/ Way too much path, way way too much path. There are thousands of rpms, so the thought of calling rsync for every file is a no go -- David C. Rankin, J.D.,P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com
Wayne Davison
2009-Mar-14 23:42 UTC
AARGH! I can't make rsync not copy dirs with --files-from option
On Sat, Mar 14, 2009 at 04:11:12PM -0500, David C. Rankin wrote:> Way too much path, way way too much path.By default, all the path segments in the files-from file are a part of the transfer unless you turn off the implied --relative option, in which case no directory elements from the source paths are used. So, either (1) move path elements out of the files-from file to the source dir arg, (2) specify --no-relative and specify the full destination path to where you want the directory files to go, or (3) insert a "/./" dir to specify the cut point for files-from path information (but prior to 3.0.5 the sender needs to be in the same dir as the source path to avoid a bug). So, option 1 would mean stripping things like /var/cache/zypp/packages from the start of the files-from paths and specifying that source path on the command line as "/var/cache/zypp/packages" instead of "/". In option 3, files-from lines would look like this: /var/cache/zypp/packages/openSUSE-11.0-Updates/rpm/./x86_64/satsolver-tools-0.9.5_0.9.6-0.1.x86_64.delta.rpm Put that '/./' dir wherever you want to cut off the path info that is included in the transfer. ..wayne..