|
1 | 1 | # |
2 | 2 | # Author:: Nathan L Smith ([email protected]) |
| 3 | +# Author:: Marius Ducea ([email protected]) |
3 | 4 | # Cookbook Name:: nodejs |
4 | 5 | # Recipe:: package |
5 | 6 | # |
6 | 7 | # Copyright 2012, Cramer Development, Inc. |
| 8 | +# Copyright 2013, Opscale |
7 | 9 | # |
8 | 10 | # Licensed under the Apache License, Version 2.0 (the "License"); |
9 | 11 | # you may not use this file except in compliance with the License. |
|
19 | 21 | # |
20 | 22 |
|
21 | 23 | case node['platform_family'] |
22 | | - when 'rhel', 'fedora' |
23 | | - file = '/usr/local/src/nodejs-stable-release.noarch.rpm' |
24 | | - |
25 | | - remote_file file do |
26 | | - source 'http://nodejs.tchol.org/repocfg/el/nodejs-stable-release.noarch.rpm' |
27 | | - action :create_if_missing |
28 | | - end |
29 | | - |
30 | | - yum_package 'nodejs-stable-release' do |
31 | | - source file |
32 | | - options '--nogpgcheck' |
33 | | - end |
34 | | - |
35 | | - %w{ nodejs nodejs-compat-symlinks npm }.each do |pkg| |
36 | | - package pkg |
37 | | - end |
38 | 24 | when 'debian' |
| 25 | + if node['nodejs']['legacy_packages'] == true |
| 26 | + repo = 'http://ppa.launchpad.net/chris-lea/node.js-legacy/ubuntu' |
| 27 | + packages = %w{ nodejs npm } |
| 28 | + else |
| 29 | + repo = 'http://ppa.launchpad.net/chris-lea/node.js/ubuntu' |
| 30 | + packages = %w{ nodejs } |
| 31 | + end |
39 | 32 | apt_repository 'node.js' do |
40 | | - uri 'http://ppa.launchpad.net/chris-lea/node.js/ubuntu' |
| 33 | + uri repo |
41 | 34 | distribution node['lsb']['codename'] |
42 | 35 | components ['main'] |
43 | 36 | keyserver "keyserver.ubuntu.com" |
44 | 37 | key "C7917B12" |
45 | 38 | action :add |
46 | 39 | end |
47 | | - |
48 | | - %w{ nodejs npm }.each do |pkg| |
49 | | - package pkg |
50 | | - end |
51 | 40 | when 'smartos' |
52 | | - %w{ nodejs }.each do |pkg| |
53 | | - package pkg |
54 | | - end |
| 41 | + packages = %w{ nodejs } |
55 | 42 | else |
56 | | - include_recipe "nodejs::install_from_source" |
| 43 | + Chef::Log.error "There are no nodejs packages for this platform; please use the source or binary method to install node" |
| 44 | + return |
| 45 | +end |
| 46 | + |
| 47 | +packages.each do |node_pkg| |
| 48 | + package node_pkg |
57 | 49 | end |
0 commit comments