How to execute a setup script only ONCE ?


ekianjo

Hardcore Member
Joined
May 7, 2012
Messages
8,261
Location
神戸市、日本 (Japan)
A very simple question, but I can't figure how this works with PNDs.


I have a program in python I want to port, that needs a setup.py script to be launched first to install the software - then the main.py can be used subsequently.


How would this work on Pandora ?


1/ is it possible to execute a setup script only once, and skip for subsequent program launches ?


2/ if not, should I try to integrate the setup commands in the actual main program to ensure the related actions are always properly followed?


Any help would be appreciated :)


Thanks.
 
The easiest way around this is to create a lock file when setting up then testing for its existance before running the setup again. If setup involves creating or copying any files to a non-volatile location you could check for their existance instead.


- Neelix
 
Another method is to check if a change that should have been done by the script (example a setting in a config file) is already in place and exit if it is. However, the method suggested by Neelix is better because you can force the script to re-run simply by deleting the lock file.
 
Last edited by a moderator:
Back
Top