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

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