From f9ce8a851446f55f15de3650244f4a02582ece01 Mon Sep 17 00:00:00 2001 From: Anthony PERARD Date: Wed, 6 Dec 2017 19:06:42 +0000 Subject: [PATCH] mg-centos-installer-update: To download kernel and initrd Also one would need to `mkdir centos-installer` in TftpPlayDir for the script to work, this is the same behavior as with mg-debian-installer-update. Signed-off-by: Anthony PERARD --- cri-getconfig | 9 ++++ mg-centos-installer-update | 89 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100755 mg-centos-installer-update diff --git a/cri-getconfig b/cri-getconfig index b891c9b1..343bffc0 100644 --- a/cri-getconfig +++ b/cri-getconfig @@ -36,6 +36,15 @@ getconfig_TftpDiVersion_suite () { ' "$1" } +getconfig_TftpCentosInstallerVersion_release () { + perl -e ' + use Osstest; + use Osstest::TestSupport; + readglobalconfig(); + print cfg_tftp_centos_installer_version($ARGV[0]) or die $!; + ' "$1" +} + getrepos() { local repos=`getconfig Repos` if [ -z "$repos" ] ; then diff --git a/mg-centos-installer-update b/mg-centos-installer-update new file mode 100755 index 00000000..e773cb8e --- /dev/null +++ b/mg-centos-installer-update @@ -0,0 +1,89 @@ +#!/bin/bash +# usage +# ./mg-centos-installer-update 7 amd64 + +# This is part of "osstest", an automated testing framework for Xen. +# Copyright (C) 2017 Citrix Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + + +set -e -o posix + +. ./cri-getconfig +. ./mgi-common + +releasever=$1 # $suite +arch=$2 + +case $arch in + amd64) basearch=x86_64 ;; +esac + +site=http://mirror.centos.org/centos +sbase=$site/$releasever + +src=$sbase/os/$basearch/images/pxeboot + +case ${releasever}_${arch} in + 7_amd64) + files="initrd.img:initrd.img vmlinuz:vmlinuz" + ;; + *) + exit 1 + ;; +esac + +tftpciversion=`getconfig_TftpCentosInstallerVersion_release $releasever` +dstroot=`getconfig TftpPath`/`getconfig TftpCentosInstallerBase` +date=`date +%Y-%m-%d` +dst=$arch/$date-$releasever +harness_rev=$(perl -e 'use Osstest; print get_harness_rev();') + +case "`getconfig HttpProxy`" in +?*) export http_proxy=`getconfig HttpProxy` ;; +esac + +cd $dstroot +mkdir -p $dst +cd $dst +echo >&2 "working in $dstroot/$dst" + +now=$(date -R) +echo >>osstest-touched.log "$now: $harness_rev" + +for f in $files; do + echo >&2 "fetching $f" + s=${f/:*} ; d=${f/*:} + echo >&2 "$src/$s => $d.new" + fetch $src/$s >$d.new +done + +for f in $files; do + s=${f/:*} ; d=${f/*:} + mv -f $d.new $d +done + +if [ "$tftpciversion" = current ]; then + cd $dstroot/$arch + rm -rf current-$releasever.new + ln -s $date-$releasever current-$releasever.new + mv -Tf current-$releasever.new current-$releasever +fi + +echo "CentosInstallerVersion $date" +echo "CentosInstallerVersion_$releasever $date" +# ^ above two lines parsed ad-hoc by standalone-reset +echo >&2 "downloaded $dstroot/$dst" + -- 2.39.5