Running Squeak fro ma unix shell script file with #! squeak...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
26 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: Running Squeak fro ma unix shell script file with #! squeak...

alistairgrant
Hi Tim,


On Mon, 20 May 2019 at 06:57, tim Rowledge <[hidden email]> wrote:
>
> Two apparent bugs also require some thought and probably solving by someone else
> a) Windows appears to be unable to write to stdout - and probably therefore  unable to read from stdin - despite the code appearing to be in the VM sources.

I haven't checked the squeak image, but the VM uses the Windows
ReadConsole() and WriteConsole() functions, so it has to be a DOS box
running the console version of the exe, i.e. for Pharo use
PharoConsole.exe.

For cygwin I've thought of using FFI to call fprintf(1, ...), but
never got around to trying it.


> b) Ubuntu (at least)  seems to have a problem with stdout etc not being initialised properly unless we reset the StartUpList order. Why Raspbian did not have that problem I can't imagine - they're both Debian based IIRC.

Yes (they're both Debian based).


> So all in all, damn cool stuff that could be made coolerer with some help.
>
> tim
> --
> tim Rowledge; [hidden email]; http://www.rowledge.org/tim
> Bayard(n): a person armed with the self-confidence of ignorance

Reply | Threaded
Open this post in threaded view
|

Re: Running Squeak fro ma unix shell script file with #! squeak...

Chris Cunnington-4
In reply to this post by timrowledge
Yea, there’s a lot of nifty going on here. I like how you added code in the script itself that will become part of the image before the command is given at the end.
I tried it by copying the code into Workspace and loading and then executing. It’s nice to see the WebServer as an easily accessible tool available on demand. I remember installing Kom too many times.
I haven’t tried it as a script yet. I have Ubuntu 16.04. But how did you install Squeak 5.2? Ian used to have a friendly Install script with each Linux release. I don’t think I’ve seen that for a long time. So for me to try what you’re doing I’d need to wrestle long paths, because the vm is on the Desktop and such.
How did you install Squeak5.2 so it’s in /usr/bin/squeak?

Chris


> On May 20, 2019, at 12:57 AM, tim Rowledge <[hidden email]> wrote:
>
>
>
>> On 2019-05-13, at 7:11 PM, Chris Cunnington <[hidden email]> wrote:
>>
>> Pretty cool. If Tim gets this working to his satisfaction I hope he makes a post with an example.
>
> It nearly does it.
>
> Right now you can (with a fully updated trunk image, specifically on Raspbian, maybe other linuxes, no way for me to test) make a .st file executable and add a line of the form
> #!/usr/bin/squeak /home/pi/Squeak/TPR-Squeak5.3-18560.image
> as the first line. You can run this from a commandline with the usual ./MyAmazing.st
>
> As an example
> <WebFib.st>
> will open the specified image, install a fast fibonacci method (thanks Nicolas!), add a fibonacci server method to WebServer and fire up Webserver. This is seriously cool. Double-clicking the .st works too, thought in Raspbian you do have to say to execute it or execute it in a terminal (either works, by the way. No idea how to stop the make-a-choice dialogue).
>
> Of  course, you can do the more manual
> squeak myAmazing.image WebFib.st
> as well
>
> Note that this is all without making use of Dave's excellent shell stuff, something else to play with. And indeed the amazing suggestion about the /proc/sys/fs/binfmt_misc/register magic from Subbu.
>
> The bit that I'd like to find a way to improve is having the ability to *not* open any windows. Right now the main window opens (as I've said many times, no window should open until some image code forces it to) and the UI is started up and the filing in etc happens after that. I don't know how we can nicely handle that; after all some legitimate uses of a script file would be to start a GUI application. Others would be of the 'calculate optimal firing solution and quit' variety.
>
> Two apparent bugs also require some thought and probably solving by someone else
> a) Windows appears to be unable to write to stdout - and probably therefore  unable to read from stdin - despite the code appearing to be in the VM sources.
> b) Ubuntu (at least)  seems to have a problem with stdout etc not being initialised properly unless we reset the StartUpList order. Why Raspbian did not have that problem I can't imagine - they're both Debian based IIRC.
>
> So all in all, damn cool stuff that could be made coolerer with some help.
>
> tim
> --
> tim Rowledge; [hidden email]; http://www.rowledge.org/tim
> Bayard(n): a person armed with the self-confidence of ignorance
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Running Squeak fro ma unix shell script file with #! squeak...

David T. Lewis
On Mon, May 20, 2019 at 05:54:58PM -0400, Chris Cunnington wrote:
>
> I haven???t tried it as a script yet. I have Ubuntu 16.04. But how did
> you install Squeak 5.2? Ian used to have a friendly Install script with
> each Linux release. I don???t think I???ve seen that for a long time.
> So for me to try what you???re doing I???d need to wrestle long paths,
> because the vm is on the Desktop and such. How did you install Squeak5.2
> so it???s in /usr/bin/squeak?
>

I use a naming convention for the conflicting start script names. The
64-bit Spur VM is /usr/local/bin/spur64, 32-bit Spur is /usr/local/bin/spur,
32-bit Cog is /usr/local/bin/cog. I install the interpreter VM without
renaming it, so it is /usr/local/bin/squeak. I then add a /usr/local/bin/run
script that selects a VM based on image format.

This is totally unofficial and recommended by nobody but me, but that's
what I do.

Dave


Reply | Threaded
Open this post in threaded view
|

Re: Running Squeak fro ma unix shell script file with #! squeak...

Chris Cunnington-4
Thanks, I that jarred my mind into the solution. I’ll try the script tomorrow. 

Chris 


On May 20, 2019, at 6:27 PM, David T. Lewis <[hidden email]> wrote:

I use a naming convention for the conflicting start script names. The
64-bit Spur VM is /usr/local/bin/spur64, 32-bit Spur is /usr/local/bin/spur
32-bit Cog is /usr/local/bin/cog. I install the interpreter VM without
renaming it, so it is /usr/local/bin/squeak. I then add a /usr/local/bin/run
script that selects a VM based on image format.

This is totally unofficial and recommended by nobody but me, but that's
what I do.



Reply | Threaded
Open this post in threaded view
|

Re: Running Squeak fro ma unix shell script file with #! squeak...

timrowledge


> On 2019-05-20, at 4:32 PM, Chris Cunnington <[hidden email]> wrote:
>
> Thanks, I that jarred my mind into the solution. I’ll try the script tomorrow.

I really don't know what the best unix answer is. On the Pi we seem to have been ok with this /usr/bin/squeak -


and the vm(s) go in /usr/lib/squeak/{version numbery thing}/squeak. The script finds the latest one (except I see now a dependence on it being a 5.0-something version so that could do with improving) and faffs around with a load of stuff I won't even pretend to know about.


tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Oxymorons: Tight slacks





squeak (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Running Squeak fro ma unix shell script file with #! squeak...

Chris Cunnington-4
I agree with what you’re saying. I just did the obvious. I moved the squeak script (as in your post) manually to be /usr/bin/squeak.
I moved the /squeak/5.0-2018…snip to /usr/bin/lib/squeak/5.0-2018…snip. Works now. (Probably a bit wrong, but I’ll take it.)
I figured Ian’s script was doing something simpler than I supposed. Now $squeak [ -help | -version ] works as expected.
I kept bouncing off a error: "Could not determine platform's libc path for VM.” I googled it, found Pharo’s had a question about their PharoLauncher on Ubuntu about a year ago. [1] I just kept reading the error until it and I agreed on where I was putting things.
As a closer, I’ll say that the squeak script only exists in the All-In-One. In the Linux specific download you get squeak.sh, which I don’t suppose is a candidate to put in /usr/bin/. You’d think it might be the other way around.
I’ll try some shebang scripts tomorrow.

Thanks,
Chris


[1] http://forum.world.st/Problem-with-PharoLauncher-on-Ubuntu-18-04-64-bit-td5078117.html


> On May 20, 2019, at 7:38 PM, tim Rowledge <[hidden email]> wrote:
>
>
>
>> On 2019-05-20, at 4:32 PM, Chris Cunnington <[hidden email]> wrote:
>>
>> Thanks, I that jarred my mind into the solution. I’ll try the script tomorrow.
>
> I really don't know what the best unix answer is. On the Pi we seem to have been ok with this /usr/bin/squeak -
> <squeak>
> and the vm(s) go in /usr/lib/squeak/{version numbery thing}/squeak. The script finds the latest one (except I see now a dependence on it being a 5.0-something version so that could do with improving) and faffs around with a load of stuff I won't even pretend to know about.
>
>
> tim
> --
> tim Rowledge; [hidden email]; http://www.rowledge.org/tim
> Oxymorons: Tight slacks
>
>
>


12