Skip to content

Instantly share code, notes, and snippets.

@mAster-rAdio
Last active July 25, 2017 06:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mAster-rAdio/5e4641b4a4fc7a7b8f43b5140573de6a to your computer and use it in GitHub Desktop.
Save mAster-rAdio/5e4641b4a4fc7a7b8f43b5140573de6a to your computer and use it in GitHub Desktop.
Get xml from github(stevemeier/cefs).
#!/bin/sh
#set -v # Output in Verbose: Print Command.
#set -x # Output in Verbose: Expand Variable.
#set -e # Fail on Error.
#set -u # Fail on Undefined variable.
readlink=`which greadlink 2> /dev/null || true`
test -z "${readlink}" && readlink=`which readlink 2> /dev/null || true`
if [ -n "${readlink}" ]; then
real_path=`${readlink} -fn "$0"`
else
real_path="$0"
fi
file_name=`basename "${real_path}"`
base_dir=`dirname "${real_path}"`
cd "${base_dir}"
releasever=`rpm -q --whatprovides /etc/redhat-release --qf '%{version}'`
wget -Nq --no-check-certificate https://raw.githubusercontent.com/vmfarms/generate_updateinfo/master/generate_updateinfo.py
chmod +x generate_updateinfo.py
wget -Nq --no-check-certificate https://raw.githubusercontent.com/stevemeier/cefs/master/errata.latest.xml
timestamp="`grep -o '<timestamp[^>]*>[^<]*</timestamp>' errata.latest.xml | sed -re 's%<timestamp[^>]*>([^<]*)</timestamp>%\1%g'`"
filedate="`date --date=\"${timestamp}\" +'%Y-%m-%d %H:%M:%S %Z' 2> /dev/null`"
if [ $? -gt 0 ]; then
echo "Error:[${file_name}] XML is something wrong." 1>&2
exit 1
else
echo "errata.latest.xml is updated at '${filedate}'."
touch --date="${timestamp}" errata.latest.xml
fi
# If "python26" exists, Use it. "generate_updateinfo.py" is for python 2.6.
# And because when "python26" is set, It means that python 2.7 or higher is the default.
python26=`which python26 2> /dev/null`
${python26} ./generate_updateinfo.py --destination="${base_dir}" --release="${releasever}" --severity=all --type=security --type=bugfix "${base_dir}/errata.latest.xml"
modifyrepo "/opt/centos-security/updateinfo-${releasever}/updateinfo.xml" "${base_dir}/repodata"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment