The commands may not be available yet when the script is started.
I think this should be fixed in 4.0.8.

In the main time, you can try with the following script:

loadclass = {
  (($.context bundle 0) loadClass $1)
}
dosleep = {
  longClass = (((loadclass java.lang.Long) getField "TYPE") get null)
  threadClass = (loadclass java.lang.Thread)
  sleepMethod = ($threadClass getMethod "sleep" $longClass)
  $sleepMethod invoke null $1
}
not = { if $1 { false  } { true  } }
wait-for-command = {
  while  { not { $.commands contains $1 } } {
    dosleep 50
  }
}
// this first sleep is needed in order to ensure that the if and while
command are available
dosleep 500
wait-for-command "feature:repo-add"
feature:repo-add -i mvn:edu.amherst.acdc/acrepo-karaf/LATEST/xml/features


Cheers,
Guillaume

2016-09-26 22:37 GMT+02:00 emets...@gmail.com <emets...@gmail.com>:

> Hi,
>
> I've upgraded to Karaf 4.0.6, and I'm attempting to script the installation
> of all features in a features repository, without having to enumerate each
> feature.
>
> With the return of the '-i' argument to feature:repo-add, I've added the
> following line to 'etc/shell.init.script':
> feature:repo-add -i mvn:edu.amherst.acdc/acrepo-karaf/LATEST/xml/features
>
> After adding that line, I start the Karaf console and receive the following
> error:
> "Error in initialization script: Command not found: feature:repo-add"
>
> The command works when I copy and paste it into the Karaf console, but does
> not work when appended to to 'etc/shell.init.script'.  Do I mis-understand
> the purpose or syntax of 'etc/shell.init.script', or is this a bug in
> Karaf?
>
> Thanks again,
> Elliot
>
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.
> com/feature-repo-add-i-broken-in-4-0-4-tp4046143p4048173.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>



-- 
------------------------
Guillaume Nodet
------------------------
Red Hat, Open Source Integration

Email: gno...@redhat.com
Web: http://fusesource.com
Blog: http://gnodet.blogspot.com/

Reply via email to