summaryrefslogtreecommitdiff
path: root/cookbooks/gnuradio/recipes/default.rb
blob: 53ffe64b385728d76711fae634b71d5574bc8773 (plain)
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
include_recipe 'gnuradio::packages'

directory node[:workingdir] do
  owner 'vagrant'
  group 'vagrant'
  mode '0755'
  action :create
end

git 'Checkout gnuradio' do
    repository node[:repos][:gnuradio]
    reference 'master'
    action :checkout
    revision 'v3.6.5'
    destination node[:workingdir] + '/gnuradio'
    user 'vagrant'
    group 'vagrant'
end

git 'Checkout rtl-sdr' do
    repository node[:repos][:rtlsdr]
    reference 'master'
    action :checkout
    destination node[:workingdir] + '/rtl-sdr'
    user 'vagrant'
    group 'vagrant'
end

git 'Checkout gr-osmosdr' do
    repository node[:repos][:gr_osmosdr]
    reference 'master'
    action :checkout
    revision 'gr3.6'
    destination node[:workingdir] + '/gr-osmosdr'
    user 'vagrant'
    group 'vagrant'
end

git 'Checkout gqrx' do
    repository node[:repos][:gqrx]
    reference 'master'
    action :checkout
    destination node[:workingdir] + '/gqrx'
    user 'vagrant'
    group 'vagrant'
end

bash 'Compile rtl-sdr' do
    user 'vagrant'
    group 'vagrant'
    cwd node[:workingdir] + '/rtl-sdr'
    code <<-EOH
        cmake . -DINSTALL_UDEV_RULES=ON
        make clean
        make
    EOH
end

bash 'Install rtl-sdr' do
    cwd node[:workingdir] + '/rtl-sdr'
    code <<-EOH
        make install
        ldconfig
    EOH
end

bash 'Compile GNU Radio' do
    user 'vagrant'
    group 'vagrant'
    cwd node[:workingdir] + '/gnuradio'
    code <<-EOH
        export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
        mkdir build && cd build
        make clean
        cmake -DENABLE_BAD_BOOST=ON ../
        make clean
        make
    EOH
end

bash 'Install GNU Radio' do
    cwd node[:workingdir] + '/gnuradio'
    code <<-EOH
        cd build
        make install
        ldconfig
    EOH
end

bash 'Compile gr-osmosdr' do
    user 'vagrant'
    group 'vagrant'
    cwd node[:workingdir] + '/gr-osmosdr'
    code <<-EOH
        cmake .
        make clean
        make
    EOH
end

bash 'Install gr-osmosdr' do
    cwd node[:workingdir] + '/gr-osmosdr'
    code <<-EOH
        make install
        ldconfig
    EOH
end

bash 'Compile gqrx' do
    user 'vagrant'
    group 'vagrant'
    cwd node[:workingdir] + '/gqrx'
    code <<-EOH
        qmake gqrx.pro
        make
    EOH
end

bash 'Configure sound (alsa)' do
    cwd '/'
    code <<-EOH
        adduser vagrant audio
        amixer -c 0 -- sset Master playback -10dB
        amixer -c 0 -- sset Master unmute
        amixer -c 0 -- sset PCM playback -10dB
        amixer -c 0 -- sset PCM unmute
    EOH
end