Open demarey opened 4 years ago
I wanted to have image creation fast. Also, if your image needs arguments or another vm that the default one, I do not have this information at image creation time. It means running the script could not work. I also did this choice to let the user have a visual feedback of what the script is doing. Maybe it could be done at image creation time with the default configuration. I do not know what is the best option (depending on people usage)
@bergel suggested:
Maybe a checkbox when creating the script would do the think. Something like "Execute script when creating the image (vs when launching it)"
@bergel @astares I was about to implement the feature but it raises a lot of questions that make me think it may not be a good idea to have it. An init script is not a startup script. It is meant to be executed only once (e.g. load code, configure the image) and then, you save your image. To allow to run an init script at image creation time, I could:
As a user, I would also like that my image got "magically" initialized when I click create but the initialization time will still be there (e.g. code loading time) either at creation time or at first launch time. I do not see the difference there.
Whatever will be provided should be easy to use by the end user. Basic use cases could be like:
A user might want to download a clean Px image and use it directly (basic funtionality of Launcher)
A user might want to download a clean Px image and combine it with some script (to load framework or customize the image with code) and use it directly - code is loaded when image starts (new funtionality of Launcher of init scripts)
A user might want to download a clean Px image and combine it with some script (to load framework or customize the image with code) and use the result as (local) template for further image creation - so the code should not be loaded again
A user might want to download a clean Px image and run a general startup script when the image launches
A user might want to download a clean Px image and run a script for all Px-family images when the image launches
A user might want to download a clean Px image and run an image specific script for this particular P image
Maybe there are others.
If I'm not mistaken Launcher covers 1-2.
Pharo images currently already provide 4 to 5 or 6:
A) startup scripts for general (for all images independent from version) B) startup scripts per version (Pharo 7, Pharo 8, Pharo 9
See World menu -> System -> Startup. One needs to create a startup.st file in the mentioned folders.
Dont know how this mechanism interferes/collides with the init scripts now provided in Launcher (are Pharo startup.st scripts evaluated after the script given by Launcher or not or not at all).
Maybe allowing to edit these directly from Launcher would be helpful. I do not know if an option
C) startup scripts per image
exists. For instance when the image finds a startup.st file in the image folder.
If the scope A, B and even C is already provided by the images then Launcher should maybe have the possibility to edit these "scoped" startup scripts:
a) the global startup script b) a version specific startup script c) a per image specific script file
Anyway - I guess case 3 is not very well covered or need to be done manually (open the image with launcher, load something and save image, then later copy this image in Launcher to do new experiments)
Yes, 1-2 are covered by Pharo Launcher. 3 is almost covered: you create an image with an init script, save the image. Then you can click on the image in PL to convert it to a template. Maybe there is some usage for it. I personally prefer to set up a CI job to build the image with the script to have an up-to-date image. Then, I create an image in Pharo Launcher from the Jenkins server. And yes Pharo images currently already provide 4 to 5 or 6.
Yes, Pharo Launcher could offer the ability to edit "scoped" startup scripts. Where would you see this feature?
Suggested by @bergel and @astares: Allow to run start-up scrit at image creation time instead of launching time (first launch)
Describe the request