forked from liedekef/spacewalk_scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
oel-clone-errata.sh
44 lines (35 loc) · 1.46 KB
/
oel-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
#!/bin/bash
# Processes OEL 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
# Set your spacewalk server
SPACEWALK=127.0.0.1
# 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
# wget needs a proxy? Then set these
export http_proxy=
export https_proxy=
# now download the errata, in this example we do it for OEL-5-x86_64
wget -q --no-cache http://public-yum.oracle.com/repo/OracleLinux/OL5/latest/x86_64/repodata/updateinfo.xml.gz
gunzip updateinfo.xml.gz
)
# Set usernames and passwords. You have some options here:
# 1) Either define the environment variables here:
# export SPACEWALK_USER=my_username
# export SPACEWALK_PASS=my_passwd
# export RHN_USER=my_rhn_username
# export RHN_PASS=my_rhn_password
# 2) Set them on the commandline (but I don't recommend it)
# 3) Set them in a separate cfg file and source it (like done below)
. ./ya-errata-import.cfg
# upload the errata to spacewalk
/sbin/ya-errata-import.pl --oel_errata $ERRATADIR/updateinfo.xml --server $SPACEWALK --channel oel-x86_64-server-5 --os-version 5 --publish --redhat --startfromprevious twoweeks --quiet
rm -f $ERRATADIR/*