For the record, it seems worth summarising how to go about this in a similar case, that is, when downloading an application that is simply run by calling a script. In this instance, that's Sunflower.py inside directory Sunflower. I have tor on this machine, which works similarly - though a symlink is enough for tor.
Code: Select all
#cp -r ~/downloads/Sunflower /opt # move it to where we want to keep it, recursively
#chown -R root /opt/Sunflower # make sure root owns everything (not necessary in this case but it might be if the files got there some other way)
#chmod +x /opt/Sunflower/Sunflower.py # make sure the script is executable, which it may not be when first unpacked
#ln -s /opt/Sunflower/Sunflower.py /usr/local/bin/sunflower # create a symlink to the script somewhere suitable in your $PATH
Test the symlink to see if the app works when called like that:
In this case it doesn't, so we need to delete the link and create a wrapper script:
Code: Select all
#rm /usr/local/bin/sunflower # if you don't delete the link then when you create the script, you will be editing Sunflower.py (which it points to)
As root, create the file /usr/local/bin/sunflower with a text editor, containing the following script:
Code: Select all
#!/bin/sh
cd /opt/Sunflower/ # move to the app's directory
./Sunflower.py "$@" # run it from there, passing any arguments to it (in this case there aren't any)
Make sure it is executable:
Code: Select all
#chmod +x /usr/local/bin/sunflower
Whether you ended up using the script or the symlink was enough, the app can be called by
and that is the thing to put in any config files, launchers etc, depending on your DE/WM - just "sunflower", because it is in your $PATH, making it a bona fide application.
Alternatively, as Shador says, you can do all this on a per-user basis, in which case root isn't needed and the files should belong to the user. Create ~/bin and save the wrapper script (or symlink) there, pointing it wherever you're keeping the application within your ~. Add ~/bin to your $PATH by adding the following line to ~/.profile (which you may need to create):
