From c4df3a14be4e7c4cf255c7d4d7ac9924261ff75b Mon Sep 17 00:00:00 2001 From: Tensibai Zhaoying Date: Wed, 24 Jun 2020 22:48:44 +0000 Subject: [PATCH] cinc-auditor hab plan Signed-off-by: Tensibai Zhaoying --- habitat/plan.sh | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/habitat/plan.sh b/habitat/plan.sh index d9681b97f3..f53ab32ab3 100644 --- a/habitat/plan.sh +++ b/habitat/plan.sh @@ -1,11 +1,12 @@ -pkg_name=inspec -pkg_origin=chef +pkg_name=cinc-auditor +pkg_origin=cinc pkg_version=$(cat "$PLAN_CONTEXT/../VERSION") -pkg_description="InSpec is an open-source testing framework for infrastructure +pkg_description="Cinc Auditor is the Community build of Inspec by Chef. + Inspec is an open-source testing framework for infrastructure with a human- and machine-readable language for specifying compliance, security and policy requirements." -pkg_upstream_url=https://www.inspec.io/ -pkg_maintainer="The Habitat Maintainers " +pkg_upstream_url=https://www.cinc.sh +pkg_maintainer="The Cinc Maintainers " pkg_license=('Apache-2.0') pkg_deps=( core/coreutils @@ -40,7 +41,7 @@ do_build() { gem build inspec-core.gemspec popd pushd "$HAB_CACHE_SRC_PATH/$pkg_dirname/inspec-bin" - gem build inspec-bin.gemspec + gem build cinc-auditor-bin.gemspec popd } @@ -50,7 +51,7 @@ do_install() { gem install inspec-*.gem --no-document popd pushd "$HAB_CACHE_SRC_PATH/$pkg_dirname/inspec-bin" - gem install inspec-bin*.gem --no-document + gem install cinc-auditor-bin*.gem --no-document popd wrap_inspec_bin @@ -67,7 +68,7 @@ do_install() { # Need to wrap the InSpec binary to ensure paths are correct wrap_inspec_bin() { local bin="$pkg_prefix/bin/$pkg_name" - local real_bin="$GEM_HOME/gems/inspec-bin-${pkg_version}/bin/inspec" + local real_bin="$GEM_HOME/gems/cinc-auditor-bin-${pkg_version}/bin/cinc-auditor" build_line "Adding wrapper $bin to $real_bin" cat < "$bin" #!$(pkg_path_for core/bash)/bin/bash @@ -82,7 +83,14 @@ export GEM_PATH="$GEM_PATH" exec $(pkg_path_for core/ruby26)/bin/ruby $real_bin \$@ EOF - chmod -v 755 "$bin" + cat < "$pkg_prefix/bin/cinc-auditor-wrapper" +#!$(pkg_path_for core/bash)/bin/bash +echo "Redirecting to cinc-auditor..." + +exec $pkg_prefix/bin/cinc-auditor $@ +EOF + ln -s "$pkg_prefix/bin/cinc-auditor-wrapper" "$pkg_prefix/bin/inspec" + chmod -v 755 "$bin" "$pkg_prefix/bin/cinc-auditor-wrapper" "$pkg_prefix/bin/inspec" } do_strip() {