Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Fedora Marketing (http://www.linux-archive.org/fedora-marketing/)
-   -   Upating variables from a %pre script (http://www.linux-archive.org/fedora-marketing/699062-upating-variables-pre-script.html)

Matt Bryant 08-30-2012 04:43 AM

Upating variables from a %pre script
 
All,

I was wondring if someone could point me in the right direction Is it
possible to update a vaiable in kickstart file give user input in a %pre
script. Basically i have a varibale buildType and whilst I can override
the default value of the profile using ksmeta input when adding a system
to cobbler would like to also be able to override given user input from
%pre script.


Have tried just about everything i can think of including creating a
file ks.settings which held the variations


#set global $buildType = "value"
#set global buildType ="value"
#set buildType = "value"
#set $buildType = "value"

then doing a #include but that doesnt seem to work ...

Is there in fact a way this can be done ??

Any help appreciated.

rgds

Matt B.

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

Adrian Cruceru 08-30-2012 08:42 AM

Upating variables from a %pre script
 
Hi Matt,

In kickstart file you could use:

%include /tmp/configvalue.txt

And in %pre you could just add whatever you want in that file, given
kickstart syntax.

i.e: echo "bootloader --location=mbr" > /tmp/configvalue.txt

Regards,
Adrian

On 08/30/2012 07:43 AM, Matt Bryant wrote:

All,

I was wondring if someone could point me in the right direction Is it
possible to update a vaiable in kickstart file give user input in a
%pre script. Basically i have a varibale buildType and whilst I can
override the default value of the profile using ksmeta input when
adding a system to cobbler would like to also be able to override
given user input from %pre script.


Have tried just about everything i can think of including creating a
file ks.settings which held the variations


#set global $buildType = "value"
#set global buildType ="value"
#set buildType = "value"
#set $buildType = "value"

then doing a #include but that doesnt seem to work ...

Is there in fact a way this can be done ??

Any help appreciated.

rgds

Matt B.

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list



_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

Matt Bryant 08-30-2012 10:30 AM

Upating variables from a %pre script
 
Adrian,

Thats what I thought but I was getting an error and in fact the
kickstart was bombing out with an error and from what i could see it was
as if the include file was trying to be sourced before it actually existed.
Whats interesting is that after seeing your reply I tweaked the
kickstart so instead of saying somthign like


#if $userConfig == "1"
$SNIPPET('spacewalk/1/user_input')
%include /tmp/ks.settings
#end if

which completed failed I changed to

#if $userConfig == "1"
%pre --interpreter /usr/bin/python
$SNIPPET('spacewalk/1/user_input')
%end
%include /tmp/ks.settings
#end if

Now, this didnt fully work but at least it didnt crash out either ....
at the end of the snippet i had a file /tmp/ks.settings with


#set global $buildType = "CUSTOMER"

which to my mind should update the kickstrt profiles buildType variable
but the code later in the kickstart


ie

#if $buildType != "INTERNAL"
$SNIPPET('spacewalk/1/packages.customer')
#end if

suggests otherwise ie the extra packages in the snippet are not
installed ...



Its starting to get a little frustrating since from all that I have read
this should work ,,,,


rgds

Matt B


On 30/08/12 18:42, Adrian Cruceru wrote:

Hi Matt,

In kickstart file you could use:

%include /tmp/configvalue.txt

And in %pre you could just add whatever you want in that file, given
kickstart syntax.
i.e: echo "bootloader --location=mbr" > /tmp/configvalue.txt

Regards,
Adrian

On 08/30/2012 07:43 AM, Matt Bryant wrote:

All,

I was wondring if someone could point me in the right direction Is it
possible to update a vaiable in kickstart file give user input in a
%pre script. Basically i have a varibale buildType and whilst I can
override the default value of the profile using ksmeta input when
adding a system to cobbler would like to also be able to override
given user input from %pre script.

Have tried just about everything i can think of including creating a
file ks.settings which held the variations

#set global $buildType = "value"
#set global buildType ="value"
#set buildType = "value"
#set $buildType = "value"

then doing a #include but that doesnt seem to work ...

Is there in fact a way this can be done ??

Any help appreciated.

rgds

Matt B.

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list





_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

Adrian Cruceru 08-30-2012 11:25 AM

Upating variables from a %pre script
 
Hi Matt,

I think I lead you down a wrong path, you are looking I think for
cobbler specific items.

I was referring for kickstart specific items, apologize for that.

One thing to keep in mind with kickstart, the "%include" you've put in
is only read/parsed after all "%pre" scripts are run.


Regards,
Adrian

On 08/30/2012 01:30 PM, Matt Bryant wrote:

Adrian,

Thats what I thought but I was getting an error and in fact the
kickstart was bombing out with an error and from what i could see it
was as if the include file was trying to be sourced before it actually
existed.
Whats interesting is that after seeing your reply I tweaked the
kickstart so instead of saying somthign like


#if $userConfig == "1"
$SNIPPET('spacewalk/1/user_input')
%include /tmp/ks.settings
#end if

which completed failed I changed to

#if $userConfig == "1"
%pre --interpreter /usr/bin/python
$SNIPPET('spacewalk/1/user_input')
%end
%include /tmp/ks.settings
#end if

Now, this didnt fully work but at least it didnt crash out either ....
at the end of the snippet i had a file /tmp/ks.settings with


#set global $buildType = "CUSTOMER"

which to my mind should update the kickstrt profiles buildType
variable but the code later in the kickstart


ie

#if $buildType != "INTERNAL"
$SNIPPET('spacewalk/1/packages.customer')
#end if

suggests otherwise ie the extra packages in the snippet are not
installed ...



Its starting to get a little frustrating since from all that I have
read this should work ,,,,


rgds

Matt B


On 30/08/12 18:42, Adrian Cruceru wrote:

Hi Matt,

In kickstart file you could use:

%include /tmp/configvalue.txt

And in %pre you could just add whatever you want in that file, given
kickstart syntax.
i.e: echo "bootloader --location=mbr" > /tmp/configvalue.txt

Regards,
Adrian

On 08/30/2012 07:43 AM, Matt Bryant wrote:

All,

I was wondring if someone could point me in the right direction Is it
possible to update a vaiable in kickstart file give user input in a
%pre script. Basically i have a varibale buildType and whilst I can
override the default value of the profile using ksmeta input when
adding a system to cobbler would like to also be able to override
given user input from %pre script.

Have tried just about everything i can think of including creating a
file ks.settings which held the variations

#set global $buildType = "value"
#set global buildType ="value"
#set buildType = "value"
#set $buildType = "value"

then doing a #include but that doesnt seem to work ...

Is there in fact a way this can be done ??

Any help appreciated.

rgds

Matt B.

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list








_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


All times are GMT. The time now is 04:47 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.