On Saturday 07 Apr 2012 10:43:52 Nick wrote:
> On 06/04/12 16:37, James Cammarata wrote:
> >> What would I need to do to manually replicate what `cobbler import`
> >> does?
...
> > 
> > But, for the record, import is basically a wrapper around the following
> > steps:
> > 
> > cobbler distro add
> > cobbler profile add
> > cobbler repo add
> > 
> > All of which might add more than one object.
> 
> I have asked the same question before and got basically the same answer.
> However I think it misses some details which you have to spelunk the
> source code to find out, such as creating links, supplying the right
> vmlinuz and initrd paths, etc.
...

OK, got it!  Thanks again everyone for the pointers and examples.

So what I was trying to achieve (which I probably didn't explain properly) was 
to add a distro and repo without downloading the same data twice (once in DVD 
ISO and once for repo).

I finally got there after a couple of tries and it turned out the distro only 
needs (at least for CentOS) 3 files that are not already in the repo mirror: 
kernel, initrd and install.img (anaconda).

In case it would be useful to anyone the steps are below (this is for CentOS 6 
x86_64).

So basically the idea is to download the needed files into a distro tree dir 
(in /var/www/cobbler/ks_mirror) and link everything else (cache/ Packages/ 
repodata/) that's needed for installation to the repo dir (in 
/var/www/cobbler/repo_mirror).

So far it seems to work well.  I'll probably revise that when I start adding 
debian based distros.


 1. created a repo: cobbler repo add --name=centos-6-os-x86_64 --
mirror=http://mirror.centos.org/centos/6/os/x86_64/ --priority=1 --arch=x86_64 
&& cobbler reposync

 2. created a file: centos-6-ks-files with contents:

images/install.img
images/pxeboot/initrd.img
images/pxeboot/vmlinuz

 3. mkdir /var/lib/cobbler/ks_mirror/centos-6-x86_64

 4. wget --base=http://mirror.centos.org/centos/6/os/x86_64/ --input-
file=centos-6-ks-files --timestamping --force-directories --no-host-
directories --directory-prefix=/var/lib/cobbler/ks_mirror/centos-6-x86_64 --
cut-dirs=4

 5. for dir in cache Packages repodata; do ln -sf 
/var/www/cobbler/repo_mirror/centos-6-os-x86_64/$dir 
/var/www/cobbler/ks_mirror/centos-6-x86_64/$dir; done

 6. ln -sf /var/www/cobbler/ks_mirror/centos-6-x86_64 
/var/www/cobbler/links/cobbler-6-x86_64

 7. cobbler distro add --name=centos-6-x86_64 --
kernel=/var/www/cobbler/ks_mirror/centos-6-x86_64/images/pxeboot/vmlinuz --
initrd=/var/www/cobbler/ks_mirror/centos-6-x86_64/images/pxeboot/initrd.img --
ksmeta="tree=http://@@http_server@@/cblr/links/centos-6-x86_64";


-- 
Michael Gliwinski
Henderson Group Information Services
9-11 Hightown Avenue, Newtownabby, BT36 4RT
Phone: 028 9034 3319

**********************************************************************************************
The information in this email is confidential and may be legally privileged.  
It is intended solely for the addressee and access to the email by anyone else 
is unauthorised.
If you are not the intended recipient, any disclosure, copying, distribution or 
any action taken or omitted to be taken in reliance on it, is prohibited and 
may be unlawful.
When addressed to our clients, any opinions or advice contained in this e-mail 
are subject to the terms and conditions expressed  in the governing client 
engagement leter or contract.
If you have received this email in error please notify 
[email protected]

John Henderson (Holdings) Ltd
Registered office: 9 Hightown Avenue, Mallusk, County Antrim, Northern Ireland, 
BT36 4RT.
Registered in Northern Ireland
Registration Number NI010588
Vat No.: 814 6399 12
*********************************************************************************

_______________________________________________
cobbler mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/cobbler

Reply via email to