Linux package improvements

linux
openhabian
improvements
Tags: #<Tag:0x00007f212ec78ca0> #<Tag:0x00007f212ec78958> #<Tag:0x00007f212ec787a0>

(Ben Clark) #1

Hi all,

Some of you may have noticed a couple of extra changes in the Linux packages, and I just wanted to share with you what’s been going on and what is available to you now. These changes affect anyone on an automatic Linux install, be it .deb (including openHABian) or .rpm based.

openhab-cli (Command Line Interface)

Most of the time, openHAB behaves like a server and we won’t have to interact with it once setup. However if things don’t work as intended many have had difficulty checking what’s going on, we’ve introduced a command line interface to make things a bit easier.

This allows you to type openhab-cli from any directory in the terminal, followed by a command to quickly execute it.

Usage:  openhab-cli command [options]

Possible commands:
    start [--debug]        -- Starts an openHAB instance in the current terminal.
    stop                   -- Stops any running instance of openHAB.
    status                 -- Checks to see if openHAB is running.
    console                -- Opens the openHAB (Karaf) console.
    backup [filename]      -- Stores the current configuration of openHAB.
    restore filename       -- Restores the state of openHAB to a backup.
    showlogs               -- Displays the log messages of openHAB as they appear.
    info                   -- Displays information about the openHAB setup.

If in doubt, to see the list of commands in the terminal (there may be more commands to come), simply type:

openhab-cli --help

Of particular use is the openhab-cli info command, which gives a list of common properties and what they’re set to in-order to help resolve a problem!

Path Environment Variables

You may have also noticed that the snapshots contain $OPENHAB_* variables, for you to use from any shell to reference a specific location. This way, instead of remembering where things should be, you can use for example:

tail -f $OPENHAB_LOGDIR/events.log
rm -rf ${OPENHAB_USERDATA:?}/tmp/*

You can see all openHAB related variables and what they’re set to using:

printenv | grep "OPENHAB_"

Warning: You should never pair commands like rm -rf with shortcuts like $VAR\*. If $VAR doesn’t exist, you may end up trying to delete your file system. You may think that the variable exists, but you should always air on the side of caution, and use ${VAR:?} instead. This only executes the command if the variable is not empty.

openHAB Testing Repository

The testing repository previously did not contain the latest 2.1.0 version of openHAB. This was only just brought to my attention recently, but I have now added it. Apologies for the delay!

For anyone using only the testing repository. You will now be able to update to version 2.1.0. Since it has only been built now, you also get access to the above features! The version of the package is not strictly the same as what’s available in the stable repo because of this, thus the version has been named “2.1.0-2”

There have been many changes (some of them could be breaking) that you may be aware of since 2.0.0~RC1, please have a look at the list here!

Suggestions/Bug Reports

For any feedback or help getting something working, please feel free to make a thread here on the forums. However, if you have any bugs or suggestions of improvement with the specific Linux packages, or the scripts described above then please create an issue at the linuxpkg repo

Kind Regards,
Ben


(Rich Koshak) #2

I would heed this advice and use the ${OPENHAB_USERDATA:?} on your rm -rf example and use your Warning to explain why and what it does. I hate to see an example followed immediately by “don’t do that”.

Wonderful and very useful changes. Thanks!


(Ben Clark) #3

I’ve edited my post to correct for that :wink: . Silly me!


(Miika Jukka) #4

Just switched from stable to testing and tested new cli tool. Really nice feature and I’m sure it comes handy at some point! Might be nothing important but version shows 2.1.0 (release version) and not 2.1.0-2 as you stated.

Thank you!
/Miika


(Ben Clark) #5

Hi @gitMiguel, glad you think so!

The version of openHAB hasn’t changed, in-fact the run-time is identical. Only the other stuff that’s packaged in “the Linux edition”. The “-2” marks the fact that it’s the second iteration of the Linux package. Hope that makes sense!


(Miika Jukka) #6

Yeah, now it does make sense. My mistake :smile:

Note to self: Think more before posting.