Official command to get the version of Haiku

Related to Any command to get version string like "R1/beta4"?.

I know there is uname but it can not get the beta version.
I can read attributes of libbe.so with catattr or version but they are a little bit hacky for me.

Windows has ver, macOS has sw_vers, some Linux distros have lsb_release, and FreeBSD has freebsd-version.

It would be great if there was an official command to get the version string like R1/beta4.
I think a simple shell script is enough. like this.

~> haikuver
R1/beta4 hrev56578+95

(edit)
Or you can add cli support to the AboutSystem app.

~> AboutSystem -v
R1/beta4 (Revision hrev56578+95) x86_64
1 Like

I am quite suprised you would use this interface for your software, would the sysctl interface not make more sense? It has more info and is more easily parseable.

https://man.freebsd.org/cgi/man.cgi?query=sysctl&sektion=3&apropos=0&manpath=FreeBSD+14.1-RELEASE+and+Ports

Anyway, if any new interface needs to be added using sysctl makes the most sense to me (compared to adding haiku-specific commands)

Duo to the way Haiku launches apps this would be difficult, aboutsystem is flagged as a single launch application, and thus on second invocation will just put the already running aboutsystem in focus, and not show anything on your tty interface.

1 Like

Thanks for your reply.

I am quite suprised you would use this interface for your software

No, I don’t use it. I just wanted to emphysize that other operating systems provided their own commands only to get their versions.

Anyway, if any new interface needs to be added using sysctl makes the most sense to me (compared to adding haiku-specific commands)

It would be great if Haiku got the sysctl command but idk how long it takes until someone works on it.
A simple shell command can be made in a day.

aboutsystem is flagged as a single launch application, and thus on second invocation will just put the already running aboutsystem in focus

You mean, it runs in the background even you close its window? Idk how Haiku apps work.

If you try to launch a GUI application the launch roster will start it, and afterwards send it a message with the commandline (after launch), If you try to launch it a second time it will just deliver the message to the already running application.

1 Like

I edited AboutSystem.cpp and built it as MyAboutSystem.
Then, it surprisingly worked well. (Of course, I used rc and xres to apply AboutSystem.rdef.)

When I type MyAboutSystem while it’s already working, it focuses on the running window. (and it doesn’t create a new window.)
When I type MyAboutSystem -v after that, it displays the version info.

Presumably app.Run() focuses on the running window and terminates its own process.
The code before app.Run() runs correctly.

Idk if I’ve verified this correctly tho. I haven’t rebuilt the whole system, and there is so much about Haiku that I don’t know.

8 Likes

The proposal is quite good, perhaps this minor change could be proposed to replace the base class in the repository and be integrated into the system.

Is there any specific reason why uname cannot be extended? GNU/Linux added a value in there, so it has been done in the past. And uname can be used both on the command line as well as via code (of different kinds).