Search code examples
cross-platforminstallscript

Language for cross-platform install script


In writing an install script, I quickly found that I'd have cross-platform issues, and bash scripts are hard to maintain. I decided to look for a cleaner solution that's more cross-platform.

The goal is to have an intelligent script sniff out components of the user's system and have as little user interaction as possible. That being stated, I thought about these languages:

  • Python- cross-platform, and many other programs rely on it, so it may already be present
  • Javascript- nodejs is required by part of my application, but it's a little clunky for exec calls

Are there any languages that would be a better fit for this application?

Requirements:

  • Available on all platforms
    • May be distributed as part of my application if small enough
    • Little to no version variation, so Ruby is out
    • *nix only for now, but eventually will be run on Windows
  • Maintainable
    • Clear syntax (Perl is out)
    • Modular (if I sniff the OS, I can include separate OS-specific code)
  • Capable of downloading files (unmet dependencies)
  • Capable of relatively complex scripting tasks
    • Testing for used HTTP ports
    • Reading and parsing files for configuration data
    • Checking for permissions and changing directories of insufficient privileges
  • Open source

Solution

  • Python can do all of those things:

    • Available on all platforms (Mac, Linux, Windows, and more)
      • May be distributed as part of my application if small enough (You can make binaries with cx_freeze, if needed)
      • Little to no version variation, so Ruby is out (Python is pretty static when it comes to version changes)
      • *nix only for now, but eventually will be run on Windows (It comes pre-installed on Mac, and ships with just about any Linux distro. Binaries don't need the interpreter to run)
    • Maintainable
      • Clear syntax (Perl is out) (Python is very easy to read, but that's up to you to decide)
      • Modular (if I sniff the OS, I can include separate OS-specific code) (Modules are just files in Python)
    • Capable of downloading files (unmet dependencies) (Urllib2 takes care of that, and it's pre-installed)
    • Open source (Yep)