Find the answer to your Linux question:
Results 1 to 4 of 4
Hello everyone, I am looking for a little help with a Bash Script. I have just finished a PC GUI application using Pygtk and glade. But, I would like to ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2011
    Posts
    2

    BASH Help: Script to check Installed Software


    Hello everyone,
    I am looking for a little help with a Bash Script. I have just finished a PC GUI application using Pygtk and glade.

    But, I would like to write a Bash Script to check if the user has the needed software to run my application on his or her computer. For example, the software needed to run my application among others are Python, nmap, and pygtk.

    Code:
    which python
    which nmap
    With a little bit of research I found:
    If python or nmap are installed on my computer and I run the above commands, the above code will tell me where it is located.
    But if python and nmap are not installed and I run the commands, nothing is displayed.

    Could I get a few ideas on how I would go about getting a boolean value to determine whether or not the software is installed or not. I would like to use the boolean value in my bash script to perform other actions ie echo "Python is not installed" or actually install Python if the boolean value is false.

    I would really appreciate the help. Thank you for your time.

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,229
    Imho, the best option is to package your software.
    The package (deb/rpm) can then depend on the packages for nmap and python.

    This way, the native packagemanager can pull in and install these, and you on the other hand can be sure, that the binaries are there.

    That doesn´t mean, you should omit errorchecks completely.
    But if
    - your package had requested the dependencies
    - and your application cannot find nmap and python for the standard $PATH,
    then you can stop further efforts to find them.

    You can then safely assume, that the user messed with his system.
    I would just exit my script/application in that case, complaining about "file not found" or similar.
    Last edited by Irithori; 04-01-2011 at 06:41 PM.
    You must always face the curtain with a bow.

  3. #3
    Just Joined!
    Join Date
    Apr 2011
    Posts
    2
    Creating a deb package for my application sounds like a great idea. I have found a tutorial but the process seems kind of complicated for a novice like me. I have several .py and .glade files that need to be packaged.

    If you have any suggestions or recommendations about how to easily create a deb package, I would greatly appreciate it. I will try to follow the tutorial the best I can.

    Once again, thank you Irithori for the help and any other suggestions are welcome.

  4. #4
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,229
    Sorry, I am more experienced with rpms.
    But these seem like good starting points to learn deb packaging:
    The Debian GNU/Linux FAQ - Basics of the Debian package management system
    Debian New Maintainers' Guide
    You must always face the curtain with a bow.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •