Skip to content

Commit

Permalink
ESH update + upgrade to Karaf 4.1.3 and Jetty 9.3.22 (#570)
Browse files Browse the repository at this point in the history
- forced Pax-Web and Karaf to use Jetty 9.3.22 by packaging a fixed feature definition for them
- included LSP as a core feature
- added Serial Button binding

Signed-off-by: Kai Kreuzer <kai@openhab.org>
  • Loading branch information
kaikreuzer committed Nov 18, 2017
1 parent 9df5fdc commit 2c27919
Show file tree
Hide file tree
Showing 9 changed files with 1,616 additions and 68 deletions.
3 changes: 2 additions & 1 deletion distributions/openhab/pom.xml
Expand Up @@ -55,7 +55,6 @@
</dependencies>

<build>

<pluginManagement>
<plugins>
<plugin>
Expand Down Expand Up @@ -120,6 +119,8 @@
</startupFeatures>
<bootFeatures>
<feature>jaas</feature>
<feature>jetty</feature>
<feature>http</feature>
<feature>shell</feature>
<feature>ssh</feature>
<feature>bundle</feature>
Expand Down
3 changes: 3 additions & 0 deletions distributions/openhab/src/main/descriptors/archive.xml
Expand Up @@ -33,6 +33,9 @@
<fileSet>
<directory>target/assembly</directory>
<outputDirectory>runtime</outputDirectory>
<excludes>
<exclude>system/org/eclipse/jetty/**/9.3.14.v20161028/**</exclude>
</excludes>
<includes>
<include>lib/**</include>
<include>system/**</include>
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -0,0 +1,242 @@
//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
//
// This script is run each time a shell is created.
// You can define here closures or variables that will be available
// in each session.
//

__option_not_present = {
res = true
opts = $argv
each $opts {
arg = $it
each ($.commandLine words) {
if { ($it toString) equals ($arg toString) } {
res = false
}
}
}
$res
}

__set_unset_arguments = {
is_setopt = (($.commandLine words) get 0) equals "setopt"
enums = ((__load_class 'org.jline.reader.LineReader$Option') enumConstants)
candidates = new ArrayList
each $enums {
name = ${(GL)it/_/-}
is_set = ($.reader isSet $it)
neg = %(( if(is_setopt, is_set, not(is_set)) ))
if { $neg } {
name = "no-${name}"
}
if { not { (($.commandLine words) subList 1 ($.commandLine wordIndex)) contains $name } } {
$candidates add (new org.jline.reader.Candidate $name $name (if { $neg } { "unset" } { "set" }) null null null true)
}
}
$candidates
}

jlineReader = $.reader
if { %(jlineReader != null) } {

complete -c shell:complete -e
complete -c shell:complete -d "Edit command specific completions"
complete -c shell:complete -s c -l command --description "Command to add completion to" -n '__option_not_present -c --command' -a '$.commands'
complete -c shell:complete -s s -l short-option --description "Posix-style option to complete" -n '__option_not_present -s --short-option'
complete -c shell:complete -s l -l long-option --description "GNU-style option to complete" -n '__option_not_present -l --long-option'
complete -c shell:complete -s a -l arguments --description "A list of possible arguments" -n '__option_not_present -a --argument'
complete -c shell:complete -s d -l description --description "Description of this completions" -n '__option_not_present -d --description'
complete -c shell:complete -s h -l help --description "Display help and exit" -n '__option_not_present -h --help'
complete -c shell:complete -s n -l condition --description "The completion should only be used if the specified command has a zero exit status" -n '__option_not_present -n --condition'
complete -c shell:complete -s e -l erase --description "Remove completion" -n '__option_not_present -e --erase'

complete -c shell:history -e
complete -c shell:history -d "Show and manipulate command history"
complete -c shell:history -l clear --description "Clear history" -n '__option_not_present --clear'
complete -c shell:history -l save --description "Save history" -n '__option_not_present --save'

complete -c shell:setopt -e
complete -c shell:setopt -d "Set or view set shell options"
complete -c shell:setopt -a '__set_unset_arguments'

complete -c shell:unsetopt -e
complete -c shell:unsetopt -d "Unset or view unset shell options"
complete -c shell:unsetopt -a '__set_unset_arguments'

complete -c shell:cat -e
complete -c shell:cat -d "Concatenate and print files"
complete -c shell:cat -s n "Number the output lines, starting at 1"
complete -c shell:cat -a '__files'

complete -c shell:pwd -e
complete -c shell:pwd -d "Get current directory"

complete -c shell:ls -e
complete -c shell:ls -d "List files"

complete -c shell:cd -e
complete -c shell:cd -d "Change current directory"
complete -c shell:cd -a '__directories'

complete -c shell:sleep -e
complete -c shell:sleep -d "Pause execution for the specified amount of time"

complete -c shell:echo -e
complete -c shell:echo -d "Write arguments to the standard output"
complete -c shell:echo -s n -d "No trailing new line"

complete -c shell:grep -e
complete -c shell:grep -d "File pattern searcher"
# TODO

complete -c shell:sort -e
complete -c shell:sort -d "Sort lines of text files"
# TODO

complete -c shell:gosh -e
complete -c shell:gosh -d "Execute script with arguments in a new session"
# TODO

complete -c shell:sh -e
complete -c shell:sh -d "Execute script with arguments in a new session"
# TODO

complete -c shell:source -e
complete -c shell:source -d "Execute script with arguments"
# TODO

# TODO: format getopt new set tac type addcommand removeCommand eval

complete -c shell:break -e
complete -c shell:break -d "Break from a loop"

complete -c shell:continue -e
complete -c shell:continue -d "Continue to next iteration in a loop"

complete -c shell:each -e
complete -c shell:each -d "Loop and execute script on the specified elements"

complete -c shell:if -e
complete -c shell:if -d "Conditionaly execute a script"

complete -c shell:new -e
complete -c shell:new -d "Creates new instance of the given java class"

complete -c shell:not -e
complete -c shell:not -d "Negates the result of a script"

complete -c shell:throw -e
complete -c shell:throw -d "Throws an exception"

complete -c shell:try -e
complete -c shell:try -d "Try executing a script and catch any exception"

complete -c shell:until -e
complete -c shell:until -d "Loop and execute script until a condition is satisfied"

complete -c shell:while -e
complete -c shell:while -d "Loop and execute script while a condition is satisfied"

complete -c shell:less -e
complete -c shell:less -d "File pager"
complete -c shell:less -s e -l quit-at-eof --description "Exit on second EOF"
complete -c shell:less -s E -l QUIT-AT-EOF --description "Exit on EOF"
complete -c shell:less -s q -l quiet -l silent --description "Silent mode"
complete -c shell:less -s Q -l QUIET -l SILENT --description "Completely silent"
complete -c shell:less -s S -l chop-long-lines --description "Do not fold long lines"
complete -c shell:less -s i -l ignore-case --description "Search ignores lowercase case"
complete -c shell:less -s I -l IGNORE-CASE --description "Search ignores all case"
complete -c shell:less -s x -l tabs --description "Set tab stops"
complete -c shell:less -s N -l LINE-NUMBERS --description "Display line number for each line"
complete -c shell:less -a '__files'

complete -c shell:nano -e
complete -c shell:nano -d "File editor"
complete -c shell:nano -a '__files'

complete -c shell:keymap -e
complete -c shell:keymap -d "Manipulate keymaps"
complete -c shell:keymap -s N --description "Create a new keymap" -n '__option_not_present -N -d -D -l -r -s -A'
complete -c shell:keymap -s d --description "Delete existing keymaps and reset to default state" -n '__option_not_present -N -d -D -l -r -s -A'
complete -c shell:keymap -s D --description "Delete named keymaps" -n '__option_not_present -N -d -D -l -r -s -A'
complete -c shell:keymap -s l --description "List existing keymap names" -n '__option_not_present -N -d -D -l -r -s -A'
complete -c shell:keymap -s r --description "Unbind specified in-strings" -n '__option_not_present -N -d -D -l -r -s -A'
complete -c shell:keymap -s s --description "Bind each in-string to each out-string" -n '__option_not_present -N -d -D -l -r -s -A'
complete -c shell:keymap -s A --description "Create alias to keymap" -n '__option_not_present -N -d -D -l -r -s -A'
complete -c shell:keymap -s e --description "Select emacs keymap and bind it to main" -n '__option_not_present -e -a -v -M'
complete -c shell:keymap -s v --description "Select viins keymap and bind it to main" -n '__option_not_present -e -a -v -M'
complete -c shell:keymap -s a --description "Select vicmd keymap" -n '__option_not_present -e -a -v -M'
complete -c shell:keymap -s M --description "Specify keymap to select" -n '__option_not_present -e -a -v -M' -a '(keymap -l | tac) split " "'
complete -c shell:keymap -s R --description "Interpret in-strings as ranges"
complete -c shell:keymap -s p --description "List bindings which have given key sequence as a a prefix"
complete -c shell:keymap -s L --description "Output in form of keymap commands"

complete -c shell:widget -e
complete -c shell:widget -d "Manipulate widgets"
complete -c shell:widget -s N --description "Create a new widget" -n '__option_not_present -N -A -D -U -l'
complete -c shell:widget -s A --description "Create alias to widget" -n '__option_not_present -N -A -D -U -l'
complete -c shell:widget -s D --description "Delete widgets" -n '__option_not_present -N -A -D -U -l'
complete -c shell:widget -s U --description "Push characters to the stack" -n '__option_not_present -N -A -D -U -l'
complete -c shell:widget -s l --description "List user-defined widgets" -n '__option_not_present -N -A -D -U -l'
complete -c shell:widget -s a --description "With -l, list all widgets" -n '__option_not_present -l'

complete -c shell:bg -e
complete -c shell:bg -d "Put job in background"

complete -c shell:fg -e
complete -c shell:fg -d "Put job in foreground"

complete -c shell:jobs -e
complete -c shell:jobs -d "List jobs"

complete -c shell:clear -e
complete -c shell:clear -d "Clear screen"

complete -c shell:head -e
complete -c shell:head -d "Displays first lines of file"
complete -c shell:head -s n -l lines --description "Print line counts"
complete -c shell:head -s c -l bytes --description "Print byte counts"
complete -c shell:head -a '__files'

complete -c shell:tail -e
complete -c shell:tail -d "Displays last lines of file"
complete -c shell:tail -s q -l quiet --description "Suppress headers when printing multiple sources"
complete -c shell:tail -s f -l follow --description "Do not stop at end of file"
complete -c shell:tail -s F -l FOLLOW --description "Follow and check for file renaming or rotation"
complete -c shell:tail -s n -l lines --description "Number of lines to print"
complete -c shell:tail -s c -l bytes --description "Number of bytes to print"
complete -c shell:tail -a '__files'

complete -c shell:date -e
complete -c shell:date -d "Display date and time"
complete -c shell:date -s u --description "Use UTC"
complete -c shell:date -s r --description "Print the date represented by 'seconds' since January 1, 1970"
complete -c shell:date -s v --description "Adjust date"
complete -c shell:date -s f --description "Use 'input_fmt' to parse 'new_date'"

complete -c shell:wc -e
complete -c shell:wc -d "Word, line, character, and byte count"
complete -c shell:wc -s n -l lines --description "Print line count"
complete -c shell:wc -s c -l bytes --description "Print byte count"
complete -c shell:wc -s m -l chars --description "Print character count"
complete -c shell:wc -s w -l words --description "Print word count"
complete -c shell:wc -a '__files'

}
Expand Up @@ -33,24 +33,32 @@ service:get = { $.context getService ($.context getServiceReference $args) };

env = { shell:set $args }
edit = { shell:nano $args }
more = { shell:less $args }

//prompt = "${USER}@${APPLICATION}(${SUBSHELL})> "
more = { shell:less -F $args }

__load_class = {
(($.reader class) classLoader) loadClass $1
}

# On 256 colors terminal, add a right prompt
max_colors = ($.jline.terminal getNumericCapability max_colors)
if { %(max_colors >= 256) } {
__rprompt_formatter = (((__load_class java.text.SimpleDateFormat) getConstructor (__load_class java.lang.String)) newInstance \'$'\u001B\[90m'\'HH:mm:ss)
__date_class = (__load_class java.util.Date)
\#rprompt = { $__rprompt_formatter format ($__date_class newInstance) }
}
// make sure that we catch exceptions
// as they do occur if the session is headless / non-interactive
jlineReader = $.reader
if { %(jlineReader != null) } {

setopt group
keymap "^[OA" up-line-or-search
keymap "^[OB" down-line-or-search
# On 256 colors terminal, add a right prompt
max_colors = ($.jline.terminal getNumericCapability max_colors)
if { %(max_colors >= 256) } {
__rprompt_formatter = (((__load_class java.text.SimpleDateFormat) getConstructor (__load_class java.lang.String)) newInstance \'$'\u001B\[90m'\'HH:mm:ss)
__date_class = (__load_class java.util.Date)
// Do not use right prompt by default
// \#rprompt = { $__rprompt_formatter format ($__date_class newInstance) }
}

setopt group
setopt auto-fresh-line
unsetopt insert-tab
keymap "^[OA" up-line-or-search
keymap "^[[A" up-line-or-search
keymap "^[OB" down-line-or-search
keymap "^[[B" down-line-or-search

}
9 changes: 4 additions & 5 deletions features/addons-esh/src/main/feature/feature.xml
Expand Up @@ -35,6 +35,10 @@
<feature>esh-binding-ntp</feature>
</feature>

<feature name="openhab-binding-serialbutton" description="Serial Button Binding" version="${project.version}">
<feature>esh-binding-serialbutton</feature>
</feature>

<feature name="openhab-binding-sonos" description="Sonos Binding" version="${project.version}">
<feature>esh-binding-sonos</feature>
<config name="binding.sonos">
Expand Down Expand Up @@ -137,9 +141,4 @@
<feature>esh-extensionservice-marketplace</feature>
</feature>

<feature name="openhab-misc-lsp" description="Language Server Support" version="${project.version}">
<feature>openhab-runtime-base</feature>
<feature>esh-model-lsp</feature>
</feature>

</features>

0 comments on commit 2c27919

Please sign in to comment.