Saltstack Official OpenSSH Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
2.4KB

  1. # -*- coding: utf-8 -*-
  2. # vim: ft=ruby
  3. # Global source defined as https://rubygems.org
  4. source 'https://rubygems.org'
  5. # Attempt to fingerprint OS from /etc/os-release where available
  6. if File.file?("/etc/os-release")
  7. os_family = ''
  8. os_version = ''
  9. os_version_full = ''
  10. # Strip necessary granularity from os-release
  11. File.open("/etc/os-release").grep(/(^ID=(.*)$|^VERSION="(.*)"$|^VERSION_ID="(.*)")/) do |line|
  12. # OS family (Debian/CentOS/Ubuntu)
  13. if ( line =~ /^ID=\S/ )
  14. os_family = line.split('=')[1]
  15. puts "IDENTIFIED os_family = " + os_family
  16. end
  17. # Major revision
  18. if ( line =~ /^VERSION_ID="(.*)"$/ )
  19. os_version = line.split('=')[1].tr('"','')
  20. puts "IDENTIFIED os_version = " + os_version
  21. end
  22. # Vanity name
  23. if ( line =~ /^VERSION="(.*)"$/ )
  24. os_version_full = line.split('=')[1]
  25. puts "IDENTIFIED os_version_full = " + os_version_full
  26. end
  27. end
  28. # Pinning is broken into os_family and then os_version
  29. # to try and avoid conflict.
  30. case os_family
  31. when /debian/
  32. # os_family: Debian os_version dependent pins
  33. case os_version
  34. when /7/
  35. puts "busser-serverspec is no longer natively supported on: " + os_version_full
  36. when /8/
  37. gem 'net-ssh', '~> 4.2.0'
  38. else
  39. puts "Your distribution is either too old, or supported without pins: " + os_version_full
  40. end
  41. when /centos/
  42. # os_family: centos os_version dependent pins
  43. print "Switching on " + os_version
  44. case os_version
  45. when /6/
  46. puts "busser-serverspec has no native supported on: " + os_version_full
  47. when /7/
  48. gem 'net-ssh', '~> 4.2.0'
  49. else
  50. puts "Your distribution is either too old, or supported without pins: " + os_version_full
  51. end
  52. when /ubuntu/
  53. # os_family: ubuntu os_version dependent pins
  54. case os_version
  55. when /14.04/
  56. puts "busser-serverspec is no longer natively supported on: " + os_version_full
  57. when /16.04/
  58. puts "busser-serverspec is currently supported natively on: " + os_version_full
  59. else
  60. puts "Your distribution is either too old, or supported without pins: " + os_version_full
  61. end
  62. # No helper support provided
  63. else
  64. puts "No Gemfile helper support exists for os_family: " + os_family
  65. end
  66. else
  67. puts "No Gemfile helper support provided for this suite."
  68. end