source: trunk/locker/sbin/scripts-createrepo @ 2842

Last change on this file since 2842 was 2550, checked in by andersk, 10 years ago
scripts-createrepo: Accept a server argument
  • Property svn:executable set to *
File size: 719 bytes
Line 
1#!/bin/sh
2
3# Runs createrepo on the primary scripts server and copies the resulting
4# metadata to the live yum repository.
5
6set -eux
7
8server="${1-scripts.mit.edu}"
9
10ssh='ssh -o GSSAPIAuthentication=yes -o GSSAPIDelegateCredentials=no'
11
12yum=/afs/athena.mit.edu/contrib/scripts/yum-repos/rpm-fc$($ssh "root@$server" 'lsb_release -rs')
13[ -d "$yum" ]
14
15tmp=$($ssh "root@$server" "\
16set -eux
17tmp=\$(mktemp -dt createrepo.XXXXXX)
18createrepo -d -o \"\$tmp\" -- '$yum' >&2
19printf '%s' \"\$tmp\"
20")
21[ "$tmp" ]
22
23new=$(mktemp -d -- "$yum/repodata.XXXXXX")
24rsync -avz -e "$ssh" -- "root@$server:$tmp/repodata/" "$new"
25mv -b -T -- "$new" "$yum/repodata"
26rm -rf -- "$yum/repodata~"
27
28$ssh "root@$server" "\
29set -eux
30rm -rf -- '$tmp'
31"
Note: See TracBrowser for help on using the repository browser.