Update ark cookbook
This commit is contained in:
parent
6075167494
commit
af1718e44a
2
Batali
2
Batali
@ -36,7 +36,7 @@ Batali.define do
|
||||
cookbook 'omnibus_updater', '~> 1.0.4'
|
||||
cookbook 'timezone-ii'
|
||||
cookbook 'nodejs', '~> 3.0.0'
|
||||
cookbook 'ark'
|
||||
cookbook 'ark', '~> 2.2.1'
|
||||
cookbook 'logrotate'
|
||||
end
|
||||
|
||||
|
@ -655,29 +655,6 @@
|
||||
"version": "3.0.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ark",
|
||||
"dependencies": [
|
||||
[
|
||||
"build-essential",
|
||||
">= 0.0.0"
|
||||
],
|
||||
[
|
||||
"windows",
|
||||
">= 0.0.0"
|
||||
],
|
||||
[
|
||||
"seven_zip",
|
||||
">= 0.0.0"
|
||||
]
|
||||
],
|
||||
"version": "1.0.1",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/ark/versions/1.0.1/download",
|
||||
"version": "1.0.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "seven_zip",
|
||||
"dependencies": [
|
||||
@ -880,6 +857,29 @@
|
||||
"version": "0.2.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ark",
|
||||
"dependencies": [
|
||||
[
|
||||
"build-essential",
|
||||
">= 0.0.0"
|
||||
],
|
||||
[
|
||||
"windows",
|
||||
">= 0.0.0"
|
||||
],
|
||||
[
|
||||
"seven_zip",
|
||||
">= 0.0.0"
|
||||
]
|
||||
],
|
||||
"version": "2.2.1",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/ark/versions/2.2.1/download",
|
||||
"version": "2.2.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "logrotate",
|
||||
"dependencies": [
|
||||
|
@ -1,11 +1,75 @@
|
||||
# ark Cookbook CHANGELOG
|
||||
|
||||
This file is used to list changes made in each version of the ark cookbook.
|
||||
|
||||
## 2.2.1 (2016-12-16)
|
||||
- Use Ohai root_group attribute to avoid trying to set the group to root on BSD/macOS.
|
||||
- Add missing accessor for owner property
|
||||
|
||||
## 2.2.0 (2016-12-14)
|
||||
|
||||
- Add detection of .7z file extensions
|
||||
- Fix 7zip extraction using strip_components >= 1 to properly extract to the path instead of the user's home_dir
|
||||
- Always quote the path to the 7zip and xcopy binaries as they may have spaces
|
||||
- Clarified in the readme that the install_with_make action includes the configure action
|
||||
- Fix files with very long paths failing to extract on Windows
|
||||
- Fix default owner of 'root' failing on Windows
|
||||
- Fix 7-zip extraction with long paths when strip_components is >= 1
|
||||
- Add the group attribute parameter to README
|
||||
- Fix package installation failure on macOS systems
|
||||
- Use x to extract with 7-zip, not e. Use e only for dump, which strips directories.
|
||||
|
||||
## 2.1.0 (2016-11-15)
|
||||
|
||||
- Move tar/7zip path logic out of attributes and into helpers to prevent failures when 7zip is not installed before the chef run starts
|
||||
- Improve platform testing in Test Kitchen
|
||||
- Recognize Windows as a supported platform in the readme
|
||||
- Introduce a new attribute for overriding the 7-zip location: node['ark']['sevenzip_binary']
|
||||
|
||||
## 2.0.2 (2016-11-03)
|
||||
|
||||
- Fix suse support and centos < 6
|
||||
|
||||
## 2.1.0 (2016-11-01)
|
||||
|
||||
- Use multipackage installs to speed up installation
|
||||
- Avoid installation package dependencies on Windows entirely
|
||||
- Remove the testing bin stubs
|
||||
|
||||
## 2.0.0 (2016-09-15)
|
||||
|
||||
- Add CentOS 7.2, Fedora 23, and Suse specs
|
||||
- Add centos 5, debian, and opensuse travis testing
|
||||
- Add a contributing doc
|
||||
- Fix cookstyle warnings
|
||||
- Require Chef 12.1+
|
||||
|
||||
## [v1.2.0](https://github.com/chef-cookbooks/ark/tree/v1.2.0) (2016-07-03)
|
||||
|
||||
[Full Changelog](https://github.com/chef-cookbooks/ark/compare/v1.1.0...v1.2.0)
|
||||
|
||||
- Create seven_zip unpack command when strip_components is 0 [#155](https://github.com/chef-cookbooks/ark/pull/155) ([terkill](https://github.com/terkill))
|
||||
- Get 7zip path from the windows registry. [#153](https://github.com/chef-cookbooks/ark/pull/153) ([buri17](https://github.com/buri17))
|
||||
- Use fullpath for xcopy and icacls. [#152](https://github.com/chef-cookbooks/ark/pull/152) ([buri17](https://github.com/buri17))
|
||||
- Define custom matcher helper for notification testing, fixes #139 [#144](https://github.com/chef-cookbooks/ark/pull/144) ([szymonpk](https://github.com/szymonpk))
|
||||
|
||||
## v1.1.0 (2016-05-19)
|
||||
|
||||
- Add support for RHEL 7
|
||||
- Fixes to the readme to clarify actions / properties
|
||||
- Expose the backup property in remote file to the ark resource
|
||||
- Transfer the cookbook back to Chef
|
||||
- Resolve all rubocop warnings
|
||||
- Add maintainers files and Chef contributing docs
|
||||
- Test on the latest platforms in .kitchen.yml and update Travis to use kitchen-dokken with additional platforms
|
||||
|
||||
## v1.0.1 (2016-02-16)
|
||||
|
||||
- Remove a large number of zero byte archives that snuck into the repository
|
||||
- Remove a Chef 10 compatibility check in the custom resource
|
||||
|
||||
## v1.0.0 (2016-02-09)
|
||||
|
||||
- Added the pkg-config package to the debian platform family
|
||||
- Added tar, xz-lzma-compat, and bzip2 packages to the RHEL and fedora platform families
|
||||
- Updated FreeBSD to install gmake instead of make
|
||||
@ -24,6 +88,7 @@ This file is used to list changes made in each version of the ark cookbook.
|
||||
- Improved error logging when an unknown extension is encountered
|
||||
- Added support for .tar files
|
||||
- Improved overall testing:
|
||||
|
||||
- Removed the kitchen.cloud.yml file and gem dependencies
|
||||
- Added integration testing in Travis with Kitchen-Docker and Travis tests now run using the nightly build of ChefDK
|
||||
- Expanded platforms tested in the .kitchen.yml file
|
||||
@ -33,106 +98,144 @@ This file is used to list changes made in each version of the ark cookbook.
|
||||
- Removed the original minitests
|
||||
|
||||
- Added standard Chef .gitignore and chefignore files
|
||||
|
||||
- Resolved a large number of rubocop warnings
|
||||
|
||||
- Removed old Opscode contributing and testing docs
|
||||
|
||||
- Added a cookbook version badge to the readme
|
||||
|
||||
- Removed the Toftfile
|
||||
|
||||
## v0.9.0 (2014-06-06)
|
||||
|
||||
- [COOK-3642] Add Windows support
|
||||
|
||||
## v0.8.2 (2014-04-23)
|
||||
|
||||
- [COOK-4514] - Support for SLES with the Ark cookbook
|
||||
|
||||
## v0.8.0 (2014-04-10)
|
||||
|
||||
- [COOK-2771] - Add support for XZ compression
|
||||
|
||||
## v0.7.2 (2014-03-28)
|
||||
|
||||
- [COOK-4477] - Fix failing test suite
|
||||
- [COOK-4484] - Replace strip_leading_dir attribute with more general strip_components
|
||||
|
||||
## v0.7.0 (2014-03-18)
|
||||
|
||||
- [COOK-4437] - configure and install_with_make should chown after unpack
|
||||
|
||||
## v0.6.0 (2014-02-27)
|
||||
|
||||
[COOK-3786] - Unable to install multiple versions of archive without duplication
|
||||
|
||||
## v0.5.0 (2014-02-21)
|
||||
|
||||
### Bug
|
||||
|
||||
- **[COOK-4288](https://tickets.opscode.com/browse/COOK-4288)** - Cleanup the Kitchen
|
||||
|
||||
### Improvement
|
||||
|
||||
- **[COOK-4264](https://tickets.opscode.com/browse/COOK-4264)** - Add node['ark']['package_dependencies'] to allow tuning packages.
|
||||
|
||||
## v0.4.2
|
||||
|
||||
### Improvement
|
||||
|
||||
- **[COOK-3854](https://tickets.opscode.com/browse/COOK-3854)** - Capability with mac_os_x: '/bin/chown' - No such file or directory
|
||||
- Cleaning up some style for rubucop
|
||||
- Updating test harness
|
||||
|
||||
## v0.4.0
|
||||
|
||||
### Improvement
|
||||
|
||||
- **[COOK-3539](https://tickets.opscode.com/browse/COOK-3539)** - Allow dumping of bz2 and gzip files
|
||||
|
||||
## v0.3.2
|
||||
|
||||
### Bug
|
||||
|
||||
- **[COOK-3191](https://tickets.opscode.com/browse/COOK-3191)** - Propogate unzip failures
|
||||
- **[COOK-3118](https://tickets.opscode.com/browse/COOK-3118)** - Set cookbook attribute in provider
|
||||
- **[COOK-3055](https://tickets.opscode.com/browse/COOK-3055)** - Use proper scope in helper module
|
||||
- **[COOK-3054](https://tickets.opscode.com/browse/COOK-3054)** - Fix notification resource updating
|
||||
|
||||
### Improvement
|
||||
|
||||
- **[COOK-3179](https://tickets.opscode.com/browse/COOK-3179)** - README updates and refactor
|
||||
|
||||
## v0.3.0
|
||||
|
||||
### Improvement
|
||||
|
||||
- [COOK-3087]: Can't use ark with chef < 11
|
||||
|
||||
### Bug
|
||||
|
||||
- [COOK-3064]: `only_if` statements in ark's `install_with_make` and configure actions are not testing for file existence correctly.
|
||||
- [COOK-3067]: ark kitchen test for `cherry_pick` is expecting the binary to be in the same parent folder as in the archive.
|
||||
|
||||
## v0.2.4
|
||||
|
||||
### Bug
|
||||
|
||||
- [COOK-3048]: Ark provider contains a `ruby_block` resource without a block attribute
|
||||
- [COOK-3063]: Ark cookbook `cherry_pick` action's unzip command does not close if statement
|
||||
- [COOK-3065]: Ark install action does not symlink binaries correctly
|
||||
|
||||
## v0.2.2
|
||||
|
||||
- Update the README to reflect the requirement for Chef 11 to use the ark resource (`use_inline_resources`).
|
||||
- Making this a release so it will also appear on the community site page.
|
||||
|
||||
## v0.2.0
|
||||
|
||||
### Bug
|
||||
|
||||
- [COOK-2772]: Ark cookbook has foodcritic failures in provides/default.rb
|
||||
|
||||
### Improvement
|
||||
|
||||
- [COOK-2520]: Refactor ark providers to use the '`use_inline_resources`' LWRP DSL feature
|
||||
|
||||
## v0.1.0
|
||||
|
||||
- [COOK-2335] - ark resource broken on Chef 11
|
||||
|
||||
## v0.0.1
|
||||
|
||||
- [COOK-2026] - Allow `cherry_pick` action to be used for directories as well as files
|
||||
|
||||
## v0.0.1
|
||||
|
||||
- [COOK-1593] - README formatting updates for better display on Community Site
|
||||
|
||||
## v0.0.1
|
||||
|
||||
### Bug
|
||||
|
||||
- dangling "unless"
|
||||
|
||||
### Improvement
|
||||
|
||||
- add `setup_py_*` actions
|
||||
- add vagrantfile
|
||||
- add foodcritic test
|
||||
- travis.ci support
|
||||
|
||||
## v0.0.10 (May 23, 2012
|
||||
|
||||
### Bug
|
||||
- `strip_leading_dir` not working for zip files [https://github.com/bryanwb/chef-ark/issues/19](https://github.com/bryanwb/chef-ark/issues/19)
|
||||
|
||||
- `strip_leading_dir` not working for zip files <https://github.com/bryanwb/chef-ark/issues/19>
|
||||
|
||||
### Improvement
|
||||
- use autogen.sh to generate configure script for configure action [https://github.com/bryanwb/chef-ark/issues/16](https://github.com/bryanwb/chef-ark/issues/16)
|
||||
- support more file extensions [https://github.com/bryanwb/chef-ark/pull/18](https://github.com/bryanwb/chef-ark/pull/18)
|
||||
|
||||
- use autogen.sh to generate configure script for configure action <https://github.com/bryanwb/chef-ark/issues/16>
|
||||
- support more file extensions <https://github.com/bryanwb/chef-ark/pull/18>
|
||||
- add extension attribute which allows you to download files which do not have the file extension as part of the URL
|
||||
|
2
cookbooks/ark/CONTRIBUTING.md
Normal file
2
cookbooks/ark/CONTRIBUTING.md
Normal file
@ -0,0 +1,2 @@
|
||||
Please refer to
|
||||
https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD
|
15
cookbooks/ark/MAINTAINERS.md
Normal file
15
cookbooks/ark/MAINTAINERS.md
Normal file
@ -0,0 +1,15 @@
|
||||
<!-- This is a generated file. Please do not edit directly -->
|
||||
|
||||
# Maintainers
|
||||
|
||||
This file lists how this cookbook project is maintained. When making changes to the system, this file tells you who needs to review your patch - you need a review from an existing maintainer for the cookbook to provide a :+1: on your pull request. Additionally, you need to not receive a veto from a Lieutenant or the Project Lead.
|
||||
|
||||
Check out [How Cookbooks are Maintained](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD) for details on the process and how to become a maintainer or the project lead.
|
||||
|
||||
# Project Maintainer
|
||||
* [Tim Smith](https://github.com/tas50)
|
||||
|
||||
# Maintainers
|
||||
* [Jennifer Davis](https://github.com/sigje)
|
||||
* [Tim Smith](https://github.com/tas50)
|
||||
* [Thom May](https://github.com/thommay)
|
@ -1,7 +1,9 @@
|
||||
# ark cookbook
|
||||
[](https://travis-ci.org/burtlo/ark) [](https://supermarket.chef.io/cookbooks/ark)
|
||||
|
||||
[](https://travis-ci.org/chef-cookbooks/ark) [](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,40 +28,51 @@ 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 11+
|
||||
|
||||
- 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`. It does _not_ run the configure step at this time
|
||||
- `:install_with_make`: extracts the archive to a path, runs `configure`, `make`, and `make install`.
|
||||
- `:dump`: strips all directories from the archive and dumps the contained files into a specified path
|
||||
- `:cherry_pick`: extract a specified file from an archive and places in specified path
|
||||
- `:put`: extract the archive to a specified path, does not create any symbolic links
|
||||
@ -68,34 +82,43 @@ 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.
|
||||
@ -103,35 +126,55 @@ Extract the archive to a specified path, does not create any symbolic links.
|
||||
- `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`
|
||||
|
||||
- `group`: group 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`
|
||||
|
||||
#### 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
|
||||
@ -158,7 +201,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
|
||||
@ -168,7 +211,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:
|
||||
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
|
||||
@ -176,10 +219,11 @@ Install Apache Ivy dependency resolution tool in /home/foobar/ivy, strip any lea
|
||||
url 'http://someurl.example.com/ivy.tar.gz'
|
||||
checksum '89ba5fde0c596db388c3bbd265b63007a9cc3df3a8e6d79a46780c1a39408cb5'
|
||||
action :put
|
||||
backup false
|
||||
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
|
||||
@ -217,17 +261,18 @@ Build and install haproxy and use alternative values for `prefix_root`, `prefix_
|
||||
end
|
||||
```
|
||||
|
||||
You can also pass multiple actions to ark and supply the file extension in case the file extension can not be determined by the URL:
|
||||
You can also supply the file extension in case the file extension can not be determined by the URL:
|
||||
|
||||
```ruby
|
||||
ark "test_autogen" do
|
||||
url 'https://github.com/zeromq/libzmq/tarball/master'
|
||||
extension "tar.gz"
|
||||
action [ :configure, :install_with_make ]
|
||||
action :install_with_make
|
||||
end
|
||||
```
|
||||
|
||||
## License and Authors
|
||||
## License & Authors
|
||||
|
||||
- Author: Philip (flip) Kromer - Infochimps, Inc([coders@infochimps.com](mailto:coders@infochimps.com))
|
||||
- Author: Bryan W. Berry ([bryan.berry@gmail.com](mailto:bryan.berry@gmail.com))
|
||||
- Author: Denis Barishev ([denis.barishev@gmail.com](mailto:denis.barishev@gmail.com))
|
||||
@ -236,7 +281,7 @@ You can also pass multiple actions to ark and supply the file extension in case
|
||||
- Copyright: 2011, Philip (flip) Kromer - Infochimps, Inc
|
||||
- Copyright: 2012, Bryan W. Berry
|
||||
- Copyright: 2012, Denis Barishev
|
||||
- Copyright: 2013, Chef Software, Inc
|
||||
- Copyright: 2013-2016, Chef Software, Inc
|
||||
- Copyright: 2014, Bloomberg L.P.
|
||||
|
||||
```
|
||||
|
@ -20,24 +20,28 @@ default['ark']['apache_mirror'] = 'http://apache.mirrors.tds.net'
|
||||
default['ark']['prefix_root'] = '/usr/local'
|
||||
default['ark']['prefix_bin'] = '/usr/local/bin'
|
||||
default['ark']['prefix_home'] = '/usr/local'
|
||||
default['ark']['tar'] = case node['platform_family']
|
||||
when 'windows'
|
||||
"\"#{ENV['SYSTEMDRIVE']}\\7-zip\\7z.exe\""
|
||||
when 'mac_os_x', 'freebsd'
|
||||
'/usr/bin/tar'
|
||||
when 'smartos'
|
||||
'/bin/gtar'
|
||||
else
|
||||
'/bin/tar'
|
||||
end
|
||||
|
||||
pkgs = %w(libtool autoconf) unless platform_family?('mac_os_x', 'windows')
|
||||
pkgs += %w(make) unless platform_family?('mac_os_x', 'windows', 'freebsd')
|
||||
pkgs += %w(unzip rsync gcc) unless platform_family?('mac_os_x', 'windows')
|
||||
pkgs += %w(autogen) unless platform_family?('rhel', 'fedora', 'mac_os_x', 'suse', 'windows')
|
||||
# the default path will be determined based on platform, but can be overridden here
|
||||
default['ark']['tar'] = nil
|
||||
|
||||
# the default path will be determined from the registry, but you may override here
|
||||
default['ark']['sevenzip_binary'] = nil
|
||||
|
||||
pkgs = %w(libtool autoconf) unless platform_family?('mac_os_x')
|
||||
pkgs += %w(make) unless platform_family?('mac_os_x', 'freebsd')
|
||||
pkgs += %w(unzip rsync gcc) unless platform_family?('mac_os_x')
|
||||
pkgs += %w(autogen) unless platform_family?('rhel', 'fedora', 'mac_os_x', 'suse')
|
||||
pkgs += %w(gtar) if platform?('freebsd') || platform?('smartos')
|
||||
pkgs += %w(gmake) if platform?('freebsd')
|
||||
pkgs += %w(xz-lzma-compat bzip2 tar) if platform_family?('rhel', 'fedora')
|
||||
if platform_family?('rhel', 'suse')
|
||||
if node['platform_version'].to_i >= 7
|
||||
pkgs += %w(xz bzip2 tar)
|
||||
elsif node['platform_version'].to_i < 7
|
||||
pkgs += %w(xz-lzma-compat bzip2 tar)
|
||||
end
|
||||
elsif platform_family?('fedora')
|
||||
pkgs += %w(xz-lzma-compat bzip2 tar)
|
||||
end
|
||||
pkgs += %w(shtool pkg-config) if platform_family?('debian')
|
||||
|
||||
default['ark']['package_dependencies'] = pkgs
|
||||
|
@ -43,13 +43,13 @@ module Ark
|
||||
@resource_defaults ||= ::Ark::ResourceDefaults.new(new_resource)
|
||||
end
|
||||
|
||||
# rubocop:disable Metrics/AbcSize
|
||||
def set_paths
|
||||
new_resource.extension = defaults.extension
|
||||
new_resource.prefix_bin = defaults.prefix_bin
|
||||
new_resource.prefix_root = defaults.prefix_root
|
||||
new_resource.home_dir = defaults.home_dir
|
||||
new_resource.version = defaults.version
|
||||
new_resource.owner = defaults.owner
|
||||
|
||||
# TODO: what happens when the path is already set --
|
||||
# with the current logic we overwrite it
|
||||
|
@ -1,5 +1,7 @@
|
||||
|
||||
if defined?(ChefSpec)
|
||||
ChefSpec.define_matcher :ark
|
||||
|
||||
def install_ark(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:ark, :install, resource_name)
|
||||
end
|
||||
|
@ -33,6 +33,10 @@ module Ark
|
||||
end
|
||||
end
|
||||
|
||||
def owner
|
||||
resource.owner || default_owner
|
||||
end
|
||||
|
||||
def windows?
|
||||
node_in_run_context['platform_family'] == 'windows'
|
||||
end
|
||||
@ -62,13 +66,13 @@ module Ark
|
||||
|
||||
def generate_extension_from_url(url)
|
||||
# purge any trailing redirect
|
||||
url =~ %r{^https?:\/\/.*(.bin|bz2|gz|jar|tbz|tgz|txz|war|xz|zip)(\/.*\/)}
|
||||
url =~ %r{^https?:\/\/.*(.bin|bz2|gz|jar|tbz|tgz|txz|war|xz|zip|7z)(\/.*\/)}
|
||||
url.gsub!(Regexp.last_match(2), '') unless Regexp.last_match(2).nil?
|
||||
# remove tailing query string
|
||||
# remove trailing query string
|
||||
release_basename = ::File.basename(url.gsub(/\?.*\z/, '')).gsub(/-bin\b/, '')
|
||||
# (\?.*)? accounts for a trailing querystring
|
||||
Chef::Log.debug("DEBUG: release_basename is #{release_basename}")
|
||||
release_basename =~ /^(.+?)\.(jar|tar\.bz2|tar\.gz|tar\.xz|tbz|tgz|txz|war|zip|tar)(\?.*)?/
|
||||
release_basename =~ /^(.+?)\.(jar|tar\.bz2|tar\.gz|tar\.xz|tbz|tgz|txz|war|zip|tar|7z)(\?.*)?/
|
||||
Chef::Log.debug("DEBUG: file_extension is #{Regexp.last_match(2)}")
|
||||
Regexp.last_match(2)
|
||||
end
|
||||
@ -86,7 +90,22 @@ module Ark
|
||||
end
|
||||
|
||||
def default_version
|
||||
"1"
|
||||
'1'
|
||||
end
|
||||
|
||||
def default_owner
|
||||
if windows?
|
||||
wmi_property_from_query(:name, "select * from Win32_UserAccount where sid like 'S-1-5-21-%-500' and LocalAccount=True")
|
||||
else
|
||||
'root'
|
||||
end
|
||||
end
|
||||
|
||||
def wmi_property_from_query(wmi_property, wmi_query)
|
||||
@wmi = ::WIN32OLE.connect('winmgmts://')
|
||||
result = @wmi.ExecQuery(wmi_query)
|
||||
return nil unless result.each.count > 0
|
||||
result.each.next.send(wmi_property)
|
||||
end
|
||||
|
||||
def file_cache_path
|
||||
|
@ -27,7 +27,7 @@ module Ark
|
||||
end
|
||||
|
||||
def strip_leading_dir_feature_message
|
||||
"strip_leading_dir attribute was deprecated. Use strip_components instead."
|
||||
'strip_leading_dir attribute was deprecated. Use strip_components instead.'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -9,7 +9,7 @@ module Ark
|
||||
end
|
||||
|
||||
def cherry_pick
|
||||
"#{sevenzip_command_builder(resource.path, 'e')} -r #{resource.creates}"
|
||||
"#{sevenzip_command_builder(resource.path, 'x')} -r #{resource.creates}"
|
||||
end
|
||||
|
||||
def initialize(resource)
|
||||
@ -20,30 +20,42 @@ module Ark
|
||||
|
||||
attr_reader :resource
|
||||
|
||||
# rubocop:disable Metrics/AbcSize
|
||||
def node
|
||||
resource.run_context.node
|
||||
end
|
||||
|
||||
def sevenzip_command
|
||||
if resource.strip_components <= 0
|
||||
sevenzip_command_builder(resource.path, 'x')
|
||||
return
|
||||
return sevenzip_command_builder(resource.path, 'x')
|
||||
end
|
||||
|
||||
tmpdir = make_temp_directory
|
||||
cmd = sevenzip_command_builder(tmpdir, 'e')
|
||||
tmpdir = make_temp_directory.tr('/', '\\')
|
||||
cmd = sevenzip_command_builder(tmpdir, 'x')
|
||||
|
||||
cmd += " && "
|
||||
currdir = tmpdir.tr('/', '\\')
|
||||
cmd += ' && '
|
||||
currdir = tmpdir
|
||||
|
||||
1.upto(resource.strip_components).each do |count|
|
||||
cmd += "for /f %#{count} in ('dir /ad /b \"#{currdir}\"') do "
|
||||
currdir += "\\%#{count}"
|
||||
end
|
||||
|
||||
cmd += "xcopy \"#{currdir}\" \"#{resource.home_dir}\" /s /e"
|
||||
cmd += "(\"#{ENV.fetch('SystemRoot')}\\System32\\robocopy\" \"#{currdir}\" \"#{resource.path}\" /s /e) ^& IF %ERRORLEVEL% LEQ 3 cmd /c exit 0"
|
||||
end
|
||||
# rubocop:enable Metrics/AbcSize
|
||||
|
||||
def sevenzip_binary
|
||||
resource.run_context.node['ark']['tar']
|
||||
@tar_binary ||= "\"#{(node['ark']['sevenzip_binary'] || sevenzip_path_from_registry)}\""
|
||||
end
|
||||
|
||||
def sevenzip_path_from_registry
|
||||
begin
|
||||
basepath = ::Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\7zFM.exe').read_s('Path')
|
||||
|
||||
# users like pretty errors
|
||||
rescue ::Win32::Registry::Error
|
||||
raise 'Failed to find the path of 7zip binary by searching checking HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\7zFM.exe\Path. Make sure to install 7zip before using this resource. If 7zip is installed and you still receive this message you can also specify the 7zip binary path by setting node["ark"]["sevenzip_binary"]'
|
||||
end
|
||||
"#{basepath}7z.exe"
|
||||
end
|
||||
|
||||
def sevenzip_command_builder(dir, command)
|
||||
@ -54,7 +66,7 @@ module Ark
|
||||
if resource.extension =~ /tar.gz|tgz|tar.bz2|tbz|tar.xz|txz/
|
||||
" -so | #{sevenzip_binary} x -aoa -si -ttar"
|
||||
else
|
||||
""
|
||||
' -aoa' # force overwrite, Fixes #164
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -25,21 +25,28 @@ module Ark
|
||||
end
|
||||
|
||||
def tar_binary
|
||||
resource.run_context.node['ark']['tar']
|
||||
@tar_binary ||= node['ark']['tar'] || case node['platform_family']
|
||||
when 'mac_os_x', 'freebsd'
|
||||
'/usr/bin/tar'
|
||||
when 'smartos'
|
||||
'/bin/gtar'
|
||||
else
|
||||
'/bin/tar'
|
||||
end
|
||||
end
|
||||
|
||||
def args
|
||||
case resource.extension
|
||||
when /^(tar)$/ then "xf"
|
||||
when /^(tar.gz|tgz)$/ then "xzf"
|
||||
when /^(tar.bz2|tbz)$/ then "xjf"
|
||||
when /^(tar.xz|txz)$/ then "xJf"
|
||||
when /^(tar)$/ then 'xf'
|
||||
when /^(tar.gz|tgz)$/ then 'xzf'
|
||||
when /^(tar.bz2|tbz)$/ then 'xjf'
|
||||
when /^(tar.xz|txz)$/ then 'xJf'
|
||||
else raise unsupported_extension
|
||||
end
|
||||
end
|
||||
|
||||
def strip_args
|
||||
resource.strip_components > 0 ? " --strip-components=#{resource.strip_components}" : ""
|
||||
resource.strip_components > 0 ? " --strip-components=#{resource.strip_components}" : ''
|
||||
end
|
||||
|
||||
def unsupported_extension
|
||||
|
@ -12,18 +12,16 @@ module Ark
|
||||
"unzip -j -q -o \"#{resource.release_file}\" -d \"#{resource.path}\""
|
||||
end
|
||||
|
||||
# rubocop:disable Metrics/AbcSize
|
||||
def cherry_pick
|
||||
cmd = "unzip -t #{resource.release_file} \"*/#{resource.creates}\" ; stat=$? ;"
|
||||
cmd += "if [ $stat -eq 11 ] ; then "
|
||||
cmd += 'if [ $stat -eq 11 ] ; then '
|
||||
cmd += "unzip -j -o #{resource.release_file} \"#{resource.creates}\" -d #{resource.path} ;"
|
||||
cmd += "elif [ $stat -ne 0 ] ; then false ;"
|
||||
cmd += "else "
|
||||
cmd += 'elif [ $stat -ne 0 ] ; then false ;'
|
||||
cmd += 'else '
|
||||
cmd += "unzip -j -o #{resource.release_file} \"*/#{resource.creates}\" -d #{resource.path} ;"
|
||||
cmd += "fi"
|
||||
cmd += 'fi'
|
||||
cmd
|
||||
end
|
||||
# rubocop:enable Metrics/AbcSize
|
||||
|
||||
def initialize(resource)
|
||||
@resource = resource
|
||||
|
@ -7,7 +7,7 @@ module Ark
|
||||
attr_reader :resource
|
||||
|
||||
def command
|
||||
"icacls \"#{resource.path}\\*\" /setowner \"#{resource.owner}\""
|
||||
"#{ENV.fetch('SystemRoot')}\\System32\\icacls \"#{resource.path}\\*\" /setowner \"#{resource.owner}\""
|
||||
end
|
||||
end
|
||||
end
|
||||
|
File diff suppressed because one or more lines are too long
@ -6,7 +6,7 @@
|
||||
# Author:: Sean OMeara <someara@chef.io
|
||||
# Author:: John Bellone <jbellone@bloomberg.net>
|
||||
# Copyright 2012, Bryan W. Berry
|
||||
# Copyright 2013, Chef Software, Inc.
|
||||
# Copyright 2013-2016, Chef Software, Inc.
|
||||
# Copyright 2014, Bloomberg L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -44,6 +44,7 @@ action :install do
|
||||
checksum new_resource.checksum if new_resource.checksum
|
||||
action :create
|
||||
notifies :run, "execute[unpack #{new_resource.release_file}]"
|
||||
backup new_resource.backup
|
||||
end
|
||||
|
||||
# unpack based on file extension
|
||||
@ -61,7 +62,7 @@ action :install do
|
||||
action :nothing
|
||||
end
|
||||
|
||||
# usually on windows there is no central directory with executables where the applciations are linked
|
||||
# usually on windows there is no central directory with executables where the applications are linked
|
||||
unless node['platform_family'] == 'windows'
|
||||
# symlink binaries
|
||||
new_resource.has_binaries.each do |bin|
|
||||
@ -80,7 +81,7 @@ action :install do
|
||||
cookbook 'ark'
|
||||
source 'add_to_path.sh.erb'
|
||||
owner 'root'
|
||||
group 'root'
|
||||
group node['root_group']
|
||||
mode '0755'
|
||||
cookbook 'ark'
|
||||
variables(directory: "#{new_resource.path}/bin")
|
||||
@ -119,6 +120,7 @@ action :put do
|
||||
checksum new_resource.checksum if new_resource.checksum
|
||||
action :create
|
||||
notifies :run, "execute[unpack #{new_resource.release_file}]"
|
||||
backup new_resource.backup
|
||||
end
|
||||
|
||||
# unpack based on file extension
|
||||
|
@ -18,8 +18,6 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
Array(node['ark']['package_dependencies']).each do |pkg|
|
||||
package pkg
|
||||
end
|
||||
package node['ark']['package_dependencies'] unless %w(windows mac_os_x).include?(node['platform_family'])
|
||||
|
||||
include_recipe "seven_zip" if node['platform_family'] == 'windows'
|
||||
include_recipe 'seven_zip' if node['platform_family'] == 'windows'
|
||||
|
@ -35,14 +35,15 @@ default_action :install
|
||||
|
||||
attr_accessor :extension,
|
||||
:home_dir,
|
||||
:owner,
|
||||
:path,
|
||||
:prefix_bin,
|
||||
:prefix_root,
|
||||
:release_file,
|
||||
:version
|
||||
|
||||
attribute :owner, kind_of: String, default: 'root'
|
||||
attribute :group, kind_of: [String, Fixnum], default: 0
|
||||
attribute :owner, kind_of: String, default: nil
|
||||
attribute :group, kind_of: [String, Integer], default: 0
|
||||
attribute :url, kind_of: String, required: true
|
||||
attribute :path, kind_of: String, default: nil
|
||||
attribute :full_path, kind_of: String, default: nil
|
||||
@ -53,7 +54,7 @@ attribute :creates, kind_of: String, default: nil
|
||||
attribute :release_file, kind_of: String, default: ''
|
||||
attribute :strip_leading_dir, kind_of: [TrueClass, FalseClass, NilClass]
|
||||
attribute :strip_components, kind_of: Integer, default: 1
|
||||
attribute :mode, kind_of: Fixnum, default: 0755
|
||||
attribute :mode, kind_of: Integer, default: 0755
|
||||
attribute :prefix_root, kind_of: String, default: nil
|
||||
attribute :prefix_home, kind_of: String, default: nil
|
||||
attribute :prefix_bin, kind_of: String, default: nil
|
||||
@ -66,3 +67,4 @@ attribute :make_opts, kind_of: Array, default: []
|
||||
attribute :home_dir, kind_of: String, default: nil
|
||||
attribute :autoconf_opts, kind_of: Array, default: []
|
||||
attribute :extension, kind_of: String
|
||||
attribute :backup, kind_of: [FalseClass, Integer], default: 5
|
||||
|
Loading…
x
Reference in New Issue
Block a user