forked from utlib/chef-islandora
-
Notifications
You must be signed in to change notification settings - Fork 11
/
frontend-custom.rb
239 lines (207 loc) · 8.13 KB
/
frontend-custom.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
#
# Cookbook Name:: islandora
# Recipe:: frontend-custom
#
# Copyright 2014, University of Toronto Libraries, Ryerson University Library and Archives
#
# 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.
#
# install uploadprogress PHP extension with PEAR/PECL
php_pear "uploadprogress" do
action :install
end
# get jwplayer from jwplayer
ark 'jwplayer' do
url "https://account.jwplayer.com/static/download/jwplayer-#{node['jwplayer']['version']}.zip"
checksum node['jwplayer']['sha256']
path "#{node['drupal']['dir']}/sites/all/libraries"
action :put
end
# get video.js from videojs
ark 'videojs' do
url "http://www.videojs.com/downloads/video-js-#{node['videojs']['version']}.zip"
checksum node['videojs']['sha256']
path "#{node['drupal']['dir']}/sites/all/libraries"
action :put
end
# get FITS from Harvard
ark 'fits' do
url "http://projects.iq.harvard.edu/files/fits/files/fits-#{node[:fits][:version]}.zip"
version node['fits']['version']
checksum node['fits']['sha256']
home_dir node['fits']['installpath']
end
# make FITS executable
file "/usr/share/fits/fits.sh" do
mode "0755"
action :touch
end
# download openseadragon javascript
ark 'openseadragon_js' do
url "http://openseadragon.github.io/releases/openseadragon-bin-0.9.129.zip"
checksum node['openseadragon_js']['sha256']
path "#{node['drupal']['dir']}/sites/all/libraries/openseadragon"
action :put
end
# Download files required for funky library dependencies from github
node['islandora']['supp_downloads_libraries'].each do |resource|
# create the directory
directory "#{node['drupal']['dir']}/sites/all/libraries/#{resource['dirname']}" do
action :create
recursive true
user node['drupal']['system']['user']
group node['drupal']['system']['group']
end
# download from github
git "#{node['drupal']['dir']}/sites/all/libraries/#{resource['dirname']}" do
repository "#{resource['repo']}"
action :checkout
user node['drupal']['system']['user']
group node['drupal']['system']['group']
end
end
# Install Islandora modules with funky dependencies
node['islandora']['funkymodules'].each do |funkymodule|
# Checkout git repositories as Drupal modules
git "#{node['drupal']['dir']}/sites/all/modules/#{funkymodule}" do
repository "git://github.com/Islandora/#{funkymodule}.git"
action :checkout
branch node['islandora']['version']
user node['drupal']['system']['user']
group node['drupal']['system']['group']
end
# Use Drush to install downloaded modules
drupal_module funkymodule do
dir node['drupal']['dir']
action :install
end
end
# Enable some modules that were installed above
node['islandora']['modulesToEnable'].each do |enableMod|
drupal_module enableMod do
dir node['drupal']['dir']
action :enable
end
end
# Install Additional Functionality modules
node['islandora']['additionalFunctionalityModules'].each do |afmodule|
# Checkout git repositories as Drupal modules
git "#{node['drupal']['dir']}/sites/all/modules/#{afmodule['dirname']}" do
repository afmodule['repo']
action :checkout
branch afmodule['branch']
user node['drupal']['system']['user']
group node['drupal']['system']['group']
end
# Use Drush to install downloaded modules
drupal_module afmodule['dirname'] do
dir node['drupal']['dir']
action :install
end
end
# use Drush to set Islandora default parameters
node['islandora']['default_params'].each do |param|
drupal_module param['name'] do
dir node['drupal']['dir']
action param['action'].to_sym
variable param['variable']
value param['value']
end
end
#WARC tools
# install packages essential for WARC tools
execute "apt-get install" do
environment ({'DEBIAN_FRONTEND' => 'noninteractive'})
command "apt-get install python-setuptools python-unittest2 -y --force-yes"
ignore_failure false
end
# download WARC tools from github
git "/home/vagrant/warctools" do
repository "https://github.com/internetarchive/warctools.git"
action :checkout
user 'vagrant'
group 'vagrant'
end
# run make commands on WARC tools
execute "warc build" do
environment ({'DEBIAN_FRONTEND' => 'noninteractive'})
command "cd /home/vagrant/warctools && ./setup.py build && sudo ./setup.py install"
ignore_failure false
end
# Tesseract
# install leptonica
execute "apt-get install leptonica" do
environment ({'DEBIAN_FRONTEND' => 'noninteractive'})
command "apt-get install libleptonica-dev -y --force-yes"
ignore_failure false
end
# download tesseract source
ark 'tesseract-ocr' do
url "https://tesseract-ocr.googlecode.com/files/tesseract-ocr-#{node['tesseract']['version']}.tar.gz"
version node['tesseract']['version']
checksum node['tesseract']['sha256']
home_dir node['tesseract']['installpath']
end
# run make commands on tesseract source to build it
execute "tesseract build from source" do
environment ({'DEBIAN_FRONTEND' => 'noninteractive'})
command "cd #{node['tesseract']['installpath']} && sudo ./autogen.sh && sudo ./configure && sudo make && sudo make install && sudo ldconfig"
creates "/usr/local/bin/tesseract"
ignore_failure false
end
# download tesseract language data (english)
ark 'tesseract-ocr-english-language-data' do
url "https://tesseract-ocr.googlecode.com/files/tesseract-ocr-#{node['tesseract_engdata']['version']}.eng.tar.gz"
checksum node['tesseract_engdata']['sha256']
path node['tesseract_engdata']['installpath']
strip_components 2
action :put
end
# place it in the tesseract directory
execute "move-english-language-files" do
environment ({'DEBIAN_FRONTEND' => 'noninteractive'})
command "cd #{node['tesseract_engdata']['installpath']} && sudo mv tesseract-ocr-english-language-data/* . && sudo rm -rf tesseract-ocr-english-language-data"
ignore_failure false
end
# FFmpeg
#install libfaac (this is non-free, but required for MP4 streaming derivatives)
execute "sudo sed -i '/^# deb.*multiverse/ s/^# //' /etc/apt/sources.list && sudo apt-get update && sudo apt-get install libfaac-dev -y --force-yes" do
environment ({'DEBIAN_FRONTEND' => 'noninteractive'})
ignore_failure false
end
# install requirements
execute "sudo apt-get install autoconf automake build-essential libass-dev libfreetype6-dev libgpac-dev libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libx11-dev libxext-dev libxfixes-dev pkg-config texi2html zlib1g-dev yasm libx264-dev libmp3lame-dev unzip x264 libgsm1-dev libopencore-amrnb-dev libopencore-amrwb-dev libopenjpeg-dev libschroedinger-dev libspeex-dev libvpx-dev libxvidcore-dev libdc1394-22-dev -y --force-yes" do
environment ({'DEBIAN_FRONTEND' => 'noninteractive'})
ignore_failure false
end
# download FFmpeg source
ark 'ffmpeg' do
url "http://www.ffmpeg.org/releases/ffmpeg-#{node['ffmpeg']['version']}.tar.gz"
version node['ffmpeg']['version']
checksum node['ffmpeg']['sha256']
home_dir node['ffmpeg']['install_path']
end
# run make commands on FFmpeg source to build it
execute "ffmpeg build from source" do
environment ({'DEBIAN_FRONTEND' => 'noninteractive'})
command "cd #{node['ffmpeg']['installpath']} && sudo ./configure --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libdc1394 --enable-libfaac --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid && sudo make && sudo make install && sudo ldconfig"
creates "/usr/local/bin/ffmpeg"
ignore_failure false
end
# use Drush to install Islandora solution pack objects
node['islandora']['solution_pack_objects'].each do |param|
drupal_module param do
dir node['drupal']['dir']
action :ispiro
end
end