Changeset 1210 for dass-tools/usr/bin/mirror-obs.sh
- Timestamp:
- Apr 12, 2016, 4:58:03 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
dass-tools/usr/bin/mirror-obs.sh
r1093 r1210 1 1 #!/bin/bash 2 2 3 SOURCE_OPENSUSE="ftp5.gwdg.de::pub/opensuse/" 3 set -o errexit -o nounset 4 4 5 REPOS="repositories/home:/dassit 6 " 5 CONFIG=${1:-/etc/mirror-obs.conf} 7 6 8 # 9 # disabled repos: 10 # 11 #distribution/11.2/repo update/11.2 distribution/12.1/repo update/12.1 7 if ! [ -r "$CONFIG" ]; then 8 echo "failed to read config file $CONFIG." 9 exit 1 10 fi 11 source $CONFIG 12 12 13 13 RSYNC_DELETE="--delete" 14 15 #RSYNC_OPTS="-v -rlLptx --safe-links --stats \ 16 # --exclude=*.src.rpm --exclude=*.nosrc.rpm --exclude=*.spm \ 17 # --exclude=*.patch.rpm" 18 19 RSYNC_OPTS="-v -rlLptx --safe-links --stats" 20 21 DEST="/space/installtree/install/download.opensuse.org" 14 RSYNC_OPTS="-v -rlLptx --safe-links --stats $RSYNC_EXTRA_OPTS" 22 15 23 16 rsync_if_exists() 24 17 { 25 26 18 src=$1 19 dest=$2 27 20 28 29 echo rsync-quelle $src gefunden. 30 31 rsync $RSYNC_OPTS $RSYNC_DELETE $src ./$dest21 rsync -q $src || return 1 22 echo "found rsync source: $src" 23 [ -d "$dest" ] || return 2 24 rsync $RSYNC_OPTS $RSYNC_DELETE $src $dest 32 25 } 33 26 34 27 # ---------------- mirror openSUSE repositories ------------------------ 35 FAILED_REPOS="" 36 SUCCESSFUL="" 28 FAILED="" 29 SUCCESS="" 30 37 31 38 32 cd $DEST 39 33 40 for DIR in $REPOS 41 do 34 for DIR in $REPOS; do 42 35 SOURCE_DIR=${SOURCE_OPENSUSE}/${DIR}/. 43 36 DEST_DIR=${DEST}/${DIR}/. 44 37 mkdir -p ${DEST_DIR} 45 rsync_if_exists "${SOURCE_OPENSUSE}$DIR/" "$DIR" 46 case $? in 47 1) echo Distribution $DIR nicht gefunden 48 FAILED_REPOS="$FAILED_REPOS $DIR" 49 ;; 50 2) echo Zielverzeichnis $(pwd)/$DIR nicht vorhanden 51 FAILED_REPOS="$FAILED_REPOS $DIR" 52 ;; 53 0) 54 SUCCESSFUL="$SUCCESSFUL $DIR" 55 ;; 56 *) 57 echo Fehler $? 58 FAILED_REPOS="$FAILED_REPOS $DIR" 59 ;; 38 rc=0 39 rsync_if_exists "${SOURCE_DIR}" "${DEST_DIR}" || rc=$? 40 case $rc in 41 1) echo Distribution $DIR nicht gefunden 42 FAILED="$FAILED $DIR" 43 ;; 44 2) echo Zielverzeichnis ${DEST_DIR} nicht vorhanden 45 FAILED="$FAILED $DIR" 46 ;; 47 0) 48 SUCCESS="$SUCCESS $DIR" 49 if [ "${POST_SCRIPT:-}" ]; then 50 $POST_SCRIPT ${DEST_DIR} 51 fi 52 ;; 53 *) 54 echo Fehler $? 55 FAILED="$FAILED $DIR" 56 ;; 60 57 esac 58 echo 59 echo 61 60 done 62 61 63 # /usr/local/sbin/mirror-report-errors.sh mirror-osb "$SUCCESSFUL" "$FAILED_REPOS" 64 # 65 # # adapt repository sources 66 # for i in `find $DEST/repositories -name "*.repo" -a ! -name "vermkv-*.repo"`; do 67 # basename=`basename $i` 68 # dirname=`dirname $i` 69 # sed "s|http://|http://install.vermkv/freigabe/|" $i > $dirname/vermkv-$basename 70 # done 71 62 if [ "${REPORT_SCRIPT:-}" ]; then 63 $REPORT_SCRIPT mirror-urls "$SUCCESS" "$FAILED" 64 fi
Note:
See TracChangeset
for help on using the changeset viewer.