1

我正在尝试在 win 7 中使用 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

我怎样才能解决这个问题?

4

2 回答 2

2

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

http://wiki.opscode.com/display/chef/Fast+Start+Guide+for+Windows

看起来您可以按照不同的方法执行此操作,它确实说明了以下内容:

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

我认为您希望使用 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,但如果有的话,你可以在那里插入详细信息,它至少应该能够开始安装。

于 2013-06-16T15:32:51.687 回答
0

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

于 2014-02-01T18:36:16.793 回答