Permalink
Browse files

On Fedora install Skype from repo instead if dl'ing rpm manually

  • Loading branch information...
1 parent 06cf508 commit 6757c97223602cc1255051f672f9b4c250c2a6ae @sickill sickill committed Jul 1, 2011
@@ -1,19 +1,12 @@
case node[:platform]
when 'fedora'
- base_url = "http://download.skype.com/linux/"
- skype_version = "2.2.0.35"
- filename = "skype-#{skype_version}-fedora.i586.rpm"
-
- bash "downloading package #{filename}" do
- cwd "/tmp"
- code "curl -kLsO #{base_url}#{filename}"
- not_if { File.exist? "/tmp/#{filename}" }
+ yum_repository "skype" do
+ name "Skype Repository"
+ url "http://download.skype.com/linux/repos/fedora/updates/i586"
+ key "http://www.skype.com/products/skype/linux/rpm-public-key.asc"
end
- package 'skype' do
- source "/tmp/#{filename}"
- action :install
- end
+ package 'skype'
when 'ubuntu'
include_recipe 'init::ubuntu' # for partner repo
View
@@ -0,0 +1,127 @@
+Description
+===========
+
+Configures various YUM components on Red Hat-like systems. Includes LWRP for managing repositories and their GPG keys.
+
+Based on the work done by Eric Wolfe and Charles Duffy on the yumrepo cookbook. http://github.com/atomic-penguin/cookbooks/tree/yumrepo/yumrepo
+
+Changes
+=======
+
+## v.0.1.2:
+
+* Remove yum update in default recipe, that doesn't update caches, it
+ updates packages installed.
+
+Requirements
+============
+RHEL, CentOS or Scientific Linux 5.x or newer. It has not been tested on other platforms or earlier versions. RHEL 6 support is untested (testing and patches are welcome).
+
+Recipes
+=======
+
+default
+-------
+The default recipe runs `yum update` during the Compile Phase of the Chef run to ensure that the system's package cache is updated with the latest. It is recommended that this recipe appear first in a node's run list (directly or through a role) to ensure that when installing packages, Chef will be able to download the latest version available on the remote YUM repository.
+
+yum
+---
+Manages the configuration of the `/etc/yum.conf` via attributes.
+
+Resources/Providers
+===================
+
+key
+---
+This LWRP handles importing GPG keys for YUM repositories. Keys can be imported by the `url` parameter or placed in `/etc/pki/rpm-gpg/` by a recipe and then installed with the LWRP without passing the URL.
+
+# Actions
+- :add: installs the GPG key into `/etc/pki/rpm-gpg/`
+- :remove: removes the GPG key from `/etc/pki/rpm-gpg/`
+
+# Attribute Parameters
+
+- key: name attribute. The name of the GPG key to install.
+- url: if the key needs to be downloaded, the URL providing the download.
+
+# Example
+
+``` ruby
+# add the Zenoss GPG key
+yum_key "RPM-GPG-KEY-zenoss" do
+ url "http://dev.zenoss.com/yum/RPM-GPG-KEY-zenoss"
+ action :add
+end
+
+# remove Zenoss GPG key
+yum_key "RPM-GPG-KEY-zenoss" do
+ action :remove
+end
+```
+
+repository
+----------
+This LWRP provides an easy way to manage additional YUM repositories. GPG keys can be managed with the `key` LWRP.
+
+# Actions
+
+- :add: creates a repository file and builds the repository listing
+- :remove: removes the repository file
+
+# Attribute Parameters
+
+- repo_name: name attribute. The name of the channel to discover
+- description. The description of the repository
+- url: The URL providing the packages
+- mirrorlist: Default is `false`, if `true` the `url` is considered a list of mirrors
+- key: Optional, the name of the GPG key file installed by the `key` LWRP.
+- enabled: Default is `1`, set to `0` if the repository is disabled.
+- type: Optional, alternate type of repository
+- failovermethod: Optional, failovermethod
+- bootstrapurl: Optional, bootstrapurl
+
+# Example
+
+``` ruby
+# add the Zenoss repository
+yum_repository "zenoss" do
+ name "Zenoss Stable repo"
+ url "http://dev.zenoss.com/yum/stable/"
+ key "RPM-GPG-KEY-zenoss"
+ action :add
+end
+
+# remove Zenoss repo
+yum_repository "zenoss" do
+ action :remove
+end
+```
+
+Usage
+=====
+
+Put `recipe[yum]` first in the run list to ensure `yum update` is run before other recipes. You can manage GPG keys either with cookbook_file in a recipe if you want to package it with a cookbook or use the `url` parameter of the `key` LWRP.
+
+License and Author
+==================
+
+Author:: Eric G. Wolfe
+
+Copyright:: 2010-2011
+
+Author:: Matt Ray (<matt@opscode.com>)
+
+Copyright:: 2011 Opscode, 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.
+
@@ -0,0 +1,23 @@
+#
+# Cookbook Name:: yum
+# Attributes:: default
+#
+# Copyright 2011, Eric G. Wolfe
+# Copyright 2011, Opscode, 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.
+#
+
+# Example: override.yum.exclude = "kernel* compat-glibc*"
+default[:yum][:exclude]
+default[:yum][:installonlypkgs]
@@ -0,0 +1,60 @@
+{
+ "name": "yum",
+ "description": "A fabulous new cookbook",
+ "long_description": "Description\n===========\n\nConfigures various YUM components on Red Hat-like systems. Includes LWRP for managing repositories and their GPG keys.\n\nBased on the work done by Eric Wolfe and Charles Duffy on the yumrepo cookbook. http://github.com/atomic-penguin/cookbooks/tree/yumrepo/yumrepo\n\nChanges\n=======\n\n## v.0.1.2:\n\n* Remove yum update in default recipe, that doesn't update caches, it\n updates packages installed.\n\nRequirements\n============\nRHEL, CentOS or Scientific Linux 5.x or newer. It has not been tested on other platforms or earlier versions. RHEL 6 support is untested (testing and patches are welcome).\n\nRecipes\n=======\n\ndefault\n-------\nThe default recipe runs `yum update` during the Compile Phase of the Chef run to ensure that the system's package cache is updated with the latest. It is recommended that this recipe appear first in a node's run list (directly or through a role) to ensure that when installing packages, Chef will be able to download the latest version available on the remote YUM repository.\n\nyum\n---\nManages the configuration of the `/etc/yum.conf` via attributes.\n\nResources/Providers\n===================\n\nkey\n---\nThis LWRP handles importing GPG keys for YUM repositories. Keys can be imported by the `url` parameter or placed in `/etc/pki/rpm-gpg/` by a recipe and then installed with the LWRP without passing the URL.\n\n# Actions\n- :add: installs the GPG key into `/etc/pki/rpm-gpg/`\n- :remove: removes the GPG key from `/etc/pki/rpm-gpg/`\n\n# Attribute Parameters\n\n- key: name attribute. The name of the GPG key to install.\n- url: if the key needs to be downloaded, the URL providing the download.\n\n# Example\n\n``` ruby\n# add the Zenoss GPG key\nyum_key \"RPM-GPG-KEY-zenoss\" do\n url \"http://dev.zenoss.com/yum/RPM-GPG-KEY-zenoss\"\n action :add\nend\n \n# remove Zenoss GPG key\nyum_key \"RPM-GPG-KEY-zenoss\" do\n action :remove\nend\n```\n\nrepository\n----------\nThis LWRP provides an easy way to manage additional YUM repositories. GPG keys can be managed with the `key` LWRP.\n\n# Actions\n\n- :add: creates a repository file and builds the repository listing\n- :remove: removes the repository file\n\n# Attribute Parameters\n\n- repo_name: name attribute. The name of the channel to discover\n- description. The description of the repository\n- url: The URL providing the packages\n- mirrorlist: Default is `false`, if `true` the `url` is considered a list of mirrors\n- key: Optional, the name of the GPG key file installed by the `key` LWRP.\n- enabled: Default is `1`, set to `0` if the repository is disabled.\n- type: Optional, alternate type of repository\n- failovermethod: Optional, failovermethod\n- bootstrapurl: Optional, bootstrapurl\n\n# Example\n\n``` ruby\n# add the Zenoss repository\nyum_repository \"zenoss\" do\n name \"Zenoss Stable repo\"\n url \"http://dev.zenoss.com/yum/stable/\"\n key \"RPM-GPG-KEY-zenoss\"\n action :add\nend\n \n# remove Zenoss repo\nyum_repository \"zenoss\" do\n action :remove\nend\n```\n\nUsage\n=====\n\nPut `recipe[yum]` first in the run list to ensure `yum update` is run before other recipes. You can manage GPG keys either with cookbook_file in a recipe if you want to package it with a cookbook or use the `url` parameter of the `key` LWRP.\n\nLicense and Author\n==================\n\nAuthor:: Eric G. Wolfe\n\nCopyright:: 2010-2011\n\nAuthor:: Matt Ray (<matt@opscode.com>)\n\nCopyright:: 2011 Opscode, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\n",
+ "maintainer": "Opscode, Inc.",
+ "maintainer_email": "cookbooks@opscode.com",
+ "license": "Apache 2.0",
+ "platforms": {
+ "redhat": ">= 5.0",
+ "centos": ">= 5.0",
+ "scientific": ">= 5.0"
+ },
+ "dependencies": {
+ },
+ "recommendations": {
+ },
+ "suggestions": {
+ },
+ "conflicting": {
+ },
+ "providing": {
+ },
+ "replacing": {
+ },
+ "attributes": {
+ "yum/exclude": {
+ "display_name": "yum.conf exclude",
+ "description": "List of packages to exclude from updates or installs. This should be a space separated list. Shell globs using wildcards (eg. * and ?) are allowed.",
+ "required": "optional",
+ "choice": [
+
+ ],
+ "calculated": false,
+ "type": "string",
+ "recipes": [
+
+ ]
+ },
+ "yum/installonlypkgs": {
+ "display_name": "yum.conf installonlypkgs",
+ "description": "List of packages that should only ever be installed, never updated. Kernels in particular fall into this category. Defaults to kernel, kernel-smp, kernel-bigmem, kernel-enterprise, kernel-debug, kernel-unsupported.",
+ "required": "optional",
+ "choice": [
+
+ ],
+ "calculated": false,
+ "type": "string",
+ "recipes": [
+
+ ]
+ }
+ },
+ "groupings": {
+ },
+ "recipes": {
+ "yum": "Runs 'yum update' during compile phase",
+ "yum::yum": "manages yum configuration"
+ },
+ "version": "0.1.2"
+}
View
@@ -0,0 +1,21 @@
+maintainer "Opscode, Inc."
+maintainer_email "cookbooks@opscode.com"
+license "Apache 2.0"
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
+version "0.1.2"
+recipe "yum", "Runs 'yum update' during compile phase"
+recipe "yum::yum", "manages yum configuration"
+
+%w{ redhat centos scientific }.each do |os|
+ supports os, ">= 5.0"
+end
+
+attribute "yum/exclude",
+ :display_name => "yum.conf exclude",
+ :description => "List of packages to exclude from updates or installs. This should be a space separated list. Shell globs using wildcards (eg. * and ?) are allowed.",
+ :required => "optional"
+
+attribute "yum/installonlypkgs",
+ :display_name => "yum.conf installonlypkgs",
+ :description => "List of packages that should only ever be installed, never updated. Kernels in particular fall into this category. Defaults to kernel, kernel-smp, kernel-bigmem, kernel-enterprise, kernel-debug, kernel-unsupported.",
+ :required => "optional"
@@ -0,0 +1,74 @@
+#
+# Cookbook Name:: yum
+# Provider:: key
+#
+# Copyright 2010, Tippr Inc.
+# Copyright 2011, Opscode, 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.
+#
+
+action :add do
+ unless ::File.exists?("/etc/pki/rpm-gpg/#{new_resource.key}")
+ Chef::Log.info "Adding #{new_resource.key} GPG key to /etc/pki/rpm-gpg/"
+
+ if node[:platform_version].to_i <= 5
+ package "gnupg"
+ elsif node[:platform_version].to_i >= 6
+ package "gnupg2"
+ end
+
+ execute "rpm --import /etc/pki/rpm-gpg/#{new_resource.key}" do
+ action :nothing
+ not_if <<-EOH
+ function packagenames_for_keyfile() {
+ local filename="$1"
+ gpg \
+ --with-fingerprint \
+ --with-colons \
+ --fixed-list-mode \
+ "$filename" \
+ | gawk -F: '/^pub/ { print tolower(sprintf("gpg-pubkey-%s-%x\\n", substr($5, length($5)-8+1), $6)) }'
+ }
+
+ for pkgname in $(packagenames_for_keyfile "/etc/pki/rpm-gpg/#{new_resource.key}"); do
+ if [[ $pkgname ]] && ! rpm -q $pkgname ; then
+ exit 1;
+ fi;
+ done
+
+ exit 0
+ EOH
+ end
+
+ #download the file if necessary
+ if new_resource.url
+ remote_file "/etc/pki/rpm-gpg/#{new_resource.key}" do
+ source new_resource.url
+ mode "0644"
+ notifies :run, resources(:execute => "rpm --import /etc/pki/rpm-gpg/#{new_resource.key}"), :immediately
+ end
+ end
+
+ end
+end
+
+action :remove do
+ if ::File.exists?("/etc/pki/rpm-gpg/#{new_resource.key}")
+ Chef::Log.info "Removing #{new_resource.key} key from /etc/pki/rpm-gpg/"
+ file "/etc/pki/rpm-gpg/#{new_resource.key}" do
+ action :delete
+ end
+ new_resource.updated_by_last_action(true)
+ end
+end
Oops, something went wrong.

0 comments on commit 6757c97

Please sign in to comment.