Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Franky committed Oct 15, 2012
0 parents commit c797cc4
Show file tree
Hide file tree
Showing 5 changed files with 1,022 additions and 0 deletions.
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
based on some existing scripts (eva_direct_sync.pl and errata-import.pl), I've
created a new script. Reason for the rework:
- we have redhat and centos packages in spacewalk, both can have the same
package names, which would result in redhat packages being pushed in centos
channels because of the errata create (and thus everything fails)
- the XML file of errata-import.pl is ok, but updated by one person and only
for security errata (I think)
- errata-import.pl had good code, but no RHN integration, and is too easy
for missing packages (if 1 package from the errata is there, the errata is
created, while other packages might be missing)
- always different scripts were created/used for redhat and centos errata

So, my script (well, combo of shell and perl) was born:
For CentOS:
- first some shell calls to get the latest announces from the centos archive
(but not by scraping the announces list, but getting digests, much less
traffic then)
You can change the number of announces anyway you want by changing the
wget command to your liking
- then the perl script comes along, parsing the digest files and looking in 1
channel (yes, one) for package availability and creating the errata there.
It has optional integration with RHN for notes, description, topic info, and
CVE's and/or can use the OVAL file like the errata-import.pl script does.
The created errata gets a suffix based on the OS version and architecture
(e.g. ":C5-64" or "C6-32"), because the same errata can exist for multiple
OS versions and architectures (and creating the errata for more than one
base channel would result in packages being copied which is a mess again).
Also a proxy can be defined for spacewalk and or RHN servers
Or, for RedHat:
- log in to RHN, get the errata for the specified channel
(possibility to define the date range)
- then follow the same logic as for CentOS
21 changes: 21 additions & 0 deletions centos-clone-errata.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
# Processes CentOS Errata and imports it into Spacewalk

# Obtains the current date and year.
DATE=`/bin/date +'%Y-%B'`

# Fetches the errata data from centos.org.
mkdir /tmp/centos-errata >/dev/null 2>&1
cd /tmp/centos-errata
rm -f /tmp/centos-errata/* >/dev/null 2>&1
# wget needs a proxy? Then set these
export http_proxy=
export https_proxy=
wget -q -O- http://lists.centos.org/pipermail/centos/$DATE/date.html| grep "CentOS-announce Digest" |tail -n 5 |cut -d"\"" -f2|xargs -n1 -I{} wget -q http://lists.centos.org/pipermail/centos/$DATE/{}

# get usernames and passwords
. ./ya-errata-import.cfg
/sbin/ya-errata-import.pl --erratadir=/tmp/centos-errata --server spacewalk --channel centos-x86_64-server-6 --os-version 6 --publish --get-from-rhn --rhn-proxy=xxx --quiet
/sbin/ya-errata-import.pl --erratadir=/tmp/centos-errata --server spacewalk --channel centos-x86_64-server-5 --os-version 5 --publish --get-from-rhn --rhn-proxy=xxx --quiet

rm -f /tmp/centos-errata/*
13 changes: 13 additions & 0 deletions redhat-clone-errata.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
# Processes RedHat Errata and imports it into Spacewalk

# Obtains the current date and year.
DATE=`/bin/date +'%Y-%B'`

# get usernames and passwords
. ./ya-errata-import.cfg

/sbin/ya-errata-import.pl --server spacewalk --channel rhel-i386-server-5 --os-version 5 --publish --redhat --rhn-proxy=xxx --redhat-startfromprevious twoweeks --quiet
/sbin/ya-errata-import.pl --server spacewalk --channel rhel-i386-server-6 --os-version 6 --publish --redhat --rhn-proxy=xxx --redhat-startfromprevious twoweeks --quiet
/sbin/ya-errata-import.pl --server spacewalk --channel rhel-x86_64-server-5 --os-version 5 --publish --redhat --rhn-proxy=xxx --redhat-startfromprevious twoweeks --quiet
/sbin/ya-errata-import.pl --server spacewalk --channel rhel-x86_64-server-6 --os-version 6 --publish --redhat --rhn-proxy=xxx --redhat-startfromprevious twoweeks --quiet
4 changes: 4 additions & 0 deletions ya-errata-import.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export SPACEWALK_USER=my_username
export SPACEWALK_PASS=my_passwd
export RHN_USER=my_rhn_username
export RHN_PASS=my_rhn_password
Loading

0 comments on commit c797cc4

Please sign in to comment.