-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: nitin sanghi <[email protected]>
- Loading branch information
1 parent
73eed54
commit 6f738ca
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
pkg_name=chef-cli | ||
pkg_origin=chef | ||
pkg_version="5.6.14" | ||
ruby_pkg="core/ruby31" | ||
pkg_deps=(${ruby_pkg} core/coreutils) | ||
pkg_build_deps=( | ||
core/make | ||
core/sed | ||
core/gcc | ||
core/libarchive | ||
) | ||
pkg_bin_dirs=(bin) | ||
do_setup_environment() { | ||
build_line 'Setting GEM_HOME="$pkg_prefix/lib"' | ||
export GEM_HOME="$pkg_prefix/lib" | ||
|
||
build_line "Setting GEM_PATH=$GEM_HOME" | ||
export GEM_PATH="$GEM_HOME" | ||
} | ||
do_unpack() { | ||
mkdir -pv "$HAB_CACHE_SRC_PATH/$pkg_dirname" | ||
cp -RT "$PLAN_CONTEXT"/.. "$HAB_CACHE_SRC_PATH/$pkg_dirname/" | ||
} | ||
do_build() { | ||
pushd "$HAB_CACHE_SRC_PATH/$pkg_dirname/" | ||
gem build chef-cli.gemspec | ||
popd | ||
} | ||
do_install() { | ||
pushd "$HAB_CACHE_SRC_PATH/$pkg_dirname/" | ||
gem install chef-cli-*.gem --no-document | ||
popd | ||
wrap_ruby_bin | ||
} | ||
wrap_ruby_bin() { | ||
local bin="$pkg_prefix/bin/$pkg_name" | ||
local real_bin="$GEM_HOME/gems/chef-cli-${pkg_version}/bin/chef-cli" | ||
build_line "Adding wrapper $bin to $real_bin" | ||
cat <<EOF > "$bin" | ||
#!$(pkg_path_for core/bash)/bin/bash | ||
set -e | ||
# Set binary path that allows InSpec to use non-Hab pkg binaries | ||
export PATH="/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:\$PATH" | ||
# Set Ruby paths defined from 'do_setup_environment()' | ||
export GEM_HOME="$GEM_HOME" | ||
export GEM_PATH="$GEM_PATH" | ||
exec $(pkg_path_for core/ruby31)/bin/ruby $real_bin \$@ | ||
EOF | ||
chmod -v 755 "$bin" | ||
} | ||
|
||
|
||
do_strip() { | ||
return 0 | ||
} |