[Gambas-user] how-to execute file or bash script packaged inside Gambas

Fabien Bodard gambas.fr at ...626...
Mon Jan 30 09:22:17 CET 2017


Use:

User.Home &/  ".cache/gambas3/yourprogram"

Or

User.Home &/  ".cache/yourprogram"

.cache is the standard for cached parts of programs. For example I use
~/.cache/gb.map for caching gb.map tiles



2017-01-30 5:08 GMT+01:00 Jussi Lahtinen <jussi.lahtinen at ...626...>:
> Well I would avoid executing things in /tmp and there is no sense in asking
> root permission to put it in /usr/bin or so.
> So directory in home is good option. System.User.Home gives you what you
> need.
>
>
> Jussi
>
>
>
> On Mon, Jan 30, 2017 at 1:07 AM, Marty <mmcg29440 at ...3163...> wrote:
>
>> Jussi,
>>
>>
>>
>> Sounds simple enough. Should the tmp directory be in the user’s home
>> directory? If so is there a way Gambas can “know” the user id in order to
>> create the directory?
>>
>> No, the files do not need to be deleted after each run if not in
>> /tmp/Gambas.1000…
>>
>>
>>
>> Marty
>>
>>
>>
>> From: Jussi Lahtinen [via Gambas] [mailto:ml-node+
>> s8142n58356h53 at ...3046...]
>> Sent: Sunday, January 29, 2017 3:08 PM
>> To: Marty <mmcg29440 at ...3163...>
>> Subject: Re: how-to execute file or bash script packaged inside Gambas
>>
>>
>>
>> I suggest you copy the script and the python executables in dedicated
>> folder made by your program.
>> Example your program could create:
>>
>> /home/MyProgram/scripts
>> Or
>> /home/MyProgram/tmp
>>
>> And copy things there for the execution. Do you really need to remove the
>> scripts after execution or are they executed every time with the program?
>>
>>
>>
>> Jussi
>>
>>
>>
>> On Sun, Jan 29, 2017 at 4:22 PM, Marty <[hidden email]> 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
>> >
>> >
>> >
>> > From: Jussi Lahtinen [via Gambas] [mailto:ml-node+
>> > [hidden email]]
>> > Sent: Saturday, January 28, 2017 4:36 PM
>> > To: Marty <[hidden email]>
>> > Subject: Re: how-to execute file or bash script packaged inside Gambas
>> >
>> >
>> >
>> > Literally here: /tmp/gambas.1000/3092/1.tmp
>> > Read the error message carefully!
>> >
>> > Paste this into terminal and it will open the folder for you:
>> > nemo /tmp/gambas.1000/3092/
>> >
>> >
>> > Jussi
>> >
>> > On Sat, Jan 28, 2017 at 11:25 PM, Marty <[hidden email]> wrote:
>> >
>> >
>> > > Jussi,
>> > >
>> > >
>> > >
>> > > Thanks for your response. I’ve checked /etc/fstab and There are only
>> two
>> > > partitions the main and swap. I do not see any entry for a tmp
>> partition.
>> > > I’m running Gambas 3.91 under Mint17.1.
>> > >
>> > > Did a routine install when I installed it right from the CD.
>> > >
>> > >
>> > >
>> > > Bennoit,
>> > >
>> > >
>> > >
>> > > Thanks for your suggestion also. All of the files in the project
>> > directory
>> > > have execute permissions set. Where is /tmp/Gambas located? I look at
>> its
>> > > permissions.
>> > >
>> > >
>> > >
>> > > Marty
>> > >
>> > >
>> > >
>> > > From: Jussi Lahtinen [via Gambas] [mailto:ml-node+s8142n58348h5@
>> > > n7.nabble.com]
>> > > Sent: Saturday, January 28, 2017 12:38 PM
>> > > To: Marty <[hidden email]>
>> > > Subject: Re: how-to execute file or bash script packaged inside gambas
>> > >
>> > >
>> > >
>> > > Also does the tmp partition have noexec set (check /etc/fstab)? It's
>> > common
>> > > way to harden Linux installation, but people kind of abuses /tmp...
>> it's
>> > > not for executions.
>> > >
>> > >
>> > > Jussi
>> > >
>> > > On Sat, Jan 28, 2017 at 9:09 PM, Benoît Minisini <
>> > > [hidden email]> wrote:
>> > >
>> > >
>> > > > Le 28/01/2017 à 20:03, Benoît Minisini a écrit :
>> > > > > Le 28/01/2017 à 18:07, Marty a écrit :
>> > > > >> Want to run a script file packaged within the Gambas project.
>> Tried
>> > > the
>> > > > >> method below.
>> > > > >>
>> > > > >> DIM sTempScript as String
>> > > > >>
>> > > > >> sTempScript = Temp$
>> > > > >>
>> > > > >> COPY "update.sh" TO sTempscript
>> > > > >>
>> > > > >> SHELL sTempScript WAIT
>> > > > >>
>> > > > >> Does not work for me. All of the python files are in the gambas
>> > > project
>> > > > >> directory and have execute permissions.
>> > > > >>
>> > > > >> The error is: /bin/sh:1:/tmp/gambas.1000/3092/1.tmp permission
>> > denied
>> > > > >>
>> > > > >> What do I change to allow the python programs to run? Is it the
>> > > project
>> > > > >> directory?
>> > > > >>
>> > > > >> Thanks,
>> > > > >> Marty
>> > > > >>
>> > > > >
>> > > > > Did you set execution rights on the shell file?
>> > > > >
>> > > >
>> > > > I mean on the copy. The permissions on the original file are ignored
>> > > > once you make an executable (they are all read-only and not
>> > executable).
>> > > >
>> > > > --
>> > > > Benoît Minisini
>> > > >
>> > > > ------------------------------------------------------------
>> > > > ------------------
>> > > > Check out the vibrant tech community on one of the world's most
>> > > > engaging tech sites, SlashDot.org! http://sdm.link/slashdot
>> > > > _______________________________________________
>> > > > Gambas-user mailing list
>> > > > [hidden email]
>> > > > https://lists.sourceforge.net/lists/listinfo/gambas-user
>> > > >
>> > >
>> > > ------------------------------------------------------------
>> > > ------------------
>> > > Check out the vibrant tech community on one of the world's most
>> > > engaging tech sites, SlashDot.org! http://sdm.link/slashdot
>> > > _______________________________________________
>> > > Gambas-user mailing list
>> > > [hidden email]
>> > > https://lists.sourceforge.net/lists/listinfo/gambas-user
>> > >
>> > >
>> > >
>> > >   _____
>> > >
>> > > If you reply to this email, your message will be added to the
>> discussion
>> > > below:
>> > >
>> > > http://gambas.8142.n7.nabble.com/how-to-execute-file-or-bash
>> > > -script-packaged-inside-gambas-tp20046p58348.html
>> > >
>> > > To start a new topic under gambas-user, email
>> > > [hidden email] <mailto:[hidden email] <mailto:[hidden%20email]> >
>> > > To unsubscribe from how-to execute file or bash script packaged inside
>> > > gambas, click here <http://gambas.8142.n7.nabble.
>> > > com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=
>> > > 20046&code=bW1jZzI5NDQwQGZyb250aWVyLmNvbXwyMDA0NnwxNDAwMzEwMDQ5> .
>> > >  <http://gambas.8142.n7.nabble.com/template/NamlServlet.jtp?
>> macro=macro_
>> > > viewer&id=instant_html%21nabble%3Aemail.naml&base=
>> > > nabble.naml.namespaces.BasicNamespace-nabble.view.web.
>> > > template.NabbleNamespace-nabble.view.web.template.NodeNamesp
>> > > ace&breadcrumbs=notify_subscribers%21nabble%3Aemail.
>> > > naml-instant_emails%21nabble%3Aemail.naml-send_instant_
>> > > email%21nabble%3Aemail.naml> NAML
>> > >
>> > >
>> > >
>> > >
>> > >
>> > > --
>> > > View this message in context: http://gambas.8142.n7.nabble.c
>> > > om/how-to-execute-file-or-bash-script-packaged-inside-gambas
>> > > -tp20046p58349.html
>> > > Sent from the gambas-user mailing list archive at Nabble.com.
>> > > ------------------------------------------------------------
>> > > ------------------
>> > > Check out the vibrant tech community on one of the world's most
>> > > engaging tech sites, SlashDot.org! http://sdm.link/slashdot
>> > > _______________________________________________
>> > > Gambas-user mailing list
>> > > [hidden email]
>> > > https://lists.sourceforge.net/lists/listinfo/gambas-user
>> > >
>> >
>> > ------------------------------------------------------------
>> > ------------------
>> > Check out the vibrant tech community on one of the world's most
>> > engaging tech sites, SlashDot.org! http://sdm.link/slashdot
>> > _______________________________________________
>> > Gambas-user mailing list
>> > [hidden email]
>> > https://lists.sourceforge.net/lists/listinfo/gambas-user
>> >
>> >
>> >
>> >   _____
>> >
>> > If you reply to this email, your message will be added to the discussion
>> > below:
>> >
>> > http://gambas.8142.n7.nabble.com/how-to-execute-file-or-
>> > bash-script-packaged-inside-gambas-tp20046p58350.html
>> >
>> > To start a new topic under gambas-user, email
>> > [hidden email] <mailto:[hidden email]>
>> > To unsubscribe from how-to execute file or bash script packaged inside
>> > gambas, click here <http://gambas.8142.n7.nabble.
>> > com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=20046&code=
>> > bW1jZzI5NDQwQGZyb250aWVyLmNvbXwyMDA0NnwxNDAwMzEwMDQ5> .
>> >  <http://gambas.8142.n7.nabble.com/template/NamlServlet.jtp?
>> > macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&
>> > base=nabble.naml.namespaces.BasicNamespace-nabble.view.
>> > web.template.NabbleNamespace-nabble.view.web.template.
>> > NodeNamespace&breadcrumbs=notify_subscribers%21nabble%
>> > 3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_
>> > instant_email%21nabble%3Aemail.naml> NAML
>> >
>> >
>> >
>> >
>> >
>> > --
>> > View this message in context: http://gambas.8142.n7.nabble.
>> > com/how-to-execute-file-or-bash-script-packaged-inside-
>> > gambas-tp20046p58352.html
>> > Sent from the gambas-user mailing list archive at Nabble.com.
>> > ------------------------------------------------------------
>> > ------------------
>> > Check out the vibrant tech community on one of the world's most
>> > engaging tech sites, SlashDot.org! http://sdm.link/slashdot
>> > _______________________________________________
>> > Gambas-user mailing list
>> > [hidden email]
>> > https://lists.sourceforge.net/lists/listinfo/gambas-user
>> >
>>
>> ------------------------------------------------------------
>> ------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Gambas-user mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
>>
>>
>>   _____
>>
>> If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://gambas.8142.n7.nabble.com/how-to-execute-file-or-
>> bash-script-packaged-inside-gambas-tp20046p58356.html
>>
>> To start a new topic under gambas-user, email
>> ml-node+s8142n3h10 at ...3046... <mailto:ml-node+s8142n3h10 at ...3046...>
>> To unsubscribe from how-to execute file or bash script packaged inside
>> gambas, click here <http://gambas.8142.n7.nabble.
>> com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=20046&code=
>> bW1jZzI5NDQwQGZyb250aWVyLmNvbXwyMDA0NnwxNDAwMzEwMDQ5> .
>>  <http://gambas.8142.n7.nabble.com/template/NamlServlet.jtp?
>> macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&
>> base=nabble.naml.namespaces.BasicNamespace-nabble.view.
>> web.template.NabbleNamespace-nabble.view.web.template.
>> NodeNamespace&breadcrumbs=notify_subscribers%21nabble%
>> 3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_
>> instant_email%21nabble%3Aemail.naml> NAML
>>
>>
>>
>>
>>
>> --
>> View this message in context: http://gambas.8142.n7.nabble.
>> com/how-to-execute-file-or-bash-script-packaged-inside-
>> gambas-tp20046p58357.html
>> Sent from the gambas-user mailing list archive at Nabble.com.
>> ------------------------------------------------------------
>> ------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user



-- 
Fabien Bodard




More information about the User mailing list