Re: setup-storage: set vgname to hostname
On 09/30/2009 12:11 AM, Jean Spirat wrote: I think you don't use a proper hook. Let me try to elaborate: - Create a disk config disk_config/SOMETHING that has ##HOSTNAME## in the places you'd like to see $HOSTNAME to be replaced. - Add a hook hooks/partition.DEFAULT that does the following: cp $FAI/disk_config/SOMETHING $FAI/disk_config/$HOSTNAME sed -i s/##HOSTNAME##/$HOSTNAME/ $FAI/disk_config/$HOSTNAME That should be about it, I think. I haven't actually tested this, so others might want to correct me. This will break if $FAI is not writeable. (Usually it is.) This procedure may be somewhat safer if you use -f to feed setup-storage its new config file. (My hook replaces different values, but this shouldn't matter much. The file uses $FAI/disk_config/DISKlvm as its template, which is also attached to this mail.) [Please ignore the call to /tmp/fai/IDENTITY.] tschüß thomas partition.DISKlvm Description: Binary data DISKlvm Description: Binary data
Re: setup-storage: set vgname to hostname
On 10/15/2009 10:10 PM, Michael Tautschnig wrote: Darshaka Pathirana wrote: Hmm. I don't think I understand what you mean. I mean I HAVE tried using $HOSTNAME in my disk_config-layout with setup-storage and it did NOT work (at least for me - see my first post in this thread). Maybe I've done a mistake? I think you don't use a proper hook. Let me try to elaborate: - Create a disk config disk_config/SOMETHING that has ##HOSTNAME## in the places you'd like to see $HOSTNAME to be replaced. - Add a hook hooks/partition.DEFAULT that does the following: cp $FAI/disk_config/SOMETHING $FAI/disk_config/$HOSTNAME sed -i s/##HOSTNAME##/$HOSTNAME/ $FAI/disk_config/$HOSTNAME That should be about it, I think. I haven't actually tested this, so others might want to correct me. Nice. I will try that on my next deployment and report back. Thank you. Greetz, - Darsha
Re: setup-storage: set vgname to hostname
On 09/30/2009 12:11 AM, Jean Spirat wrote: I prefer using my own variables in my own namespace and initialize them from a known good source - like $HOSTNAME. This may not be the most obvious solution, but this way you can guarantee that your variable has a valid value. And if $HOSTNAME turns out to be unrealiable - or undesired - then you could easily change the source (like maybe retrieving the value from an external database.) without having to wade through the rest of the source code trying hard not to introduce new bugs. ok so any defined variables can be used in setup storage (like in http://www.informatik.uni-koeln.de/fai/fai-guide/ch-config.html#s-classvariables). I had not thinked of this before i was seeing this as a static file. good to know thanks :) Hmm. I don't think I understand what you mean. I mean I HAVE tried using $HOSTNAME in my disk_config-layout with setup-storage and it did NOT work (at least for me - see my first post in this thread). Maybe I've done a mistake? I think you don't use a proper hook. Let me try to elaborate: - Create a disk config disk_config/SOMETHING that has ##HOSTNAME## in the places you'd like to see $HOSTNAME to be replaced. - Add a hook hooks/partition.DEFAULT that does the following: cp $FAI/disk_config/SOMETHING $FAI/disk_config/$HOSTNAME sed -i s/##HOSTNAME##/$HOSTNAME/ $FAI/disk_config/$HOSTNAME That should be about it, I think. I haven't actually tested this, so others might want to correct me. Best, Michael pgp1PkJxy3bYE.pgp Description: PGP signature
Re: setup-storage: set vgname to hostname
I prefer using my own variables in my own namespace and initialize them from a known good source - like $HOSTNAME. This may not be the most obvious solution, but this way you can guarantee that your variable has a valid value. And if $HOSTNAME turns out to be unrealiable - or undesired - then you could easily change the source (like maybe retrieving the value from an external database.) without having to wade through the rest of the source code trying hard not to introduce new bugs. tschüß thomas ok so any defined variables can be used in setup storage (like in http://www.informatik.uni-koeln.de/fai/fai-guide/ch-config.html#s-classvariables). I had not thinked of this before i was seeing this as a static file. good to know thanks :) regards, JEan
Re: setup-storage: set vgname to hostname
On 09/30/2009 12:11 AM, Jean Spirat wrote: I prefer using my own variables in my own namespace and initialize them from a known good source - like $HOSTNAME. This may not be the most obvious solution, but this way you can guarantee that your variable has a valid value. And if $HOSTNAME turns out to be unrealiable - or undesired - then you could easily change the source (like maybe retrieving the value from an external database.) without having to wade through the rest of the source code trying hard not to introduce new bugs. ok so any defined variables can be used in setup storage (like in http://www.informatik.uni-koeln.de/fai/fai-guide/ch-config.html#s-classvariables). I had not thinked of this before i was seeing this as a static file. good to know thanks :) Hmm. I don't think I understand what you mean. I mean I HAVE tried using $HOSTNAME in my disk_config-layout with setup-storage and it did NOT work (at least for me - see my first post in this thread). Maybe I've done a mistake? Greetings, - Darsha
Re: setup-storage: set vgname to hostname
On 24.09.2009 12:30, Thomas Neumann wrote: On 24.09.2009 10:50, Thomas Lange wrote: You can write a hook that replaces $HOSTNAME with the current hostname. This is the easiest way. As a bonus: It even works! ;) Cool! Thx! I'll give it a try! Just to be sure: I am really supposed to write a hook-script that modifies the (disk_config)-config-file? Greetings, - Darsha
Re: setup-storage: set vgname to hostname
On Thu, 24 Sep 2009 10:47:50 +0200, Darshaka Pathirana d...@syn-net.org said: Is there a way to set the vg-name same as the current hostname? Something like this (which does NOT work): , | disk_config sda bootable:1 fstabkey:uuid | primary /boot 250 ext3 rw | primary - 1500- - - | disk_config lvm | vg $HOSTNAME sda2 | $HOSTNAME-root / 250- ext3 rw,errors=remount-ro | $HOSTNAME-swap swap250-1000 swap sw | $HOSTNAME-var /var500-2Gext3 rw createopts=-m15 tuneopts=-c0 -i0 | $HOSTNAME-tmp /tmp250-1000 ext3 rw createopts=-m1 tuneopts=-c0 -i0 | $HOSTNAME-usr /usr500-3Gext3 rw tuneopts=-c0 -i0 | $HOSTNAME-home /home 100-2Gext3 rw,nosuid createopts=-m1 tuneopts=-c0 -i10 ` You can write a hook that replaces $HOSTNAME with the current hostname. This is the easiest way. -- regards Thomas