Blob Blame History Raw
From 7c2489a41905d8db2000784c600f025d459a26f4 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 5 Aug 2015 12:39:58 +0100
Subject: [PATCH] p2v: Allow 'virt-p2v-make-kickstart rhel-7.1' to set up RHEL
 repos.

(cherry picked from commit da8776040704b2afb9e044aa44f731d42281cc0f)
---
 p2v/virt-p2v-make-kickstart.in  | 11 +++++++++++
 p2v/virt-p2v-make-kickstart.pod |  5 +++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/p2v/virt-p2v-make-kickstart.in b/p2v/virt-p2v-make-kickstart.in
index 22a4eaa..70d7782 100644
--- a/p2v/virt-p2v-make-kickstart.in
+++ b/p2v/virt-p2v-make-kickstart.in
@@ -123,6 +123,17 @@ repo --name=rawhide --mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?rep
 repo --name=koji --baseurl=http://koji.fedoraproject.org/repos/rawhide/latest/\$basearch/ $proxy
 "
             ;;
+        rhel-*)
+            major=$( echo "$repo" | sed 's/rhel-\([0-9]*\)\.[0-9]*/\1/' )
+            minor=$( echo "$repo" | sed 's/rhel-[0-9]*\.\([0-9]*\)/\1/' )
+            baseurl=http://download.eng.rdu2.redhat.com/released/RHEL-$major/$major.$minor
+            # '$basearch' cannot be used in kickstart, so:
+            arch=`uname -m`
+            repos="$repos
+repo --name=rhel${major}_${minor}_server --baseurl=$baseurl/Server/$arch/os
+repo --name=rhel${major}_${minor}_server_optional --baseurl=$baseurl/Server-optional/$arch/os
+"
+            ;;
         *)
             # A custom repo is just a URL.
             ((i++)) ||:
diff --git a/p2v/virt-p2v-make-kickstart.pod b/p2v/virt-p2v-make-kickstart.pod
index 47ca737..821fd52 100644
--- a/p2v/virt-p2v-make-kickstart.pod
+++ b/p2v/virt-p2v-make-kickstart.pod
@@ -33,8 +33,9 @@ will build a kickstart file for Fedora.  The kickstart file will be
 called C<p2v.ks> and located in the current directory.
 
 The parameters are a list of one or more repositories.  Some built-in
-repositories are available: C<fedora>, C<rawhide> or C<koji>.  You can
-also use a URL as a parameter to point to a repository.
+repositories are available: C<fedora>, C<rawhide>, C<koji> or
+C<rhel-VERSION> (eg. C<rhel-7.1>).  You can also use a URL as a
+parameter to point to a repository.
 
 To control the name of the output file, use the I<-o> parameter.  To
 tell kickstart to use a proxy server or web cache to download files,
-- 
1.8.3.1