openhab / openhabian

openHABian - empowering the smart home, for Raspberry Pi and Debian systems
https://community.openhab.org/t/13379
ISC License
820 stars 252 forks source link

replace motd to match OH2 or OH3 #1273

Closed mstormi closed 3 years ago

mstormi commented 3 years ago

on login to the box

make sure to change motd when migrating OH2<->OH3

ecdye commented 3 years ago

I think I already fixed this? Did you test?

mstormi commented 3 years ago

I just tried on my test box with current master and no it's still the 2.5 banner. I think you said it would get changed on a fresh install, that I haven't tried, but either way I would expect this to also change when you up/downgrade OH through the menu.

(just to be sure we don't misunderstand: this is on ssh login - not in Karaf console).

ecdye commented 3 years ago

Yes, perhaps I never merged it, I'll look into it.

ecdye commented 3 years ago

I see what happened, it is a merge conflict and was overwritten on the OH3 branch. I'm fixing it now.

ecdye commented 3 years ago

Actually, I was wrong, the code is in place the problem is that the branch update occurs after the migration and it must because it forces a restart of the tool to load the changes. I will look into a workaround.

mstormi commented 3 years ago

Ran a downgrade to OH2 and ended up with

+ echo 'The tool will now restart to load the updates... OK'
The tool will now restart to load the updates... OK
+ exec '/opt/openhabian/openhabian-setup.sh migration'
/opt/openhabian/functions/openhabian.bash: line 183: /opt/openhabian/openhabian-setup.sh migration: No such file or directory
[21:08:21] root@openHABianDevice:/home/openhabian# ls -l /opt/openhabian/openhabian-setup.sh
-rwxr-xr-x 1 root root 3258 Dec  1 21:08 /opt/openhabian/openhabian-setup.sh
[21:08:45] root@openHABianDevice:/home/openhabian#

bad quotes?

mstormi commented 3 years ago

it was bad quotes, I fixed it

mstormi commented 3 years ago

I got this on a fresh install (which has openhab2 installed by default so wrong banner and wrong userdata dir)

sed: /var/lib/openhab/etc/version.properties kann nicht gelesen werden: Datei od er Verzeichnis nicht gefunden sed: /var/lib/openhab/etc/version.properties kann nicht gelesen werden: Datei od er Verzeichnis nicht gefunden

                      _   _     _     ____   _

| | | | / \ | ) () ____ / \ / \ / \ / \ | || | / \ | \ | | / \ / \ | () | (_) | /| | | || | / \ | |) )| || () || | | | _/| / _/|| |||| ||// \|__/ || _|||| | | |_| -

mstormi commented 3 years ago

the thing is we need to change /home/openhabian/.bash_profile, too. We should change it to no longer include the logo but to a) identify the installed OH version (via openhab2_is_installed in openhab.bash) and b) display the logo you installed here. Could you please take care of that ? Dunno where your OH3 logo is (ok, lame excuse :))

ecdye commented 3 years ago

the thing is we need to change /home/openhabian/.bash_profile, too.

Yes that should be taken care of already. It is most likely caused by the branch switching, that it is not taken care of on first install. I don't think it is really necessary to do much more than we have already as OH3 will enter stable soon and it wont matter.

FWIW I think we should just change the logo for all installations now in the code and let it stay the same until the user updates to a new OHian version. That way we save ourselves a lot of work and issues.

mstormi commented 3 years ago

Isn't all that's left to replace the inline picture with the external one you keep installing on up & downgrade or am I mistaken? Now if I'm wrong and it's way more difficult then we should proceed as you suggested but if it's just a bit more work then let's keep version dependent logos. I like the idea of instant recognition which version is installed thanks to the logo.

ecdye commented 3 years ago

Yes, that should be fixing it properly already, right?

mstormi commented 3 years ago

no as .bash_profile ain't replaced on OH up/downgrades. So inline image out and cat /path/to/image/that/i/dont/know/image.txt in.

ecdye commented 3 years ago

It should not be necessary as it should be switched with the branch, right? on OH3 branch it will update to OH3 logo, on OH2 branch it will update to OH2 logo. Manual installations are not supported and ore the only case where this would not be switched.

mstormi commented 3 years ago

No .bash_profile does not get replaced on OH up- or downgrades. So the user will have the inline image forever that is current at the time of image install (when .bash_profile gets created/copied). That'll remain even when he upgrades and changes branch. Do we talk about different things?

ecdye commented 3 years ago

The Image is in .bash_profile which because of the branch migration I have set to copy over after each upgrade currently. Look at the code.

mstormi commented 3 years ago

have set to copy over after each upgrade currently. Look at the code.

I don't see it. Granted need some more coffee but I think it's in bashrc_copy() which is only called via menu 1X or during unattended install. or?

ecdye commented 3 years ago

Yes, but I changed that temporarily during our transition phase to keep it up to date.

mstormi commented 3 years ago

well then

If you find the time please install another test system and up/downgrade it. It kept failing in my attempts but I don't know what to make of it yet.

mstormi commented 3 years ago

I'm not the only one. https://community.openhab.org/t/migration-from-oh2-5-to-oh3/110769

Could you please fix this once and for all ? I still think the banner should not be inline in .bash_profile but those lines of code should be changed to print some filename. We could source /opt/openhabian/functions/openhab.bash and use openhab3_is_installed() from inside .bash_profile to determine which file to contain the banner to print and put both as files into the includes/ folder in both branches so they get downloaded on tool updates, too.

ecdye commented 3 years ago

Perhaps, but at this point, is it really necessary? OH3 is here and stable.

mstormi commented 3 years ago

Perhaps, but at this point, is it really necessary? OH3 is here and stable.

Yes please. Only a small fraction of users has migrated so far, many play around, some migrate forth and back, there's still many more who have not started, to follow up in the next days and weeks. Then there probably is an upgrade path some users take that we did not think of such as here (just one example, there's more) https://community.openhab.org/t/issues-after-upgrade-from-oh2-to-oh3-openhabian/111033/5).

We must not expect users to understand the background and it's really confusing whenever the banner does not match the software version. Pretty please change it.

ecdye commented 3 years ago

When I have time after the holiday, I will work on a fix.