Skip to content
Chef cookbook for tar packages
Branch: master
Clone or download
tas50 Remove Ubuntu 14.04 testing for 18.04
Signed-off-by: Tim Smith <tsmith@chef.io>
Latest commit 273dab8 Jan 19, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.delivery Test with Local Delivery instead of Rake Mar 1, 2017
.github
recipes GH-42 Skip tar package install on freebsd Sep 16, 2017
resources add tar_binary option to tar_extract and tar_package Sep 12, 2018
spec Add basic chefspec convergence test Dec 22, 2016
test Use build_essential resource instead of the recipe May 16, 2018
.gitignore Update kitchen config paths Jul 24, 2018
.rubocop.yml Convert to a custom resource Feb 12, 2017
.travis.yml
Berksfile Update platforms to test with test kitchen Jan 26, 2017
CHANGELOG.md Release 2.2.0 Jul 24, 2018
CONTRIBUTING.md Add contributing and testing docs Dec 22, 2016
Gemfile Update the platforms we test on May 26, 2018
LICENSE Add license file Dec 22, 2016
README.md Add a note to the README about tar_binary option Sep 12, 2018
TESTING.md Add contributing and testing docs Dec 22, 2016
chefignore
kitchen.dokken.yml
kitchen.yml Update kitchen config paths Jul 24, 2018
metadata.rb Release 2.2.0 Jul 24, 2018

README.md

tar Cookbook

Build Status Cookbook Version

Installs tar and includes resources for managing remote tar files. tar_package handles remote source package compilation. tar_extract handles retrieving remote tar files and extracting them locally.

Requirements

Platforms

  • Debian / Ubuntu derivatives
  • RHEL and derivatives
  • openSUSE / SUSE Linux Enterprises
  • FreeBSD

Chef

  • Chef 12.7+

Resources

tar_package

The tar_package resource provides an easy way to download remote files and compile and install them. This only works for the most basic Autoconf programs that can do ./configure && make && make install.

Actions

  • install Installs the package

Properties

  • source: name attribute. The source remote URL.
  • prefix: Directory to be used as the --prefix configure flag.
  • source_directory: Directory to which source files are downloaded.
  • creates: prevent the command from running when the specified file already exists.
  • configure_flags: Array of additional flags to be passed to ./configure.
  • archive_name: Specify a different name for the downloaded archive. Use it if the directory name inside the tar file is different than the name defined in the URL. Additionally, tar_package supports most remote_file attributes.
  • tar_binary: Specify the path to the tar binary, if "tar" is insufficient.

Example

tar_package 'http://pgfoundry.org/frs/download.php/1446/pgpool-3.4.1.tar.gz' do
  prefix '/usr/local'
  creates '/usr/local/bin/pgpool'
end

This will download, compile, and install the package from the given URL and install it into /usr/local.

tar_extract

The tar_extract resource provides an easy way to extract tar files from downloaded or local files.

Actions

  • extract Extracts the tar file from a url
  • extract_local Extracts the tar file from a local file path

Properties

  • source: name attribute. The source remote URL.
  • target_dir: Directory to extract into, e.g. tar xzf -C (target_dir)
  • download_dir: Directory to which tarball is downloaded (defaults to chef cache which requires root group and user).
  • creates: prevent the command from running when the specified file already exists.
  • compress_char: Flag for compression type, such as z for gzip. man tar for options.
  • tar_flags: Array of additional flags to be passed to tar xzf command.
  • group: Group name or group ID to extract the archive under. If set to non-root group, point to a download_dir the group has permission to access.
  • user: User name or user ID to extract the archive under. If set to non-root user, point to a download_dir the user has permission to access. Additionally, tar_extract supports most remote_file attributes.
  • tar_binary: Specify the path to the tar binary, if "tar" is insufficient.

Example

tar_extract 'http://dev.mycoderepo.com/artifacts/mycode-1.2.3.tar.gz' do
  target_dir '/opt/myapp/mycode'
  creates '/opt/myapp/mycode/lib'
  tar_flags [ '-P', '--strip-components 1' ]
end

This will download the tarball to cache, extract the contents to /opt/myapp/mycode, use the file '/opt/myapp/mycode/lib' to determine idempotency, and pass both '-P' and '--strip-components 1' flags to the tar xzf command.

tar_extract '/tmp/mycode-1.2.3.tar.gz' do
  action :extract_local
  target_dir '/opt/myapp/mycode'
  creates '/opt/myapp/mycode/lib'
end

This will extract the contents of /tmp/mycode-1.2.3.tar.gz to /opt/myapp/mycode and use the file '/opt/myapp/mycode/lib' to determine idempotency.

LICENSE AND AUTHOR


Copyright: 2011, Cramer Development, Inc.
Copyright: 2013, TAQTIQA LLC.
Copyright: 2011-2017, Chef Software, Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
You can’t perform that action at this time.