-
-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #160 from chef-cookbooks/fix_7zip_failure
Move tar/7zip path logic out of attributes and into helpers
- Loading branch information
Showing
13 changed files
with
130 additions
and
49 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
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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
# ark cookbook | ||
|
||
[![Build Status](https://travis-ci.org/chef-cookbooks/ark.svg?branch=master)](https://travis-ci.org/chef-cookbooks/ark) [![Cookbook Version](https://img.shields.io/cookbook/v/ark.svg)](https://supermarket.chef.io/cookbooks/ark) | ||
|
||
## Overview | ||
|
||
This cookbook provides `ark`, a resource for managing software archives. It manages the fetch-unpack-configure-build-install process common to installing software from source, or from binary distributions that are not fully fledged OS packages. | ||
|
||
This cookbook started its life as a modified version of Infochimp's install_from cookbook. It has since been heavily refactored and extended to meet different use cases. | ||
|
@@ -15,8 +17,9 @@ end | |
``` | ||
|
||
The provider will: | ||
|
||
- fetch it to to `/var/cache/chef/` | ||
- unpack it to the default path (`/usr/local/pig-0.8.0`) | ||
- unpack it to the default path (`/usr/local/pig-0.8.0`) | ||
- create a symlink for `:home_dir` (`/usr/local/pig`) pointing to path | ||
- add specified binary commands to the environment `PATH` variable | ||
|
||
|
@@ -25,38 +28,48 @@ By default, the ark will not run again if the `:path` is not empty. Ark provides | |
At this time ark only handles files available from URLs using the [remote_file](http://docs.chef.io/resource_remote_file.html) provider. It does handle local files using the `file://` protocol. | ||
|
||
## Requirements | ||
|
||
### Platforms | ||
|
||
- Debian/Ubuntu | ||
- RHEL/CentOS/Scientific/Oracle | ||
- Fedora | ||
- FreeBSD | ||
- SmartOS | ||
- Mac OS X | ||
- openSUSE / SUSE Linux Enterprises | ||
- Windows | ||
|
||
Should work on common Unix/Linux systems with typical userland utilities like tar, gzip, etc. May require the installation of build tools for compiling from source, but that installation is outside the scope of this cookbook. | ||
|
||
### Chef | ||
|
||
- Chef 12.1+ | ||
|
||
### Cookbooks | ||
|
||
- build-essential | ||
- seven_zip | ||
- windows | ||
|
||
## Attributes | ||
|
||
Customize the attributes to suit site specific conventions and defaults. | ||
- `node['ark']['apache_mirror']` - if the URL is an apache mirror, use the attribute as the default. | ||
- `node['ark']['prefix_root']` - default base location if the `prefix_root` is not passed into the resource. | ||
- `node['ark']['prefix_bin']` - default binary location if the `prefix_bin` is not passed into the resource. | ||
- `node['ark']['prefix_home']` - default home location if the `prefix_home` is not passed into the resource. | ||
- `node['ark']['win_install_dir']` - directory where the files will be put on windows | ||
- `node['ark']['package_dependencies']` - prerequisite system packages that need to be installed to support ark. | ||
|
||
- `node['ark']['apache_mirror']` - if the URL is an apache mirror, use the attribute as the default. default: `http://apache.mirrors.tds.net` | ||
- `node['ark']['prefix_root']` - default base location if the `prefix_root` is not passed into the resource. default: `/usr/local` | ||
- `node['ark']['prefix_bin']` - default binary location if the `prefix_bin` is not passed into the resource. default: `/usr/local/bin` | ||
- `node['ark']['prefix_home']` - default home location if the `prefix_home` is not passed into the resource. default: `/usr/local` | ||
- `node['ark']['package_dependencies']` - prerequisite system packages that need to be installed to support ark. default: varies based on platform | ||
- `node['ark']['tar']` - allows overriding the default path to the tar binary, which varies based on platform | ||
- `node['ark']['sevenzip_binary']` - allows overriding the default path to the 7zip binary, which is determined based on registry key value | ||
|
||
## Resources | ||
|
||
- `ark` - does the extract/build/configure dance | ||
|
||
### Actions | ||
|
||
- `:install`: extracts the file and creates a 'friendly' symbolic link to the extracted directory path | ||
- `:configure`: configure ahead of the install action | ||
- `:install_with_make`: extracts the archive to a path, runs `make`, and `make install`. | ||
|
@@ -69,74 +82,95 @@ Customize the attributes to suit site specific conventions and defaults. | |
- `:setup_py_install`: runs the command "python setup.py install" in the extracted directory | ||
|
||
### :cherry_pick | ||
|
||
Extract a specified file from an archive and places in specified path. | ||
|
||
#### Relevant Attribute Parameters for :cherry_pick | ||
|
||
- `path`: directory to place file in. | ||
- `creates`: specific file to cherry-pick. | ||
|
||
### :dump | ||
|
||
Strips all directories from the archive and dumps the contained files into a specified path. | ||
|
||
NOTE: This currently only works for zip archives | ||
|
||
#### Attribute Parameters for :dump | ||
|
||
- `path`: path to dump files to. | ||
- `mode`: file mode for `app_home`, as an integer. | ||
|
||
- Example: `0775` | ||
|
||
- `creates`: if you are appending files to a given directory, ark needs a condition to test whether the file has already been extracted. You can specify with creates, a file whose existence indicates the ark has previously been extracted and does not need to be extracted again. | ||
|
||
### :put | ||
|
||
Extract the archive to a specified path, does not create any symbolic links. | ||
|
||
#### Attribute Parameters for :put | ||
|
||
- `path`: path to extract to. | ||
|
||
- Default: `/usr/local` | ||
|
||
- `append_env_path`: boolean, if true, append the `./bin` directory of the extracted directory to the global `PATH` variable for all users. | ||
|
||
### Attribute Parameters | ||
|
||
- `name`: name of the package, defaults to the resource name. | ||
- `url`: url for tarball, `.tar.gz`, `.bin` (oracle-specific), `.war`, and `.zip` currently supported. Also supports special syntax | ||
- `:name:version:apache_mirror:` that will auto-magically construct download url from the apache mirrors site. | ||
- `version`: software version, defaults to `1`. | ||
- `mode`: file mode for `app_home`, is an integer. | ||
- `prefix_root`: default `prefix_root`, for use with `:install*` actions. | ||
- `prefix_home`: default directory prefix for a friendly symlink to the path. | ||
|
||
- Example: `/usr/local/maven` -> `/usr/local/maven-2.2.1` | ||
|
||
- `prefix_bin`: default directory to place a symlink to a binary command. | ||
|
||
- Example: `/opt/bin/mvn` -> `/opt/maven-2.2.1/bin/mvn`, where the `prefix_bin` is `/opt/bin` | ||
|
||
- `path`: path to extract the ark to. The `:install*` actions overwrite any user-provided values for `:path`. | ||
|
||
- Default: `/usr/local/<name>-<version>` for the `:install`, `:install_with_make` actions | ||
|
||
- `home_dir`: symbolic link to the path `:prefix_root/:name-:version`, does not apply to `:dump`, `:put`, or `:cherry_pick` actions. | ||
|
||
- Default: `:prefix_root/:name` | ||
|
||
- `has_binaries`: array of binary commands to symlink into `/usr/local/bin/`, you must specify the relative path. | ||
|
||
- Example: `[ 'bin/java', 'bin/javaws' ]` | ||
|
||
- `append_env_path`: boolean, similar to `has_binaries` but less granular. If true, append the `./bin` directory of the extracted directory to. the `PATH` environment variable for all users, by placing a file in `/etc/profile.d/`. The commands are symbolically linked into `/usr/bin/*`. This option provides more granularity than the boolean option. | ||
|
||
- Example: `mvn`, `java`, `javac`, etc. | ||
|
||
- `environment`: hash of environment variables to pass to invoked shell commands like `tar`, `unzip`, `configure`, and `make`. | ||
|
||
- `strip_components`: number of components in path to strip when extracting archive. With default value of `1`, ark strips the leading directory from an archive, which is the default for both `unzip` and `tar` commands. | ||
|
||
- `autoconf_opts`: an array of command line options for use with the GNU `autoconf` script. | ||
|
||
- Example: `[ '--include=/opt/local/include', '--force' ]` | ||
|
||
- `make_opts`: an array of command line options for use with `make`. | ||
|
||
- Example: `[ '--warn-undefined-variables', '--load-average=2' ]` | ||
|
||
- `owner`: owner of extracted directory. | ||
|
||
- Default: `root` | ||
|
||
- `backup`: The number of backups to be kept in /var/chef/backup (for UNIX- and Linux-based platforms) or C:/chef/backup (for the Microsoft Windows platform). Set to false to prevent backups from being kept. | ||
- Default: `5` | ||
|
||
- Default: `5` | ||
|
||
#### Examples | ||
|
||
This example copies `ivy.tar.gz` to `/var/cache/chef/ivy-2.2.0.tar.gz`, unpacks its contents to `/usr/local/ivy-2.2.0/` -- stripping the leading directory, and symlinks `/usr/local/ivy` to `/usr/local/ivy-2.2.0` | ||
|
||
```ruby | ||
|
@@ -163,7 +197,7 @@ This example copies `jdk-7u2-linux-x64.tar.gz` to `/var/cache/chef/jdk-7.2.tar.g | |
end | ||
``` | ||
|
||
Install Apache Ivy dependency resolution tool in <path>/resource_name in this case `/usr/local/ivy`, do not symlink, and strip any leading directory if one exists in the tarball: | ||
Install Apache Ivy dependency resolution tool in `/resource_name` in this case `/usr/local/ivy`, do not symlink, and strip any leading directory if one exists in the tarball: | ||
|
||
```ruby | ||
ark "ivy" do | ||
|
@@ -173,7 +207,7 @@ Install Apache Ivy dependency resolution tool in <path>/resource_name in this ca | |
end | ||
``` | ||
|
||
Install Apache Ivy dependency resolution tool in /home/foobar/ivy, strip any leading directory if one exists, don't keep backup copies of ivy.tar.gz: | ||
Install Apache Ivy dependency resolution tool in `/home/foobar/ivy`, strip any leading directory if one exists, don't keep backup copies of `ivy.tar.gz`: | ||
|
||
```ruby | ||
ark "ivy" do | ||
|
@@ -185,7 +219,7 @@ Install Apache Ivy dependency resolution tool in /home/foobar/ivy, strip any lea | |
end | ||
``` | ||
|
||
Strip all directories and dump files into path specified by the path attribute. You must specify the `creates` attribute in order to keep the extraction from running every time. The directory path will be created if it doesn't already exist: | ||
Strip all directories and dump files into path specified by the path attribute. You must specify the `creates` attribute in order to keep the extraction from running every time. The directory path will be created if it doesn't already exist: | ||
|
||
```ruby | ||
ark "my_jars" do | ||
|
@@ -234,6 +268,7 @@ You can also pass multiple actions to ark and supply the file extension in case | |
``` | ||
|
||
## License & Authors | ||
|
||
- Author: Philip (flip) Kromer - Infochimps, Inc([[email protected]](mailto:[email protected])) | ||
- Author: Bryan W. Berry ([[email protected]](mailto:[email protected])) | ||
- Author: Denis Barishev ([[email protected]](mailto:[email protected])) | ||
|
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
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
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
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
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
Oops, something went wrong.