Re: restarting services if config files were changed
> On Mon, 28 Sep 2009 21:29:44 +0200, Andreas Schuldei > said: > i am in the process to create infrastructure for restarting > services which configuration files changed in the current > softupdate run. > currently i plan to set a flag (in an environment variable like > RESTART_FOO). since different services have different > restart/reload/whatnot commands i plan to put the restart/reload > command INTO the variable like this: > RESTART_FOO="/etc/init.d/FOO restart" You may want to use the postinst script of fcopy(8) to write the variables to a file. This postinst script will only be executed, if fcopy changed the target file. -- regards Thomas
Re: setup-storage: set vgname to hostname
Thomas Neumann a écrit : You can write a hook that replaces $HOSTNAME with the current hostname. This is the easiest way. As a bonus: It even works! ;) tschüß thomas do you know wich variable we could use in a way that is supported by FAI . I mean using a variable like $HOSTNAME or whatever would be great but only if this is a normal behavior and not an edge condition as if i upgrade FAI i do not want to have all my partition system stop working. Could you tell us your advice and variable list we could or should not use ? regards, JEan.
Re: setup-storage: set vgname to hostname
hiya > Thomas Neumann a écrit : >>> You can write a hook that replaces $HOSTNAME with the current >>> hostname. This is the easiest way. >> As a bonus: It even works! > do you know wich variable we could use in a way that is supported by FAI > . I mean using a variable like $HOSTNAME or whatever would be great but > only if this is a normal behavior and not an edge condition as if i > upgrade FAI i do not want to have all my partition system stop working. > Could you tell us your advice and variable list we could or should not use > ? 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
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: restarting services if config files were changed
On 09/29/2009 01:38 PM, Thomas Lange wrote: >> On Mon, 28 Sep 2009 21:29:44 +0200, Andreas Schuldei >> said: > > > i am in the process to create infrastructure for restarting > > services which configuration files changed in the current > > softupdate run. > > > currently i plan to set a flag (in an environment variable like > > RESTART_FOO). since different services have different > > restart/reload/whatnot commands i plan to put the restart/reload > > command INTO the variable like this: > > RESTART_FOO="/etc/init.d/FOO restart" > > You may want to use the postinst script of fcopy(8) to write the > variables to a file. This postinst script will only be executed, if > fcopy changed the target file. Ok. But there is nothing like that for ainsl(1), right? (Would be nice if I'm wrong ;)) Greetings, - 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? Greetings, - Darsha
problems with PATTERN/LINE in ainsl(1)
Hi! I have something like this: #! /bin/sh ainsl -a $target/etc/sudoers "%adm ALL = NOPASSWD: /bin/su -[mp]" exit 0 Got the expected output (in /etc/sudoers without LINE): %adm ALL = NOPASSWD: /bin/su -[mp] Running again (now containing LINE) leads to: %adm ALL = NOPASSWD: /bin/su -[mp] %adm ALL = NOPASSWD: /bin/su -[mp] (I obviously exptected no adding..) I then tried: ainsl -a $target/etc/sudoers "%adm ALL = NOPASSWD: /bin/su -\[mp\]" Output (without LINE): %adm ALL = NOPASSWD: /bin/su -\[mp\] Second run (now with LINE): %adm ALL = NOPASSWD: /bin/su -\[mp\] %adm ALL = NOPASSWD: /bin/su -\[mp\] Quoting man ainsl(1): , | If PATTERN is not given, LINE is used instead for matching a line | in FILE. Then LINE may also contain the anchors ’^’ and ’$’ which | are only treated specialy at the beginning or end of the pattern | and are used for matching, not when adding the line. Additionaly, | the following characters are escaped in LINE: ( ) + ` It has something to do with '[' and ']' (it works fine without these characters) but nothing is mentioned in the man-page. Any hints or is this a bug? Greetings, - Darsha
Re: problems with PATTERN/LINE in ainsl(1)
On 30.09.2009 02:32, Darshaka Pathirana wrote: > Hi! > > I have something like this: > > > #! /bin/sh > ainsl -a $target/etc/sudoers "%adm ALL = NOPASSWD: /bin/su -[mp]" > exit 0 > > > Got the expected output (in /etc/sudoers without LINE): > > %adm ALL = NOPASSWD: /bin/su -[mp] > > Running again (now containing LINE) leads to: > > %adm ALL = NOPASSWD: /bin/su -[mp] > %adm ALL = NOPASSWD: /bin/su -[mp] > > (I obviously exptected no adding..) > > I then tried: > > ainsl -a $target/etc/sudoers "%adm ALL = NOPASSWD: /bin/su -\[mp\]" Oops. Forgot to take the shell into account: ainsl -a $target/etc/sudoers "%adm ALL = NOPASSWD: /bin/su -\\[mp\\]" This works like a charm but I wonder why I have to escape '[' and ']'? Did I miss something? Greetings, - Darsha
Re: problems with PATTERN/LINE in ainsl(1)
On 30.09.2009 02:40, Darshaka Pathirana wrote: > On 30.09.2009 02:32, Darshaka Pathirana wrote: >> Hi! >> >> I have something like this: >> >> >> #! /bin/sh >> ainsl -a $target/etc/sudoers "%adm ALL = NOPASSWD: /bin/su -[mp]" >> exit 0 >> >> >> Got the expected output (in /etc/sudoers without LINE): >> >> %adm ALL = NOPASSWD: /bin/su -[mp] >> >> Running again (now containing LINE) leads to: >> >> %adm ALL = NOPASSWD: /bin/su -[mp] >> %adm ALL = NOPASSWD: /bin/su -[mp] >> >> (I obviously exptected no adding..) >> >> I then tried: >> >> ainsl -a $target/etc/sudoers "%adm ALL = NOPASSWD: /bin/su -\[mp\]" > > Oops. Forgot to take the shell into account: > > ainsl -a $target/etc/sudoers "%adm ALL = NOPASSWD: /bin/su -\\[mp\\]" Quagl. This same line fails on a different machine (but also Debian/Lenny but not created with FAI - shell is also bash). Using fai-client 3.2.17~lenny1 and then 3.2.20.1. I am out of options (or maybe its just too late to work on this). Any help greatly appreciated. Thanks! Greetings, - Darsha