From 62d1e908c6d2102bb9aef6d73e9051f5e4d3f06d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20M=E4kinen?= Date: Thu, 12 Jan 2012 12:43:54 +0200 Subject: [PATCH] Changed arduino to use new Makefile system. --- arduino/Makefile | 34 ++++++++++++++++++++++------------ arduino/manifests/init.pp | 23 ++++++++++++++++++----- 2 files changed, 40 insertions(+), 17 deletions(-) diff --git a/arduino/Makefile b/arduino/Makefile index 73885e8..489b33e 100644 --- a/arduino/Makefile +++ b/arduino/Makefile @@ -1,16 +1,26 @@ -VERSION = 0022 -BASEURL = http://arduino.googlecode.com/files/ -OUT = /srv/puppet/files/common/packages +include $(CURDIR)/../Makefile.inc -all: $(OUT)/arduino32.tgz $(OUT)/arduino64.tgz +VERSION = 1.0 -$(OUT)/arduino32.tgz: - @umask 022 - cd $(OUT) && wget -nv -N $(BASEURL)/arduino-$(VERSION).tgz && \ - ln -sf arduino-$(VERSION).tgz arduino32.tgz +TARGET32 = arduino32-$(VERSION).tgz +SOURCE32 = http://arduino.googlecode.com/files/arduino-$(VERSION)-linux.tgz +TARGET64 = arduino64-$(VERSION).tgz +SOURCE64 = http://arduino.googlecode.com/files/arduino-$(VERSION)-linux64.tgz -$(OUT)/arduino64.tgz: - @umask 022 - cd $(OUT) && wget -nv -N $(BASEURL)/arduino-$(VERSION)-64-2.tgz && \ - ln -sf arduino-$(VERSION)-64-2.tgz arduino64.tgz +all: download manifest +download: $(PACKAGES)/$(TARGET32) $(PACKAGES)/$(TARGET64) +manifest: $(MANIFESTS)/arduino.pp + +$(PACKAGES)/$(TARGET32): + @umask 022; echo $@; \ + test -f $@ || curl -o $@ $(SOURCE32) + +$(PACKAGES)/$(TARGET64): + @umask 022; echo $@; \ + test -f $@ || curl -o $@ $(SOURCE64) + +$(MANIFESTS)/arduino.pp: $(PACKAGES)/$(TARGET32) $(PACKAGES)/$(TARGET64) + @umask 022; echo $@; \ + echo '$$arduino32_package_latest = "$(TARGET32)"' > $@ && \ + echo '$$arduino64_package_latest = "$(TARGET64)"' >> $@ diff --git a/arduino/manifests/init.pp b/arduino/manifests/init.pp index fd4a2fc..e8c41c3 100644 --- a/arduino/manifests/init.pp +++ b/arduino/manifests/init.pp @@ -12,15 +12,28 @@ class arduino { before => File["/usr/local/bin/arduino"], } - case $architecture { - "x86_64": { $bits = "64" } - default: { $bits = "32" } + if !$arduino_package { + case $architecture { + "x86_64": { + if $arduino64_package_latest { + $arduino_package = $arduino64_package_latest + } else { + fail("Must define \$arduino_package or \$arduino64_package_latest") + } + } + default: { + if $arduino32_package_latest { + $arduino_package = $arduino32_package_latest + } else { + fail("Must define \$arduino_package or \$arduino32_package_latest") + } + } + } } file { "/usr/local/src/arduino.tgz": ensure => present, - source => "puppet:///files/packages/arduino${bits}.tgz", - links => follow, + source => "puppet:///files/packages/${arduino_package}", mode => 0644, owner => "root", group => "root",