]> xenbits.xensource.com Git - people/aperard/osstest.git/commitdiff
mg-centos-installer-update: To download kernel and initrd
authorAnthony PERARD <anthony.perard@citrix.com>
Wed, 6 Dec 2017 19:06:42 +0000 (19:06 +0000)
committerAnthony PERARD <anthony.perard@citrix.com>
Mon, 18 Dec 2017 16:47:18 +0000 (16:47 +0000)
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 <anthony.perard@citrix.com>
cri-getconfig
mg-centos-installer-update [new file with mode: 0755]

index b891c9b1d68f6d762f8e5f14396783e0c0d31e99..343bffc0fb0787edf4e9c49e0a0ab15ffb154653 100644 (file)
@@ -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 (executable)
index 0000000..e773cb8
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+
+
+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"
+