Changeset 1267
- Timestamp:
- Sep 19, 2022, 5:02:28 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
dass-tools/usr/bin/reposync-mirror-update.sh
r1228 r1267 48 48 ME=reposync-mirror-update 49 49 TMPDIR=/tmp/reposync.cache/ 50 mkdir -p $TMPDIR 50 51 51 52 REPO_FILES=`find -name "*.repo" ! -name "vermkv-*" | sort` … … 66 67 else 67 68 68 # reposync stores in a directory named identical as the name of the repo 69 test -L $NAME && rm $NAME 70 if test -x $NAME; then 71 echo "FAILED: remove $NAME and try again" 72 exit 1 69 # reposync stores in a directory named identical as the name of the repo 70 test -L $NAME && rm $NAME 71 if test -x $NAME; then 72 echo "FAILED: remove $NAME and try again" 73 exit 1 74 fi 75 76 ln -s $DIR $NAME 77 CACHEDIR=`mktemp --directory --tmpdir=$TMPDIR` 78 79 SYNCED="" 80 # exit on errors 81 if LOG=$(reposync --config $REPO_FILE --cachedir=$CACHEDIR --delete); then 82 SYNCED="$NAME" 83 else 84 printf "FAILED: reposync of %s failed:\n%s\n\n" "$URL" "$LOG" >&2 85 #printf "CACHEDIR=%s\n" "$CACHEDIR" 86 #ls -la "$CACHEDIR" 87 #find ${CACHEDIR} 88 89 CACHEDIR=`mktemp --directory --tmpdir=$TMPDIR` 90 REPO_FILE_FALLBACK="${REPO_FILE}-fallback" 91 sed 's|download.opensuse.org|ftp.gwdg.de/pub/opensuse|' < $REPO_FILE > $REPO_FILE_FALLBACK 92 #sed 's|download.opensuse.org|ftp1.nluug.nl/os/Linux/distr/opensuse|' < $REPO_FILE > $REPO_FILE_FALLBACK 93 URL=`sed --quiet -r 's/^baseurl=(.*)/\1/ip' $REPO_FILE_FALLBACK` 94 printf "Trying fallback %s ...\n" "$URL" >&2 95 LOG="" 96 97 if LOG=$(reposync --config "${REPO_FILE_FALLBACK}" --cachedir=$CACHEDIR); then 98 SYNCED="$NAME" 99 #printf "%s\n" "$LOG" 100 else 101 printf "FAILED: reposync of %s failed:\n%s\n\n" "$URL" "$LOG" >&2 102 REPOSYNC_FAILED="${REPOSYNC_FAILED}${DIR} " 103 fi 104 fi 105 106 if [ "$SYNCED" ]; then 107 if grep "Downloading\|Removing" <<< "$LOG"; then 108 109 test -L $NAME && rm $NAME 110 111 echo 112 echo "$ME: $NAME: createrepo" 113 createrepo --cachedir .repocache/ $DIR 114 115 echo 116 echo "$ME: $NAME: signing" 117 rm -f $DIR/repodata/repomd.xml.asc $DIR/repodata/repomd.xml.key 118 if [ "$REPOSYNC_GPG_KEY" -a "$REPOSYNC_GPG_PASSPHRASE" ]; then 119 gpg --batch --passphrase "$REPOSYNC_GPG_PASSPHRASE" -a --detach-sign --default-key "$REPOSYNC_GPG_KEY" $DIR/repodata/repomd.xml 120 gpg --batch --passphrase "$REPOSYNC_GPG_KEY" -a --export "$REPOSYNC_GPG_KEY" > $DIR/repodata/repomd.xml.key 121 fi 122 fi 123 fi 124 test -L $NAME && rm $NAME 125 sleep 1 73 126 fi 74 75 ln -s $DIR $NAME76 CACHEDIR=`mktemp --directory --tmpdir=$TMPDIR`77 78 # exit on errors79 if ! LOG=$(reposync --config $REPO_FILE --cachedir=$CACHEDIR --delete); then80 81 printf "FAILED: reposync failed:\n%s" "$LOG" >&282 REPOSYNC_FAILED="${REPOSYNC_FAILED}${DIR} "83 84 elif grep "Downloading\|Removing" <<< "$LOG"; then85 86 test -L $NAME && rm $NAME87 88 echo89 echo "$ME: $NAME: createrepo"90 createrepo --cachedir .repocache/ $DIR91 92 echo93 echo "$ME: $NAME: signing"94 rm -f $DIR/repodata/repomd.xml.asc $DIR/repodata/repomd.xml.key95 if [ "$REPOSYNC_GPG_KEY" -a "$REPOSYNC_GPG_PASSPHRASE" ]; then96 gpg --batch --passphrase "$REPOSYNC_GPG_PASSPHRASE" -a --detach-sign --default-key "$REPOSYNC_GPG_KEY" $DIR/repodata/repomd.xml97 gpg --batch --passphrase "$REPOSYNC_GPG_KEY" -a --export "$REPOSYNC_GPG_KEY" > $DIR/repodata/repomd.xml.key98 fi99 fi100 test -L $NAME && rm $NAME101 sleep 1102 103 fi104 105 127 done 106 128
Note:
See TracChangeset
for help on using the changeset viewer.