diff options
author | Peter Palfrader <peter@palfrader.org> | 2016-02-11 06:05:14 +0100 |
---|---|---|
committer | Peter Palfrader <peter@palfrader.org> | 2016-02-11 06:05:14 +0100 |
commit | 0a9b67c48edb394a694eb758a04c392a7ba4161b (patch) | |
tree | 8cf395b82094f8c82b4a8469f4b5a6609a517e9c | |
parent | c60ecbe2ffc425e22c635c3d6b15189f06ab4685 (diff) | |
parent | 0cbcb91ccf96631ff01c605c11e2b14c75dc446c (diff) |
Merge remote-tracking branch 'waldi/arch-include'
* waldi/arch-include:
Correctly generate architecture list in case for arch include
Factor out arch exclude and include into function
Support architecture include
Factor out source exclude specification
Conflicts:
bin/ftpsync
-rwxr-xr-x | bin/ftpsync | 72 | ||||
-rw-r--r-- | etc/ftpsync.conf.sample | 10 |
2 files changed, 68 insertions, 14 deletions
diff --git a/bin/ftpsync b/bin/ftpsync index 2242cfe..e3ba480 100755 --- a/bin/ftpsync +++ b/bin/ftpsync @@ -202,13 +202,22 @@ tracefile() { if [[ full = ${EXTENDEDTRACE} ]]; then GLOBALARCHLIST="source amd64 arm64 armel armhf hurd-i386 i386 ia64 kfreebsd-amd64 kfreebsd-i386 mips mipsel powerpc ppc64el s390 s390x sparc" - AEXCLUDE="^${ARCH_EXCLUDE// /\$|^}$" ARCHLIST="" - for ARCH in ${GLOBALARCHLIST}; do - if ! [[ ${ARCH} =~ ${AEXCLUDE} ]]; then - ARCHLIST="${ARCHLIST} ${ARCH}" - fi - done + if [[ ${ARCH_INCLUDE} ]]; then + AINCLUDE="^${ARCH_INCLUDE// /\$|^}$" + for ARCH in ${GLOBALARCHLIST}; do + if [[ ${ARCH} =~ ${AINCLUDE} ]]; then + ARCHLIST="${ARCHLIST} ${ARCH}" + fi + done + else + AEXCLUDE="^${ARCH_EXCLUDE// /\$|^}$" + for ARCH in ${GLOBALARCHLIST}; do + if ! [[ ${ARCH} =~ ${AEXCLUDE} ]]; then + ARCHLIST="${ARCHLIST} ${ARCH}" + fi + done + fi out="GUESSED:{${ARCHLIST}}" echo "Architectures: ${out}" echo "Upstream-mirror: ${RSYNC_HOST}" @@ -256,6 +265,19 @@ tracefile() { esac } + +arch_imexclude() { + local param="$1" arch="$2" + EXCLUDE="${EXCLUDE} --${param}=binary-${arch}/ --${param}=installer-${arch}/ --${param}=Contents-${arch}.gz --${param}=Contents-udeb-${arch}.gz --${param}=Contents-${arch}.diff/ --${param}=arch-${arch}.files --${param}=arch-${arch}.list.gz --${param}=*_${arch}.deb --${param}=*_${arch}.udeb --${param}=*_${arch}.changes" +} + +arch_exclude() { + arch_imexclude exclude "$1" +} + +arch_include() { + arch_imexclude include "$1" +} ######################################################################## ######################################################################## @@ -469,21 +491,43 @@ STATS_TOTAL_RSYNC_TIME2=0 EXCLUDE="${EXCLUDE} --exclude=.~tmp~/" SOURCE_EXCLUDE=${SOURCE_EXCLUDE:-""} +SOURCE_EXCLUDE_EXPLICIT= ARCH_EXCLUDE=${ARCH_EXCLUDE:-""} +ARCH_INCLUDE=${ARCH_INCLUDE:-""} + # Exclude architectures defined in $ARCH_EXCLUDE for ARCH in ${ARCH_EXCLUDE}; do - EXCLUDE="${EXCLUDE} --exclude=binary-${ARCH}/ --exclude=installer-${ARCH}/ --exclude=Contents-${ARCH}.gz --exclude=Contents-udeb-${ARCH}.gz --exclude=Contents-${ARCH}.diff/ --exclude=arch-${ARCH}.files --exclude=arch-${ARCH}.list.gz --exclude=*_${ARCH}.deb --exclude=*_${ARCH}.udeb --exclude=*_${ARCH}.changes" + arch_exclude ${ARCH} if [[ ${ARCH} = source ]]; then - if [[ -z ${SOURCE_EXCLUDE} ]]; then - SOURCE_EXCLUDE=" --exclude=source/ --exclude=*.tar.gz --exclude=*.diff.gz --exclude=*.tar.bz2 --exclude=*.tar.xz --exclude=*.diff.bz2 --exclude=*.dsc " - # Over-ride the exclude=*.tar.gz above - there are some - # tar.gz files in the archive that are *not* source - # files... - SOURCE_EXCLUDE="$SOURCE_EXCLUDE --include=debian-cd_info.tar.gz --include=debian-faq.en.html.tar.gz --include=netboot.tar.gz --include=nfsroot.tar.gz --include=hd-media.tar.gz --include=dedication*.tar.gz" - fi + SOURCE_EXCLUDE_EXPLICIT=1 fi done +if [[ ${ARCH_INCLUDE} ]]; then + ARCH_INCLUDE_ALL= + SOURCE_EXCLUDE_EXPLICIT=1 + for ARCH in ${ARCH_INCLUDE}; do + arch_include ${ARCH} + if [[ ${ARCH} = source ]]; then + SOURCE_EXCLUDE_EXPLICIT= + else + ARCH_INCLUDE_ALL=1 + fi + done + if [[ ${ARCH_INCLUDE_ALL} ]]; then + arch_include all + fi + arch_exclude '*' +fi + +if [[ ${SOURCE_EXCLUDE_EXPLICIT} ]] && [[ -z ${SOURCE_EXCLUDE} ]]; then + SOURCE_EXCLUDE=" --exclude=source/ --exclude=*.tar.gz --exclude=*.diff.gz --exclude=*.tar.bz2 --exclude=*.tar.xz --exclude=*.diff.bz2 --exclude=*.dsc " + # Over-ride the exclude=*.tar.gz above - there are some + # tar.gz files in the archive that are *not* source + # files... + SOURCE_EXCLUDE="$SOURCE_EXCLUDE --include=debian-cd_info.tar.gz --include=debian-faq.en.html.tar.gz --include=netboot.tar.gz --include=nfsroot.tar.gz --include=hd-media.tar.gz --include=dedication*.tar.gz" +fi + RSYNC_SSL=${RSYNC_SSL:-"false"} RSYNC_SSL_PORT=${RSYNC_SSL_PORT:-"1873"} RSYNC_SSL_CAPATH=${RSYNC_SSL_CAPATH:-"/etc/ssl/certs"} diff --git a/etc/ftpsync.conf.sample b/etc/ftpsync.conf.sample index 0463ba9..50b084b 100644 --- a/etc/ftpsync.conf.sample +++ b/etc/ftpsync.conf.sample @@ -97,6 +97,16 @@ ## Notice: source shall not be excluded on an official mirror #ARCH_EXCLUDE="" +## If you do want to include only a set of architectures, this is for you. +## Use as space seperated list. +## Possible values are: +## alpha amd64 arm arm64 armel armhf hppa hurd-i386 i386 ia64 kfreebsd-amd64 +## kfreebsd-i386 m68k mipsel mips powerpc ppc64el s390 s390x sh sparc source +## eg. ARCH_INCLUDE="amd64 i386 source" +## An unset value will mirror all architectures (default!) +## Notice: source shall be included on an official mirror +#ARCH_INCLUDE="" + ## Do we have leaf mirror to signal we are done and they should sync? ## If so set it to true and make sure you configure runmirrors.mirrors ## and runmirrors.conf for your need. |