Skip to content

Instantly share code, notes, and snippets.

@tamirko
Created May 7, 2013 19:48
Show Gist options
  • Save tamirko/5535555 to your computer and use it in GitHub Desktop.
Save tamirko/5535555 to your computer and use it in GitHub Desktop.
OS detection
def os = OperatingSystem.getInstance()
def currVendor=os.getVendor()
switch (currVendor) {
case ["Ubuntu", "Debian", "Mint"]:
//Do Something #1
break
case ["Red Hat", "CentOS", "Fedora", "Amazon",""]:
//Do Something #2
break
case ~/.*(?i)(Microsoft|Windows).*/:
//Do Something #2
break
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment