source: dass-tools/usr/bin/mirror-obs.sh@ 1220

Last change on this file since 1220 was 1217, checked in by joergs, on Aug 23, 2016 at 3:09:29 PM

fix: used wrong message string

  • Property svn:executable set to *
File size: 1.2 KB
RevLine 
[1091]1#!/bin/bash
2
[1210]3set -o errexit -o nounset
[1091]4
[1210]5CONFIG=${1:-/etc/mirror-obs.conf}
[1091]6
[1210]7if ! [ -r "$CONFIG" ]; then
8 echo "failed to read config file $CONFIG."
9 exit 1
10fi
11source $CONFIG
[1091]12
13RSYNC_DELETE="--delete"
[1210]14RSYNC_OPTS="-v -rlLptx --safe-links --stats $RSYNC_EXTRA_OPTS"
[1091]15
16rsync_if_exists()
17{
[1210]18 src=$1
19 dest=$2
[1091]20
[1210]21 rsync -q $src || return 1
22 echo "found rsync source: $src"
23 [ -d "$dest" ] || return 2
24 rsync $RSYNC_OPTS $RSYNC_DELETE $src $dest
[1091]25}
26
27# ---------------- mirror openSUSE repositories ------------------------
[1210]28FAILED=""
29SUCCESS=""
[1091]30
[1210]31
[1091]32cd $DEST
33
[1210]34for DIR in $REPOS; do
[1091]35 SOURCE_DIR=${SOURCE_OPENSUSE}/${DIR}/.
36 DEST_DIR=${DEST}/${DIR}/.
37 mkdir -p ${DEST_DIR}
[1210]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 ;;
[1091]57 esac
[1210]58 echo
59 echo
[1091]60done
61
[1210]62if [ "${REPORT_SCRIPT:-}" ]; then
[1217]63 $REPORT_SCRIPT mirror-obs "$SUCCESS" "$FAILED"
[1210]64fi
Note: See TracBrowser for help on using the repository browser.