So, the first line of the completion :
have vserver-info && {
: ${UTIL_VSERVER_VARS:=$(vserver-info - SYSINFO |grep prefix: | awk '{ print $2}')/lib/util-vserver/util-vserver-vars}
test -e "$UTIL_VSERVER_VARS" && {
. "$UTIL_VSERVER_VARS"
. "$_LIB_FUNCTIONS"
.....
Why the scripts vserver, vapt-get, vyum, vrpm, vserver-copy and others maybe, don't use this method to test the path of util-vserver-vars ?
Thomas
2006/2/6, Andreas John
Hi Thomas!
Well, you have the deeper insight in your script but would vote for
replacing this line
": ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars}"
whith something based on
echo $(vserver-info - SYSINFO |grep prefix: | awk '{ print $2
}')lib/util-vserver/util-vserver-vars
What do you think? This way you would get all pathes as long as
vserver-info is in the path (that should be always the case on running
hosts).
rdds,
Andreas
P.S. You can replace the awk stuff by bash's internal regex handling.
This was like ... eh ... ${i/foo/bar}, ${i/foo#bar} and such. Too busy
to look it up now ...
Thomas Champagne wrote:
> Hi Andreas
>
> To test if the util-vserver command is installed, I've just copied the
> test at the beginning of the script "vserver". I don't know if it is
> the good way to do it !!
> But this test is written in hard in the source code in the script "vserver".
>
> What do we do ? Use this test or use the command "vserver-info" ?
>
> Thomas
>
>
> 2006/2/5, Andreas John
>
>>Hi Thomas!
>>
>>Thomas Champagne wrote:
>>
>>>After a weekend of shopping, I'm come back.
>>>So, I create a page in the wiki :
>>>http://linux-vserver.org/Vserver+Completion
>>>And I create a link in the home page.
>>>If you want others completions for others commands, tell it me.
>>>Thomas
>>
>>Well, I would prefer if you would use "vserver-info - SYSINFO" to figure
>> out where 'util-vserver-vars' resides, e.g. in my case it's not on
>>/usr/lib/util-vserver/util-vserver-vars, but
>>/usr/local/lib/util-vserver/util-vserver-vars.
>>
>>Rgds,
>>Andreas
>>
>>P.S. Nice work anyway! I use it in production!
>>
>
>
--
Andreas John
net-lab GmbH
Luisenstrasse 30b
63067 Offenbach
Tel: +49 69 85700331
http://www.net-lab.net
_______________________________________________ Vserver mailing list Vserver@list.linux-vserver.org http://list.linux-vserver.org/mailman/listinfo/vserver