itamae-plugin-recipe-yk_kernel_devel 0.1.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 42458cb77bab0957fb8eb204c5aba766897404b2
4
- data.tar.gz: 5c022e9249b26d65bb2eeada7fce50d141e32eb8
3
+ metadata.gz: 1d9cae77cbaa151c22a8a277606d98fa9ce598e9
4
+ data.tar.gz: 67c2dd93729491f9efc69cc90007a633825aaded
5
5
  SHA512:
6
- metadata.gz: ae72e3deaec872582e906bad2dc0dda7d7da0ef64fdb80bbd407f6ee34640af5f809f297f395a4a2665f31b07ed608dc0121670d698d7b3a29b92618b5b4f3b4
7
- data.tar.gz: f40e58bfee2890fbb30fec6b0ba3d8e583e2d57cbfaac5673f3ff76ee4965bdf927edcc309f6235e71ff782067f656bc431b4ef18dcdd5b77820763242c3f287
6
+ metadata.gz: 2f3bf89abfdb162840f5b548a0383e49822464f34c40adde16816412115a2884c5591a9c8e9476069515d589fde6bb0cb2267b94115873c77312025fd277faf6
7
+ data.tar.gz: c601750632fcaa3a1a035a39c4de93b37c61b3123307fc7a7093e84c7307b7191f60db7c48aaa0f2c243e31da8d69548afee26ddd1dcddafd6c5be3c8b2d3df3
data/README.md CHANGED
@@ -1,7 +1,11 @@
1
+ [![Gem Version](https://badge.fury.io/rb/itamae-plugin-recipe-yk_kernel_devel.svg)](https://badge.fury.io/rb/itamae-plugin-recipe-yk_kernel_devel)
2
+ [![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://github.com/yosuke0315/itamae-plugin-recipe-yk_kernel_devel/blob/master/LICENSE.txt)
3
+
1
4
  # Itamae::Plugin::Recipe::YkKernelDevel
2
5
 
3
6
  Itamae plugin to install kernel-devel.<br>
4
- This plugin can install the same version of the kernel-devel with your kernel.
7
+ This plugin can install the same version of the kernel-devel with your kernel.<br>
8
+ This is available only on redhat.
5
9
 
6
10
  ## Installation
7
11
 
@@ -24,22 +28,9 @@ Or install it yourself as:
24
28
  ### install for system
25
29
 
26
30
  ```rb
27
- # recipe.rb
28
-
29
- include_recipe "yk_mecab::install"
31
+ include_recipe "yk_kernel_devel::install"
30
32
  ```
31
33
 
32
- ## Development
33
-
34
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
35
-
36
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
37
-
38
- ## Contributing
39
-
40
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/itamae-plugin-recipe-yk_kernel_devel. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
41
-
42
-
43
34
  ## License
44
35
 
45
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
36
+ [MIT License](http://opensource.org/licenses/MIT).
@@ -7,19 +7,54 @@ rpm_packages_version = run_command("rpm -qa")
7
7
  kernel_devel_wrong_version = rpm_packages_version.stdout.match(/kernel-devel-.*/).to_s
8
8
  p kernel_devel_wrong_version
9
9
 
10
+ kernel_devel_expected_version = "kernel-devel-#{kernel_version}"
11
+ p kernel_devel_expected_version
12
+
10
13
  if kernel_version != kernel_devel_wrong_version.gsub(/kernel-devel-/, "")
11
14
  execute "rpm -e --nodeps #{kernel_devel_wrong_version}" do
12
15
  only_if 'rpm -qa | grep kernel-devel'
13
16
  end
14
17
  end
15
18
 
16
- kernel_devel_expected_version = "kernel-devel-#{kernel_version}"
19
+ unless run_command("grep exclude=kernel* /etc/yum.conf").stdout.include?('#')
20
+ file '/etc/yum.conf' do
21
+ action :edit
22
+ block do |content|
23
+ content.gsub!('exclude=kernel*', '# exclude=kernel*')
24
+ end
25
+ end
26
+ end
27
+
28
+ local_ruby_block 'install kernel-devel by yum' do
29
+ block do
30
+ run_command("sudo yum install #{kernel_devel_expected_version}", error: false)
31
+ end
32
+ not_if 'rpm -qa | grep kernel-devel'
33
+ end
17
34
 
18
- execute "wget \"ftp://mirror.switch.ch/pool/4/mirror/scientificlinux/#{node[:platform_version]}/x86_64/os/Packages/#{kernel_devel_expected_version}.rpm\"" do
35
+ local_ruby_block 'install kernel-devel by rpm' do
36
+ block do
37
+ run_command("wget \"ftp://mirror.switch.ch/pool/4/mirror/scientificlinux/#{node[:platform_version][0..2]}/x86_64/os/Packages/#{kernel_devel_expected_version}.rpm\"", error: false)
38
+ end
19
39
  not_if 'rpm -qa | grep kernel-devel'
20
40
  not_if 'ls | grep kernel-devel'
21
41
  end
22
42
 
23
43
  execute "rpm -ivh #{kernel_devel_expected_version}.rpm" do
24
44
  not_if 'rpm -qa | grep kernel-devel'
45
+ only_if 'ls | grep kernel-devel'
46
+ end
47
+
48
+ local_ruby_block 'check kernel-devel install' do
49
+ block do
50
+ rpm_packages_version = run_command("rpm -qa")
51
+ kernel_devel_version = rpm_packages_version.stdout.match(/kernel-devel-.*/).to_s
52
+ p kernel_devel_version
53
+
54
+ if kernel_version == kernel_devel_version.gsub(/kernel-devel-/, "")
55
+ puts 'kernel-devel is installed'
56
+ else
57
+ puts 'Error : Could not install kernel-devel. You need to install by yourself, sorry.'
58
+ end
59
+ end
25
60
  end
@@ -2,7 +2,7 @@ module Itamae
2
2
  module Plugin
3
3
  module Recipe
4
4
  module YkKernelDevel
5
- VERSION = "0.1.0"
5
+ VERSION = "0.2.1"
6
6
  end
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itamae-plugin-recipe-yk_kernel_devel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - yosuke0315
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-15 00:00:00.000000000 Z
11
+ date: 2016-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: itamae