[Gambas-user] how-to execute file or bash script packaged inside Gambas
gbwilly at ...3606...
gbwilly at ...3606...
Sun Jan 29 17:57:25 CET 2017
On 2017-01-29 15:22, Marty wrote:
> Jussi,
>
>
>
> I’ve found the answer. The file 1.tmp in directory
> /tmp/Gambas.1000/3092 is created at the time COPY "update.sh" TO
> sTempscript is executed. Because it is dynamically created it does not
> have execute permissions. After executing COPY "update.sh" TO
> sTempscript set the permissions on sTempscript to rwx using chmod.
> Then the script will run.
>
>
>
> Now that caused another problem. The script passes parameters to a
> python program that is still in the project directory not in /tmp….
> This causes a file not found error when the script executes. These
> temp files remain after the program exits. I should delete the when
> the program exits.
>
>
>
> What should I do to work around the file not found error?
>
>
>
> Marty
>
Hi Marty,
If you have this application for personal use on your own system this is
what I would do:
1. Copy (as root) the update.sh and python program to /usr/bin
2. chmod 755 both the .sh and phyton program.
3. In you application refer to the /usr/bin/update.sh script.
Now your application should run just fine.
If on the other hand you want to distribute this you need to do as
follows:
1. Put both the update.sh and phyton program in your .hidden project
folder (named Project in IDE).
2. Make a package and in 'step 8. Extra files' of the packager add your
update.sh and let if be placed in /usr/bin during installation time. Do
the same for the phyton program.
3. Install the package on an other system to test and you will find both
your update.sh and phyton program in /usr/bin with proper priveledges,
after installation.
Your application should now run fine on the other system, without any
manual interference by you.
One thing you need to understand is that refering to files located in
the project Data folder will ALWAYS be read-only access once the gambas
executable of the project is made.
So follow the common linux way of organising things.
Place sripts in /usr/bin (this is where stuff gets executed), common
application stuff (like icons and stuff that needs to be read-only
accesible) could be in /usr/share.
If you need read/write acces your application needs to create these
files in the users home folder as that is the only place the user
running the application will have read/write access.
When developing you application, on the development system you need to
do this manualy for testing while developing.
Once distributing your application you use step 8 in package manager to
make sure all is at its proper location after installing the package.
Hope this helps,
gbWilly
More information about the User
mailing list