在git-bash中使用curl安装chef时出错



我试图在win7中使用git-bash来使用chef综合安装程序。我尝试了以下操作:

$ curl -L https://opscode.com/chef/install.sh | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  6506  100  6506    0     0   5957      0  0:00:01  0:00:01 --:--:--  6834
Unable to determine platform version!
Please file a bug report at http://tickets.opscode.com
Project: Chef
Component: Packages
Label: Omnibus
Version:
Please detail your operating system type, version and any other relevant details

我该如何解决这个问题?

您可能能够修改install.sh,然后在本地运行它,或者将它放在您自己的服务器上,并以类似的方式执行它,但至少需要针对平台和版本对其进行修改。然而,根据:

http://wiki.opscode.com/display/chef/Fast +开始+指导+ + Windows

看起来你可以通过一个不同的方法来做到这一点,它声明如下:

操作系统 Chef运行在许多流行的Unix和Linux平台以及Mac OSX和Windows上。我们将描述如何设置使用Windows 2008 R2作为工作站和客户端,但这些都是这也适用于Windows 7。这些方向已知不能在Windows Server 2003或有%HOMEPATH%中的空格。有关这些的说明,请参阅工作站安装页面或客户端安装页面窗户。

我假设您希望使用bash执行它的原因可能是为了获得更自动化的安装。如果安装脚本太难修改,你可以根据链接中的指导原则使用一些更面向windows的东西来自动安装。

顺便说一下,我尝试使用与您相同的方法并收到相同的消息,查看install.sh,您有这些行:

machine=$(echo -e `uname -m`)
# Retrieve Platform and Platform Version
if [ -f "/etc/lsb-release" ] && grep -q DISTRIB_ID /etc/lsb-release;
then
  platform=$(grep DISTRIB_ID /etc/lsb-release | cut -d "=" -f 2 | tr '[A-Z]' '[a-z]')
  platform_version=$(grep DISTRIB_RELEASE /etc/lsb-release | cut -d "=" -f 2)
elif [ -f "/etc/debian_version" ];
then
  platform="debian"
  platform_version=$(echo -e `cat /etc/debian_version`)
elif [ -f "/etc/redhat-release" ];
then
  platform=$(sed 's/^(.+) release.*/1/' /etc/redhat-release | tr '[A-Z]' '[a-z]')
  platform_version=$(sed 's/^.+ release ([.0-9]+).*/1/' /etc/redhat-release)
  # If /etc/redhat-release exists, we act like RHEL by default
  if [ "$platform" = "fedora" ];
  then
    # Change platform version for use below.
    platform_version="6.0"
  fi
  platform="el"
elif [ -f "/etc/system-release" ];
then
  platform=$(sed 's/^(.+) release.+/1/' /etc/system-release | tr '[A-Z]' '[a-z]')
  platform_version=$(sed 's/^.+ release ([.0-9]+).*/1/' /etc/system-release | tr '[A-Z]' '[a-z]')
  # amazon is built off of fedora, so act like RHEL
  if [ "$platform" = "amazon linux ami" ];
  then
    platform="el"
    platform_version="6.0"
  fi
# Apple OS X
elif [ -f "/usr/bin/sw_vers" ];
then
  platform="mac_os_x"
  # Matching the tab-space with sed is error-prone
  platform_version=$(sw_vers | awk '/^ProductVersion:/ { print $2 }')
  major_version=$(echo $platform_version | cut -d. -f1,2)
  case $major_version in
    "10.6") platform_version="10.6" ;;
    "10.7") platform_version="10.7" ;;
    "10.8") platform_version="10.7" ;;
    *) echo "No builds for platform: $major_version"
       report_bug
       exit 1
       ;;
  esac
  # x86_64 Apple hardware often runs 32-bit kernels (see OHAI-63)
  x86_64=$(sysctl -n hw.optional.x86_64)
  if [ $x86_64 -eq 1 ]; then
    machine="x86_64"
  fi
elif [ -f "/etc/release" ];
then
  platform="solaris2"
  machine=$(/usr/bin/uname -p)
  platform_version=$(/usr/bin/uname -r)
elif [ -f "/etc/SuSE-release" ];
then
  if grep -q 'Enterprise' /etc/SuSE-release;
  then
      platform="sles"
      platform_version=$(awk '/^VERSION/ {V = $3}; /^PATCHLEVEL/ {P = $3}; END {print V "." P}' /etc/SuSE-release)
  else
      platform="suse"
      platform_version=$(awk '/^VERSION =/ { print $3 }' /etc/SuSE-release)
  fi
fi
platform="windows"
if [ "x$platform" = "x" ];
then
  echo "Unable to determine platform version!"
  report_bug
  exit 1
fi
# Mangle $platform_version to pull the correct build
# for various platforms
major_version=$(echo $platform_version | cut -d. -f1)
case $platform in
  "el")
    case $major_version in
      "5") platform_version="5" ;;
      "6") platform_version="6" ;;
    esac
    ;;
  "debian")
    case $major_version in
      "5") platform_version="6";;
      "6") platform_version="6";;
    esac
    ;;
esac
if [ "x$platform_version" = "x" ];
then
  echo "Unable to determine platform version!"
  report_bug
  exit 1
fi
if [ $use_shell = 1 ];
then
  shell_filename
else
  case $platform in
    "ubuntu") deb_filename ;;
    "debian") deb_filename ;;
    "el") rpm_filename ;;
    "suse") rpm_filename ;;
    "sles") rpm_filename ;;
    "fedora") rpm_filename ;;
    "solaris2") svr4_filename ;;
    *) shell_filename ;;
  esac
fi
echo "Downloading Chef $version for ${platform}..."
url="https://opscode.com/chef/download?v=${version}&prerelease=${prerelease}&p=${platform}&pv=${platform_version}&m=${machine}"

和最后一行,在install.sh脚本的第199行:

https://opscode.com/chef/download?v=${version}&prerelease=${prerelease}&p=${platform}&pv=${platform_version}&m=${machine}

我找不到一个适合windows 7的url,但如果有,你可以在那里插入详细信息,它至少可以开始安装

您不希望在Windows上使用install.sh脚本。Chef将Windows包作为MSI发布

最新更新