Commit 825dc3fb authored by James Shubin's avatar James Shubin

Initial offering.

parents
This diff is collapsed.
Copyright (C) 2012-2013+ James Shubin
Written by James Shubin <james@shubin.ca>
This puppet module is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This puppet module is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
To install this puppet module, copy this folder to your puppet modulepath.
You can usually find out where this is by running:
$ puppet config print modulepath
on your puppetmaster. In my case, this contains the directory:
/etc/puppet/modules/
I keep all of my puppet modules in git managed directories named:
puppet-<modulename>
You must remove the 'puppet-' prefix from the directory name for it to work!
Happy hacking!
This is puppet-matlab a puppet module for matlab.
Please read the INSTALL file for instructions on getting this installed.
Look in the examples/ folder for usage. If none exist, please contribute one!
This code may be a work in progress. The interfaces may change without notice.
Patches are welcome, but please be patient. They are best received by email.
Please ping me if you have big changes in mind, before you write a giant patch.
Module specific notes:
* Octave is much easier to install, is pretty awesome and free. Try it first.
* I wrote this to help cope with the pain of installing matlab manually.
* Hosting the 4GiB+ .iso files, and sending them through puppet is VERY SLOW.
* You obviously have to provide your own matlab iso. I made mine from the dvd.
Dependencies:
* puppetlabs-stdlib (optional)
* my puppet-puppet module (optional)
Happy hacking,
James Shubin <james@shubin.ca>, https://ttboj.wordpress.com/
#
# Example usage:
#
matlab::install { 'R2011a':
iso => 'puppet://files/matlab/MATHWORKS_R2011A.iso',
licensekey => '#####-#####-#####-#####', # provide your own here
licensefile => 'puppet:///files/matlab/license.lic', # get your own!
licenseagree => true, # setting this to true 'acknowledges' their (C)
prefix => '/usr/local',
}
# Note: The large iso will cause puppet to take a while on first copy
# Matlab module by James
# Copyright (C) 2012-2013+ James Shubin
# Written by James Shubin <james@shubin.ca>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# TODO: add a matlab-$name.sh file in /etc/profile.d/ to add the matlab bin to path
class matlab::vardir { # module vardir snippet
if "${::puppet_vardirtmp}" == '' {
if "${::puppet_vardir}" == '' {
# here, we require that the puppetlabs fact exist!
fail('Fact: $puppet_vardir is missing!')
}
$tmp = sprintf("%s/tmp/", regsubst($::puppet_vardir, '\/$', ''))
# base directory where puppet modules can work and namespace in
file { "${tmp}":
ensure => directory, # make sure this is a directory
recurse => false, # don't recurse into directory
purge => true, # purge all unmanaged files
force => true, # also purge subdirs and links
owner => root,
group => nobody,
mode => 600,
backup => false, # don't backup to filebucket
#before => File["${module_vardir}"], # redundant
#require => Package['puppet'], # no puppet module seen
}
} else {
$tmp = sprintf("%s/", regsubst($::puppet_vardirtmp, '\/$', ''))
}
$module_vardir = sprintf("%s/matlab/", regsubst($tmp, '\/$', ''))
file { "${module_vardir}": # /var/lib/puppet/tmp/matlab/
ensure => directory, # make sure this is a directory
recurse => true, # recursively manage directory
purge => true, # purge all unmanaged files
force => true, # also purge subdirs and links
owner => root, group => nobody, mode => 600, backup => false,
require => File["${tmp}"], # File['/var/lib/puppet/tmp/']
}
}
class matlab() {
# dependencies for matlab to work
package {['libXp', 'libXt', 'libXpm', 'libXmu']:
ensure => present,
}
}
define matlab::install( # $namevar matlab release version
$iso, # matlab iso for installation
$licensekey, # format: #####-#####-#####-#####
$licensefile, # license.lic as provided by mathworks
$licenseagree = false, # do you agree to license, true/false ?
$prefix = '/usr/local' # install prefix
) {
include 'matlab'
include matlab::vardir
#$vardir = $::matlab::vardir::module_vardir # with trailing slash
$vardir = regsubst($::matlab::vardir::module_vardir, '\/$', '')
$install_destination = "${prefix}/MATLAB/${name}"
# does user accept license ?
$agree = $licenseagree ? {
true => 'yes',
default => 'no',
}
# make folder to mount on
file { "/mnt/matlab-${name}":
ensure => directory, # make sure this is a directory
recurse => false, # don't manage directory
purge => false, # don't purge unmanaged files
force => false, # don't purge subdirs and links
owner => root,
group => root,
mode => 555, # default for iso mounts
backup => false, # don't backup to filebucket
}
# get iso to mount
# TODO: since there seem to be different iso's for each version, maybe
# we should add a unique identifier based on the $iso variable here.
file { "${vardir}/MATHWORKS-${name}.iso":
source => "${iso}",
owner => root,
group => nobody,
mode => 600, # u=rw,go=
backup => false, # don't backup to filebucket!
ensure => present,
alias => "matlab_iso.${name}",
require => File["/mnt/matlab-${name}"],
}
# mount!
# TODO: replace this mount with an exec that has an:
# onlyif => the_binary_is_not_installed so that a normal machine
# doesn't need to have the iso mounted all the time...
mount { "/mnt/matlab-${name}":
atboot => true,
ensure => mounted,
device => "${vardir}/MATHWORKS-${name}.iso",
fstype => 'iso9660',
options => 'loop,ro',
dump => '0', # fs_freq: 0 to skip file system dumps
pass => '0', # fs_passno: 0 to skip fsck on boot
alias => "matlab_mount.${name}",
require => [File["matlab_iso.${name}"]],
}
# build installer parameters file in our scratch directory
file { "${vardir}/installer_input.txt.${name}":
content => template('matlab/installer_input.txt.erb'),
owner => root,
group => nobody,
mode => 600, # u=rw,go=r
require => Mount["matlab_mount.${name}"],
ensure => present,
alias => "matlab_input.{$name}",
}
# install matlab
exec { "/mnt/matlab-${name}/install -inputFile ${vardir}/installer_input.txt.${name}":
logoutput => on_failure,
creates => "${install_destination}", # when this folder appears, we assume it got installed
require => File["matlab_input.{$name}"],
alias => "matlab_install.${name}",
}
# create 'licenses' directory
file { "${install_destination}/licenses/":
ensure => directory, # make sure this is a directory
recurse => true, # recursively manage directory
purge => true, # purge all unmanaged files
force => true, # also purge subdirs and links
owner => root,
group => root,
mode => 644,
backup => false, # don't backup to filebucket
require => Exec["matlab_install.${name}"],
}
# copy over license file to activate
file { "${install_destination}/licenses/license.lic":
source => "${licensefile}",
owner => root,
group => nobody,
# TODO: is there a worry that someone will steal the license ?
mode => 644, # u=rw,g=r,o=r
ensure => present,
require => File["${install_destination}/licenses/"],
}
}
##################################################################
##
## Use this file to specify parameters required by the installer at runtime.
##
## Instructions for using this file.
##
## 1. Create a copy of this template file and fill in the required
## information. Uncomment and set desired values; all available values
## are listed below.
##
## 2. Launch the installer from the command line, using the -inputFile option
## to specify the name of your installer initialization file.
##
## (Windows) setup.exe -inputFile <file_name>
## (Mac/Unix) install -inputFile <file_name>
##
## NOTE: If you want to run the activation application in silent
## mode immediately after the installer completes, you must create
## an activation initialization file and specify its name as the
## value of the activationPropertiesFile= option. You can also
## pass the name of the activation initialization file to the
## installer using the -activationPropertiesFile command line
## option.
##
##################################################################
##
##
## SPECIFY INSTALLATION FOLDER
##
## Example:
## (Windows) destinationFolder=C:\Program Files\MATLAB\Rxxxx
## (Unix) destinationFolder=/usr/local/Rxxxx
## (Mac) destinationFolder=/Applications
##
destinationFolder=<%=install_destination %>
##
## SPECIFY FILE INSTALLATION KEY
##
## Example: fileInstallationKey=xxxxx-xxxxx-xxxxx-xxxxx.....
fileInstallationKey=<%= licensekey %>
##
## ACCEPT LICENSE AGREEMENT
##
## You must agree to the license agreement to install MathWorks products.
## The license agreement can be found in the license.txt file at the
## root level of the installation DVD.
##
## Example: agreeToLicense=yes
agreeToLicense=<%= agree %>
##
## SPECIFY OUTPUT LOG
##
## Specify full path of file into which you want the results of the
## installation to be recorded.
##
## Example:
## (Windows) outputFile=C:\TEMP\mathworks_<user_name>.log
## (Unix/Mac) outputFile=/tmp/mathworks_<user_name>.log
# outputFile=
## SPECIFY INSTALLER MODE
##
## interactive: Run the installer GUI, waiting for user input on all dialog boxes.
##
## silent: Run the installer without displaying the GUI.
##
## automated: Run the installer GUI, displaying all dialog boxes, but only
## waiting for user input on dialogs that are missing required input.
##
## Set to interactive, silent, or automated.
mode=silent
## SPECIFY LENGTH OF TIME DIALOG BOXES ARE DISPLAYED
##
##Specify how long the installer dialog boxes are displayed, in milliseconds.
##
##NOTE: Use this value only if you set the installer mode to automated.
##
## By default, the dialog boxes display on the screen for one second.
##
##Example: (To specify a value of 1 second.) automatedModeTimeout=1000
# automatedModeTimeout=
## SPECIFY ACTIVATION PROPERTIES FILE (For non-network license types only)
##
## Enter the path to an existing file that contains properties to configure
## the activation process.
# activationPropertiesFile=
########## Begin: Options for Network License Types #########
##
## SPECIFY PATH TO LICENSE FILE (Required for network license types only)
##
## This value is required when installing either the License Manager or when
## installing as a Network End-User
## Example:
## (Windows) licensePath=C:\TEMP\license.dat
## (Unix) licensePath=/tmp/license.dat
# licensePath=
## CHOOSE TO INSTALL LICENSE MANAGER (For network license types only)
##
## Installs license manager files to disk.
##
## NOTE: You only need to install the license manager files
## on your license server.
##
## Set to true or false.
# lmgrFiles=
## INSTALL LICENSE MANAGER AS A SERVICE (For network license types only)
##
## Configure the license manager as a service on Windows.
##
## NOTE: Not applicable for Unix or Mac.
##
## NOTE: The lmgr_files option (set in previous step) must also be set to true.
##
## Set to true or false.
# lmgrService=
########## End: Options for Network License Types #########
################# Begin - Windows Only Options ################
##
## CHOOSE TO CREATE WINDOWS DESKTOP SHORTCUT
##
## Set to true if you would like the installer to create a desktop shortcut icon
## when MATLAB is installed or false if you don't want the shortcut created.
## Set to true or false.
# desktopShortcut=
## CHOOSE TO ADD SHORTCUT TO WINDOWS START MENU
##
## Set to true if you would like the installer to create a Start Menu shortcut
## icon when MATLAB is installed or false if you don't want the shortcut created.
## Set to true or false.
# startMenuShortcut=
################ End - Windows Only Options ################
## SPECIFY PRODUCTS YOU WANT TO INSTALL
##
## By default, the installer installs all the products and
## documentation for which you are licensed. Products you are not licensed for
## are not installed, even if they are listed here.
##
## To install specific products, uncomment the line for the product(s) you want
## to install.
#product.Aerospace_Blockset
#product.Aerospace_Toolbox
#product.Bioinformatics_Toolbox
#product.Communications_System_Toolbox
#product.Computer_Vision_System_Toolbox
#product.Control_System_Toolbox
#product.Curve_Fitting_Toolbox
#product.DO_Qualification_Kit
#product.DSP_System_Toolbox
#product.Data_Acquisition_Toolbox
#product.Database_Toolbox
#product.Datafeed_Toolbox
#product.EDA_Simulator_Link
#product.Econometrics_Toolbox
#product.Embedded_Coder
#product.Filter_Design_HDL_Coder
#product.Financial_Derivatives_Toolbox
#product.Financial_Toolbox
#product.Fixed_Income_Toolbox
#product.Fixed_Point_Toolbox
#product.Fuzzy_Logic_Toolbox
#product.Gauges_Blockset
#product.Global_Optimization_Toolbox
#product.IEC_Certification_Kit
#product.Image_Acquisition_Toolbox
#product.Image_Processing_Toolbox
#product.Instrument_Control_Toolbox
#product.MATLAB
#product.MATLAB_Builder_EX
#product.MATLAB_Builder_JA
#product.MATLAB_Builder_NE
#product.MATLAB_Coder
#product.MATLAB_Compiler
#product.MATLAB_Distributed_Computing_Server
#product.MATLAB_Report_Generator
#product.Mapping_Toolbox
#product.Model_Predictive_Control_Toolbox
#product.Model_Based_Calibration_Toolbox
#product.Neural_Network_Toolbox
#product.OPC_Toolbox
#product.Optimization_Toolbox
#product.Parallel_Computing_Toolbox
#product.Partial_Differential_Equation_Toolbox
#product.Phased_Array_System_Toolbox
#product.RF_Toolbox
#product.Real_Time_Windows_Target
#product.Robust_Control_Toolbox
#product.Signal_Processing_Toolbox
#product.SimBiology
#product.SimDriveline
#product.SimElectronics
#product.SimEvents
#product.SimHydraulics
#product.SimMechanics
#product.SimPowerSystems
#product.SimRF
#product.Simscape
#product.Simulink
#product.Simulink_3D_Animation
#product.Simulink_Coder
#product.Simulink_Control_Design
#product.Simulink_Design_Optimization
#product.Simulink_Design_Verifier
#product.Simulink_Fixed_Point
#product.Simulink_HDL_Coder
#product.Simulink_PLC_Coder
#product.Simulink_Report_Generator
#product.Simulink_Verification_and_Validation
#product.Spreadsheet_Link_EX
#product.Stateflow
#product.Statistics_Toolbox
#product.Symbolic_Math_Toolbox
#product.System_Identification_Toolbox
#product.SystemTest
#product.Vehicle_Network_Toolbox
#product.Wavelet_Toolbox
#product.xPC_Target
#product.xPC_Target_Embedded_Option
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment