Re: [CentOS] more kickstart - saving %pre decisions for %post

2010-01-14 Thread John Doe
From: Alan McKay alan.mc...@gmail.com
  I thought of that but I don't want to mess up what I already have
  working with manipulating files in /etc
  But at least I can try it to see if this much works
 
 It did mess up all my /etc work, and did not work anyway

I was talking about tmp...
Not sure what the ks does with etc...

   Or maybe, if it exists, use the ramdisk (/dev/shm)...
  Will try that as well depending on results from above
 I just realised this means using /tmp, right?  Which is what I tried
 first that did not work.

No, it would be 'tmpfs' I guess.
But I checked and I did not see it.
I have this on my keys... and it works...

%post --nochroot --interpreter /usr/bin/bash
cp /tmp/ks_pre.log /mnt/sysimage/root/
cp /tmp/misc/ks_post.sh /mnt/sysimage/tmp/ks_post.sh

Then, I got a shell in the chrooted environement and could find
/root/ks_pre.log
/tmp/ks_post.sh
...

So it works for me...

JD


  
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] more kickstart - saving %pre decisions for %post

2010-01-13 Thread John Doe
From: Alan McKay alan.mc...@gmail.com
 How can I save answers to questions in %pre, for use in %post?
 I'm assuming (though have not yet tried) that variables won't live that long.
 Could I save them off to /tmp in a file, and retrieve them?

Yes but post can be used 'chrooted' or 'non-chrooted'.
So be sure to put it in the correct tmp...
http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/Installation_Guide-en-US/s1-kickstart2-postinstallconfig.html

JD


  
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] more kickstart - saving %pre decisions for %post

2010-01-13 Thread Alan McKay
 Yes but post can be used 'chrooted' or 'non-chrooted'.
 So be sure to put it in the correct tmp...
 http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/Installation_Guide-en-US/s1-kickstart2-postinstallconfig.html

OK, will be trying that today.

What I'm doing is coming up with a single install kickstart for all of
our different types of box.  It will ask you a few questions up front,
and depending on what you answer, it will then do various configs in
the post-install.  e.g. either a web server, DB box, or a number of
other choices.

The reason I want to do it this way versus have a different kickstart
for each type of box is that first of all it simplifies the install.
but also because when you have different kickstart files you often
have huge chunks of them that are the same between files, and if you
change something in that chunk you have to go around to all the files
to make the changes.  I know there are other ways around that
particular problem - but I like this way.


-- 
“Don't eat anything you've ever seen advertised on TV”
 - Michael Pollan, author of In Defense of Food
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] more kickstart - saving %pre decisions for %post

2010-01-13 Thread Alan McKay
 http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/Installation_Guide-en-US/s1-kickstart2-postinstallconfig.html

Hmmm, that link tells me surprisingly little.

Can you give some specifics as to how I might accomplish this?


-- 
“Don't eat anything you've ever seen advertised on TV”
 - Michael Pollan, author of In Defense of Food
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] more kickstart - saving %pre decisions for %post

2010-01-13 Thread John Doe
From: Alan McKay alan.mc...@gmail.com
 http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/Installation_Guide-en-US/s1-kickstart2-postinstallconfig.html
 Hmmm, that link tells me surprisingly little.
 Can you give some specifics as to how I might accomplish this?

It means, if you don't use -nochroot, the '/', when in post, will be 
'/mnt/sysimage'.
If you do use -nochroot, the '/' will be '/'.
So, if you want to access your kickstart pre data, either:
- put it in '/tmp', use -nochroot and access it from '/tmp'.
- put it in  '/mnt/sysimage/tmp' and access it from '/tmp'.

JD


  
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] more kickstart - saving %pre decisions for %post

2010-01-13 Thread Alan McKay
On Wed, Jan 13, 2010 at 9:48 AM, John Doe jd...@yahoo.com wrote:
 It means, if you don't use -nochroot, the '/', when in post, will be 
 '/mnt/sysimage'.
 If you do use -nochroot, the '/' will be '/'.

Hmmm, that is behaving differently that what I see.

I have never used --nochroot, and / is /.   For quite some time now in
%post I've been manipulating files in /etc and they are /etc/ after
the new image boots.

Or does --nochroot go in %pre?   Not according to that link I guess




-- 
“Don't eat anything you've ever seen advertised on TV”
 - Michael Pollan, author of In Defense of Food
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] more kickstart - saving %pre decisions for %post

2010-01-13 Thread Alan McKay
So speaking of things that do not work as advertised, my
--log=/some/log/file is also not working, it seems

In any case, here is what I tried.

In %pre I do this :

echo  /tmp/foobar FOOBAR
foo
bar
FOOBAR

and then in %post I do :

%post --log=/root/post-install.log

if [ -f /tmp/foobar ]
then
cp /tmp/foobar /etc/foobar
fi

[ ... bunch of stuff ... ]

# down here I manipulate all kinds of files in /etc and they
# are there in the booted image


So it seems that /tmp in %pre is not the same as /tmp in %post

Any further advice on this?

I suppose I could try mounting a network drive in %pre, copying the
file out there, then mounting it again in %post an copying it back.
But that is a lot of hackery if you ask me.
]


-- 
“Don't eat anything you've ever seen advertised on TV”
 - Michael Pollan, author of In Defense of Food
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] more kickstart - saving %pre decisions for %post

2010-01-13 Thread John Doe
From: Alan McKay alan.mc...@gmail.com
 On Wed, Jan 13, 2010 at 9:48 AM, John Doe wrote:
  It means, if you don't use -nochroot, the '/', when in post, will be 
 '/mnt/sysimage'.
  If you do use -nochroot, the '/' will be '/'.
 
 Hmmm, that is behaving differently that what I see.
 I have never used --nochroot, and / is /.   For quite some time now in
 %post I've been manipulating files in /etc and they are /etc/ after
 the new image boots.
 Or does --nochroot go in %pre?   Not according to that link I guess

Try this:
in %pre, put in /tmp/foo
Then, use %post with -nochroot and check if /tmp/foo exists

Or maybe, if it exists, use the ramdisk (/dev/shm)...

JD


  
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] more kickstart - saving %pre decisions for %post

2010-01-13 Thread Alan McKay
On Wed, Jan 13, 2010 at 11:53 AM, John Doe jd...@yahoo.com wrote:
 Try this:
 in %pre, put in /tmp/foo
 Then, use %post with -nochroot and check if /tmp/foo exists

I thought of that but I don't want to mess up what I already have
working with manipulating files in /etc
But at least I can try it to see if this much works

 Or maybe, if it exists, use the ramdisk (/dev/shm)...

Will try that as well depending on results from above


-- 
“Don't eat anything you've ever seen advertised on TV”
 - Michael Pollan, author of In Defense of Food
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] more kickstart - saving %pre decisions for %post

2010-01-13 Thread Alan McKay
 I thought of that but I don't want to mess up what I already have
 working with manipulating files in /etc
 But at least I can try it to see if this much works

It did mess up all my /etc work, and did not work anyway

  Or maybe, if it exists, use the ramdisk (/dev/shm)...
 Will try that as well depending on results from above

I just realised this means using /tmp, right?  Which is what I tried
first that did not work.

Looks like my next option is NFS ... hacky, but it seems to be my last option.


-- 
“Don't eat anything you've ever seen advertised on TV”
 - Michael Pollan, author of In Defense of Food
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] more kickstart - saving %pre decisions for %post

2010-01-13 Thread Alan McKay
OK, NFS seems to work so that's my path forward I guess.

Hacky, but works


-- 
“Don't eat anything you've ever seen advertised on TV”
 - Michael Pollan, author of In Defense of Food
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] more kickstart - saving %pre decisions for %post

2010-01-13 Thread Alan McKay
Oh, one caveat for anyone who stumbles upon this - in %pre you do not
need to start nfs but in %post you do, otherwise it will not work.

/etc/init.d/netfs start



-- 
“Don't eat anything you've ever seen advertised on TV”
 - Michael Pollan, author of In Defense of Food
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] more kickstart - saving %pre decisions for %post

2010-01-13 Thread Les Mikesell
On 1/13/2010 1:51 PM, Alan McKay wrote:
 Oh, one caveat for anyone who stumbles upon this - in %pre you do not
 need to start nfs but in %post you do, otherwise it will not work.

 /etc/init.d/netfs start

Are you considering only an initial install or also subsequent updates 
or potential installs that weren't part of the initial set?

-- 
   Les Mikesell
lesmikes...@gmail.com
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] more kickstart - saving %pre decisions for %post

2010-01-13 Thread Alan McKay
On Wed, Jan 13, 2010 at 3:05 PM, Les Mikesell lesmikes...@gmail.com wrote:
 Are you considering only an initial install or also subsequent updates
 or potential installs that weren't part of the initial set?

I don't quite understand the question.

I'm just doing an initial install at the moment.


-- 
“Don't eat anything you've ever seen advertised on TV”
 - Michael Pollan, author of In Defense of Food
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] more kickstart - saving %pre decisions for %post

2010-01-13 Thread Les Mikesell
On 1/13/2010 2:14 PM, Alan McKay wrote:
 On Wed, Jan 13, 2010 at 3:05 PM, Les Mikeselllesmikes...@gmail.com  wrote:
 Are you considering only an initial install or also subsequent updates
 or potential installs that weren't part of the initial set?

 I don't quite understand the question.

 I'm just doing an initial install at the moment.


Never mind - I thought those were RPM items instead of kickstart.

-- 
   Les Mikesell
lesmikes...@gmail.com
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


[CentOS] more kickstart - saving %pre decisions for %post

2010-01-12 Thread Alan McKay
Hey again folks,

How can I save answers to questions in %pre, for use in %post?

I'm assuming (though have not yet tried) that variables won't live that long.

Could I save them off to /tmp in a file, and retrieve them?

e.g.

%pre
echo VARNAME=$VARNAME  /tmp/varfile


%post
grep ^VARNAME= /tmp/varile


Or some such ...

-- 
“Don't eat anything you've ever seen advertised on TV”
 - Michael Pollan, author of In Defense of Food
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] more kickstart - saving %pre decisions for %post

2010-01-12 Thread JohnS

On Tue, 2010-01-12 at 17:42 -0500, Alan McKay wrote:
 Hey again folks,
 
 How can I save answers to questions in %pre, for use in %post?
 
 I'm assuming (though have not yet tried) that variables won't live that long.
 
 Could I save them off to /tmp in a file, and retrieve them?
 
 e.g.
 
 %pre
 echo VARNAME=$VARNAME  /tmp/varfile
 
 
 %post
 grep ^VARNAME= /tmp/varile
 
 
 Or some such ...
---
Never used %pre or how that part really functions but where is the temp
file stored, ram ?  Why not store it in memory registers or I have your
idea wrong?

John  

___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos