[Gambas-user] getting Gambas version info across devices

Brian G brian at westwoodsvcs.com
Sat Mar 27 00:35:51 CET 2021


Bruce S
I am not sure what you are trying to achieve. But if you install with the installer, does it not record the info so you can uninstall. And if your building in each of those systems, don't you also have the project you can query.
I maybe don't really know what you are trying to do this  for I guess. I mean if you sense the os version and just do the apt query or zyppr query or what ever is needed  for that OS. It means a table of some kind to know which command  for the os version of course....
It would be a lot more reliable, chroot... Or some such thing...
Ummm

--
Thanks
Brian Friday, 26 March 2021, 03:07PM -07:00 from Bruce Steers  bsteers4 at gmail.com :

>
>
>On Fri, 26 Mar 2021 at 11:36, Bruce Steers < bsteers4 at gmail.com> wrote:
>>
>> 
>>>>>This should work for gambas binary files like gbc3 or gba3
>>    Dim project As Integer = InStr(sfile, "/gambas" & System.version & 
>> "-" & System.Version, 1, gb.Binary)
>>    Dim length As Integer = InStr(sFile, "/", Project + 1, gb.binary) - 
>> project
>>    Print Mid(sFile, Project + 1, length - 1)
>>
>> output would look like this
>>
>> gambas3-3.15.90+git202103222309.dd1a35456+build14e27c76f~ubuntu20.04.1
>>
>> "Failure is the key to success;
>>   each mistake teaches us something"  .. Morihei Ueshiba
>> Brian G
>>
>
> You should better run "gba3 -x  .startup" to get the 
> project startup configuration file contents and get the version from it.
>
> This is far more reliable!
>
> Regards,
>
>>>>>
>>>>>Yes, well, loading a binary file into a string is pretty well going to 
>>>>>have interesting side effects but in any case the the suggested approach 
>>>>>for the ELF files doesn't work.
>>>>>
>>>>>For example, I have searched both gbc3 and gbx3 here and the "tickler" 
>>>>>gambas3-3 does not occur in those files. I resume it is specific to ubuntu.
>>>>>
>>>>>b
>>>
>>>Thanks Brian and Benoit.
>>>The trouble is i also want the trunk version info.
>>>seems only the binary files have it, the .gambas files like gbs3 only have maj.min.rel info
>>>Using your function on gbs3 Brian my output didn't look anything like yours it looked like this...
>>>Version=3.15.90
>>
>>Sorry , that was the gbs3 output.
>>The binary method worked for one system Debian-sid and failed for all the others :(
>>Thank you though :)
>>BruceS
>
>
>I think i'm happy now with it working on luck ;)
>I'm now using the shell command 
>strings /usr/bin/gbx3 |grep "3\.[0-9].\.[0-9]"
>
>that returns something like (depending on distro)...
>bonus:~$ strings /usr/bin/gbx3 |grep "3\.[0-9].\.[0-9]"
>3.15.90 2cbca5242 (bruces-new)
>3.15.90
> 3.15.90 2cbca5242 (bruces-new)
>
>it the smallest return list of strings I can get that works on all systems.
>
>I'll attach the app in case anyone else has multiple gambas's installed on different drives...
>
>What it does...
>uses lsblk to get the drives list and mounts any unmounted drives in /mnt/LabelName that has a "label" set.
>if no usr/bin/gbx3 is found it unmounts that drive again.
>
>gets gbx3 version info using the above method and makes a list of the disks and their gambas versions.
>GridView list items can be double clicked to xdg-open dir.
>
>On closing it unmounts all the mounted drives again.
>
>It's purpose..
>I
> often change and/or forget what gambas version is on what drive so i 
>run this so i know what one to boot when testing my apps or gambas 
>itself.
>
>Wishing well
>BruceS
>
>----[  http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210327/b3140102/attachment.htm>


More information about the User mailing list