-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
epel-clone-errata.sh
executable file
·46 lines (38 loc) · 1.7 KB
/
epel-clone-errata.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
# Processes EPEL Errata and imports it into Spacewalk
# IMPORTANT: read through this script, it's more of a guidance than something fixed in stone
# also: if you're using the commandline options for usernames and passwords, comment out the
# line that says ". ./ya-errata-import.cfg"
# set fixed locale
export LC_ALL=C
export LANG=C
CHANNELS=(centos-7-epel)
EPEL_VERSION=7
# create and/or cleanup the errata dir
ERRATADIR=/tmp/epel-errata
mkdir $ERRATADIR >/dev/null 2>&1
rm -f $ERRATADIR/* >/dev/null 2>&1
(
cd $ERRATADIR
# now download the errata, in this example we do it for EPEL-6-x86_64
# EPEL changed repomd format
# wget -q --no-cache http://dl.fedoraproject.org/pub/epel/$EPEL_VERSION/x86_64/repodata/updateinfo.xml.gz
repomd=`wget -q -O - --no-cache http://dl.fedoraproject.org/pub/epel/$EPEL_VERSION/$EPEL_ARCH/repodata/repomd.xml`
# we use perl minimal matching
updateinfo_location=`echo $repomd | perl -pe 's/.*href="(.*?updateinfo.xml.bz2).*/$1/;'`
wget -q --no-cache -O updateinfo.xml.bz2 http://dl.fedoraproject.org/pub/epel/$EPEL_VERSION/$EPEL_ARCH/$updateinfo_location
bunzip2 updateinfo.xml.bz2
)
errataImport()
{
echo "Errata Import In !!!"
echo "Errata Dir: $ERRATADIR"
for channel in "${CHANNELS[@]}"
do
/spacewalk-scripts/ya-errata-import.pl --epel_errata $ERRATADIR/updateinfo.xml --server $SPACEWALK --channel $channel --os-version $CENTOS_VERSION --publish --startfromprevious twoweeks --quiet
# OR do the import and get extra errata info from redhat if possible
#/spacewalk-scripts/ya-errata-import.pl --erratadir=$ERRATADIR --server $SPACEWALK --channel $channel --os-version $CENTOS_VERSION --publish --get-from-rhn
done
}
errataImport
rm -f $ERRATADIR/*