Subversion Repositories camp_sysinfo_client_3

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
129 rodolico 1
#! /usr/bin/env perl
2
 
3
# This file will contain information for a specific installer
4
# this allows the installer to be used on different programs.
5
 
6
# defines a basic install. Values are overridden depending on operating
7
# system as defined by %operatingSystems
8
our %install = (  'bindir' => '/opt/camp/sysinfo-client',
9
                 'confdir' => '/etc/camp/sysinfo-client',
10
                 'application name' => 'sysinfo client',
11
                 'default group' => 'root',
12
                 'default owner' => 'root',
13
                 'default permission' => '0700',
14
                 'configuration seed file' => '<installdir>/sysinfo-client.seed.yaml',
15
                 'configuration' => {
16
                          'configurator' => '<bindir>/configure.pl',
17
                          'configuration file' => '<confdir>/sysinfo-client.yaml',
18
                          'old configuration file' => '<confdir>/sysinfo-client.conf',
19
                          'permission' => '700',
20
                          'owner'      => '<default owner>',
21
                          'target'     => '<confdir>'
22
                            },
23
                 'files' => {
24
                           'configure.pl' => { 
25
                                 'type' => 'file',
26
                                 'permission' => '700', 
27
                                 'owner' => '<default owner>:<default group>', 
28
                                 'target' =>  '<bindir>'
29
                              },
30
                           'sysinfo-client' => { 
31
                                 'type' => 'file',
32
                                 'permission' => '700',
33
                                 'owner' => '<default owner>:<default group>',
34
                                 'target' =>  '<bindir>'
35
                              },
36
                           'sysinfoconf.pm' => {
37
                                 'type' => 'file',
38
                                 'permission' => '600',
39
                                 'owner' => '<default owner>:<default group>',
40
                                 'target' =>  '<bindir>'
41
                              },
42
                           'notes' => { 
43
                                 'type' => 'file',
44
                                 'permission' => '600', 
45
                                 'owner' => '<default owner>:<default group>', 
46
                                 'target' =>  '<bindir>'
47
                              },
48
                           'sysinfo-client.conf.template.yaml' => { 
49
                                 'type' => 'file',
50
                                 'permission' => '600', 
51
                                 'owner' => '<default owner>:<default group>', 
52
                                 'target' =>  '<bindir>' 
53
                              },
54
                           'getSendEmail.pl' => { 
55
                                 'type' => 'file',
56
                                 'permission' => '700', 
57
                                 'owner' => '<default owner>:<default group>', 
58
                                 'target' =>  '<bindir>' 
59
                              },
60
                           'install.pl' => {
61
                                 'type' => 'file',
62
                                 'permission' => '700', 
63
                                 'owner' => '<default owner>:<default group>', 
64
                                 'target' =>  '<bindir>' 
65
                              },
66
                           'sysinfo-client.seed.example.yaml' => { 
67
                                 'type' => 'file',
68
                                 'permission' => '600', 
69
                                 'owner' => '<default owner>:<default group>', 
70
                                 'target' =>  '<bindir>' 
71
                              },
72
                           'VERSION' => { 
73
                                 'type' => 'file',
74
                                 'permission' => '600', 
75
                                 'owner' => '<default owner>:<default group>', 
76
                                 'target' =>  '<bindir>' 
77
                              },
78
                              'modules' => {
79
                                 'type' => 'directory',
80
                                 'permission' => '700', 
81
                                 'owner' => '<default owner>:<default group>', 
82
                                 'target' =>  '<bindir>',
83
                                 'action' => 'chmod 700 *'
84
                              },
85
                              'scripts' => {
86
                                 'type' => 'directory',
87
                                 'permission' => '700', 
88
                                 'owner' => '<default owner>:<default group>', 
89
                                 'target' =>  '<bindir>',
90
                                 'action' => 'chmod 700 *'
91
                              },
92
                     }
93
                  );
94
 
95
# hash to set up os specific rules. these override values in %install when a particular operating
96
# system is detected.
97
our %operatingSystems = (
98
                  'debian' => {
99
                     'regex'  => '(debian|mx|devuan)',
100
                     'bindir' => '/opt/camp/sysinfo-client',
101
                     'confdir' => '/etc/camp/sysinfo-client',
132 rodolico 102
                     'crontab' => 'ln -fs <bindir>/sysinfo-client /etc/cron.daily/sysinfo-client',
129 rodolico 103
                     'modules' => '((linux)|(dpkg)|(unix)|(all))',
104
                  },
105
                  'ipfire' => {
106
                     'regex'  => 'ipfire',
107
                     'bindir' => '/opt/camp/sysinfo-client',
108
                     'confdir' => '/etc/camp/sysinfo-client',
109
                     'crontab' => 'ln -s <bindir>/sysinfo-client /etc/fcron.daily/sysinfo-client.fcron',
110
                     'modules' => '((ipfire)|(unix)|(all))',
111
                  },
112
                  'freebsd' => {
113
                     'regex' => 'freebsd',
114
                     'bindir' => '/usr/local/opt/camp/sysinfo-client',
115
                     'confdir' => '/usr/local/etc/camp/sysinfo-client',
116
                     'crontab' => 'ln -s <bindir>/sysinfo-client /etc/periodic/daily/sysinfo-client',
117
                     'modules' => '((bsd)|(unix)|(all))',
118
                    'default group' => 'wheel',
119
                    'default owner' => 'root',
120
                  },
121
                  'opnsense' => {
122
                     'fileexists' => '/conf/config.xml',
123
                     'bindir' => '/usr/local/opt/camp/sysinfo-client',
124
                     'confdir' => '/usr/local/etc/camp/sysinfo-client',
125
                     'crontab' => 'ln -s <bindir>/sysinfo-client /etc/periodic/daily/sysinfo-client',
126
                     'modules' => '((bsd)|(unix)|(all))',
127
                    'default group' => 'wheel',
128
                    'default owner' => 'root',
129
                    'files' => {
130
                              'YAML' => { 
131
                                    'type' => 'directory',
132
                                    'permission' => '777', 
133
                                    'owner' => '<default owner>:<default group>', 
134
                                    'target' =>  '<bindir>'
135
                                 },
136
                              'Tiny.pm' => { 
137
                                    'type' => 'file',
138
                                    'permission' => '444',
139
                                    'owner' => '<default owner>:<default group>',
140
                                    'target' =>  '<bindir>/YAML'
141
                                 },
142
                              'actions_sysinfo.conf' => {
143
                                    'type' => 'file',
144
                                    'permission' => '755',
145
                                    'owner' => '<default owner>:<default group>',
146
                                    'target' => '/usr/local/opnsense/service/conf/actions.d',
147
                                    'post action' => 'service configd restart',
148
                                    'message' => 'No automatic run can be done. Please log in through the webui and enable the sysinfo cron job'
149
                                 },
150
                              },
151
                 },
152
 
153
                );
154
 
155
# list of libraries used by the system. We will offer to install them if
156
# we know how. NOTE: I have chosen to put the full installation command
157
# for each library. This allows us to use the package selector OR a different
158
# piece of code on a per-library basis, but results in something like
159
#      apt-get -y install perl-modules
160
#      apt-get -y install libwww-perl
161
# instead of
162
#      apt-get -y install libwww-perl perl-modules
163
# flexibility vs efficiency in this case.
164
our %libraries = ( 
165
                  'File::Basename' => { 'debian' => 'apt-get -y install perl-modules' },
166
                  'Exporter' => { 'debian' => 'apt-get -y install perl-base' },
167
                  'LWP' => { 
168
                             'debian' => 'apt-get -y install libwww-perl',
169
                             'freebsd' => 'pkg install -y p5-libwww'
170
                           },
171
                  'YAML::Tiny' => {
172
                              'debian' => 'apt-get -y install libyaml-tiny-perl',
173
                              'freebsd' => 'echo y | pkg install p5-YAML-Tiny',
174
                              'opnsense' => 'gunzip Tiny.pm.gz ; mkdir YAML ; mv Tiny.pm YAML',
175
                              'ipfire' => 'gunzip Tiny.pm.gz ; mkdir YAML ; mv Tiny.pm YAML'
176
                           }
177
                );
178
 
179
our %binaries = (
180
                   'dmidecode' => {
181
                                    'debian' => 'apt-get -y install dmidecode',
182
                                    'freebsd' => 'pkg install -y dmidecode'
183
                                  }
184
               );