Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated and fixed a few issues. #10

Open
wants to merge 18 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
ca840dc
- Updated .gitignore to stop Netbeans project folder from being added.
jtrobinson3 Oct 28, 2014
eabc8bd
Changed install URL to the git repository (fixes #9).
jtrobinson3 Oct 28, 2014
37fc2c1
Added check for "fuse-utils" package with fallback to fuse for newer …
jtrobinson3 Oct 28, 2014
01d2025
Altered install URI to use SSL (HTTPS).
jtrobinson3 Oct 29, 2014
3db2ab6
Updated s3fs-fuse version to current latest (previous version did not…
jtrobinson3 Oct 29, 2014
d9f3fc8
Fixed moving into wrong directory during install.
jtrobinson3 Oct 29, 2014
91cb3f7
Added mkdir for missing directory.
jtrobinson3 Oct 29, 2014
cc2396c
Added ./autogen.sh command per the install directions.
jtrobinson3 Oct 29, 2014
ba80294
Removed "sudo" and added output to /dev/null for package existence ch…
jtrobinson3 Oct 29, 2014
254cf96
Fixed typo in README: '-' should be '_".
jtrobinson3 Oct 29, 2014
5cec860
Fixed incorrect attribute index (causing error).
jtrobinson3 Oct 29, 2014
64d796f
Added type check (causing error with boolean value).
jtrobinson3 Oct 29, 2014
203580f
Added Berksfile with dependencies to work with newer versions of Book…
jtrobinson3 Oct 29, 2014
3c35fb4
Added metadata to Berksfile
jtrobinson3 Oct 29, 2014
59582cb
Changed "suggests" to "depends" - "suggests" not officially supported.
jtrobinson3 Oct 29, 2014
63544bb
Fixed sending output to /dev/null.
jtrobinson3 Oct 31, 2014
232ac4d
Separated install from mount process and added checks to prevent inst…
jtrobinson3 Nov 2, 2014
33c7481
Switched to using template instead of block.
jtrobinson3 Nov 2, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.kitchen/
.kitchen.local.yml
/nbproject/
6 changes: 6 additions & 0 deletions Berksfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source "https://supermarket.getchef.com"

metadata

cookbook 'rc_mon'
cookbook 'bluepill'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Usage

```ruby
override_attributes(
's3fs-fuse' => {
's3fs_fuse' => {
:s3_key => 'key',
:s3_secret => 'secret',
:mounts => [
Expand Down
4 changes: 3 additions & 1 deletion attributes/default.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
default[:s3fs_fuse][:s3_url] = 'https://s3.amazonaws.com'
default[:s3fs_fuse][:s3_key] = ''
default[:s3fs_fuse][:s3_secret] = ''
default[:s3fs_fuse][:version] = '1.61'
default[:s3fs_fuse][:version] = '1.78'
default[:s3fs_fuse][:no_upload] = false
default[:s3fs_fuse][:mounts] = []
default[:s3fs_fuse][:bluepill] = false
default[:s3fs_fuse][:rc_mon] = false
default[:s3fs_fuse][:maxmemory] = 100
default[:s3fs_fuse][:fuse_mirror] = 'voxel'
default[:s3fs_fuse][:packages] = []
default[:s3fs_fuse][:force_install] = false
default[:s3fs_fuse][:version_file] = '/etc/s3fs_fuse_version'
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "0.1.4"

suggests 'bluepill'
depends 'bluepill'
depends 'rc_mon'
33 changes: 32 additions & 1 deletion recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,38 @@
end
end

include_recipe "s3fs-fuse::install"
def s3fs_fuse_installed()

# Is s3fs installed?
if !`which s3fs`.empty? && $? == 0
return true # No
end

return false # Yes
end

def s3fs_fuse_diff_version( check_against )

if !s3fs_fuse_installed()
return true
end

if File.exists?( node[:s3fs_fuse][:version_file] )
installed_version = File.open( node[:s3fs_fuse][:version_file], &:gets )
if installed_version.empty? || installed_version != check_against
# Not properly installed by this script or version is different
return true
end
end

# s3fs is installed and is the correct version
return false
end

# Should I run install?
if node[:s3fs_fuse][:force_install] || s3fs_fuse_diff_version( node[:s3fs_fuse][:version] )
include_recipe "s3fs-fuse::install"
end

if(node[:s3fs_fuse][:bluepill])
include_recipe 's3fs-fuse::bluepill'
Expand Down
63 changes: 34 additions & 29 deletions recipes/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,30 @@
mode 0600
end

prereqs = case node.platform_family
when 'debian'
%w(
build-essential
libfuse-dev
fuse-utils
libcurl4-openssl-dev
libxml2-dev
mime-support
)
when 'rhel'
%w(
gcc
libstdc++-devel
gcc-c++
curl-devel
libxml2-devel
openssl-devel
mailcap
fuse
fuse-devel
fuse-libs
)
else
raise "Unsupported platform family provided: #{node.platform_family}"
prereqs = []

case node.platform_family
when 'debian'
prereqs.push(
'build-essential', 'libfuse-dev', 'libcurl4-openssl-dev', 'libxml2-dev',
'mime-support'
)
# As of Ubuntu 14.04 "fuse-utils" has been merged into package "fuse"
# so try to install both (auto-installed by fuse-utils in older)
%x(apt-cache show fuse-utils 2>&1 1>/dev/null)
if( $? == 0 ) then
prereqs.push( 'fuse-utils' )
else
prereqs.push( 'fuse' )
end
when 'rhel'
prereqs.push(
'gcc', 'libstdc++-devel', 'gcc-c++', 'curl-devel', 'libxml2-devel',
'libxml2-devel', 'openssl-devel', 'mailcap', 'fuse', 'fuse-devel',
'fuse-libs'
)
else
raise "Unsupported platform family provided: #{node.platform_family}"
end

prereqs = node[:s3fs_fuse][:packages] unless node[:s3fs_fuse][:packages].empty?
Expand All @@ -45,7 +44,7 @@
end

s3fs_version = node[:s3fs_fuse][:version]
source_url = "http://s3fs.googlecode.com/files/s3fs-#{s3fs_version}.tar.gz"
source_url = "https://github.com/s3fs-fuse/s3fs-fuse/archive/v#{s3fs_version}.tar.gz"

remote_file "/tmp/s3fs-#{s3fs_version}.tar.gz" do
source source_url
Expand All @@ -55,9 +54,11 @@
bash "compile_and_install_s3fs" do
cwd '/tmp'
code <<-EOH
tar -xzf s3fs-#{s3fs_version}.tar.gz
cd s3fs-#{s3fs_version}
mkdir ./s3fs-#{s3fs_version}
tar -xzf s3fs-#{s3fs_version}.tar.gz -C ./s3fs-#{s3fs_version}
cd ./s3fs-#{s3fs_version}/*
#{'export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/lib64/pkgconfig' if node.platform_family == 'rhel'}
./autogen.sh
./configure --prefix=/usr/local
make && make install
EOH
Expand All @@ -68,7 +69,7 @@
false
end
end
if(node[:s3fs_fuse][:bluepill] && File.exists?(File.join(node[:bluepill][:conf_dir], 's3fs.pill')))
if(node[:s3fs_fuse][:bluepill].kind_of?(Array) && File.exists?(File.join(node[:s3fs_fuse][:bluepill][:conf_dir], 's3fs.pill')))
notifies :stop, 'bluepill_service[s3fs]'
notifies :start, 'bluepill_service[s3fs]'
end
Expand All @@ -83,3 +84,7 @@
system('cat /boot/config-`uname -r` | grep -P "^CONFIG_FUSE_FS=y$" > /dev/null')
}
end

template node[:s3fs_fuse][:version_file] do
mode 0655
end
1 change: 1 addition & 0 deletions templates/default/s3fs_fuse_version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%= node[:s3fs_fuse][:version] %>