From 919d772aaa9bb6f298b1d0a433b6b32d15c0410f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Tue, 9 Aug 2016 21:36:00 +0200 Subject: Add aura helper --- modules/aur/manifests/aura.pp | 38 ++++++++++++++++++++++++++++++++++++++ modules/aur/manifests/init.pp | 4 ++++ modules/aur/manifests/install.pp | 28 ++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 modules/aur/manifests/aura.pp create mode 100644 modules/aur/manifests/init.pp create mode 100644 modules/aur/manifests/install.pp (limited to 'modules/aur') diff --git a/modules/aur/manifests/aura.pp b/modules/aur/manifests/aura.pp new file mode 100644 index 0000000..fff988b --- /dev/null +++ b/modules/aur/manifests/aura.pp @@ -0,0 +1,38 @@ +class aur::aura( +) { + user { "aur-builder": + name => "aur-builder", + system => true, + ensure => "present" + } + + exec { 'pacman-base-devel': + command => '/usr/bin/pacman -S base-devel --needed --noconfirm', + unless => '/usr/bin/pacman -Qo aura', + logoutput => 'on_failure', + } + + ensure_packages(['gmp', 'pcre', 'abs'], { 'install_options' => '--asdeps' }) + + exec { 'aur::aura': + cwd => "/tmp", + path => "/usr/bin", + command => 'curl -o /tmp/aur.sh aur.sh && chmod +x /tmp/aur.sh && /tmp/aur.sh aura-bin && mv /tmp/aura-bin/aura-bin-*-x86_64.pkg.tar.xz /tmp/aura-bin-x86_64.pkg.tar.xz && rm /tmp/aur.sh && rm -rf /tmp/aura-bin', + user => "aur-builder", + unless => '/usr/bin/pacman -Qo aura', + require => Exec['pacman-base-devel'], + logoutput => 'on_failure', + } + + package { 'aura-bin': + ensure => "present", + source => "/tmp/aura-bin-x86_64.pkg.tar.xz", + notify => Exec['aur::aura::cleanup'] + } + + exec { 'aur::aura::cleanup': + path => "/usr/bin/", + command => "rm -f /tmp/aura-bin-x86_64.pkg.tar.xz", + refreshonly => true + } +} diff --git a/modules/aur/manifests/init.pp b/modules/aur/manifests/init.pp new file mode 100644 index 0000000..cdf9929 --- /dev/null +++ b/modules/aur/manifests/init.pp @@ -0,0 +1,4 @@ +class aur { + class { 'aur::aura': } +} + diff --git a/modules/aur/manifests/install.pp b/modules/aur/manifests/install.pp new file mode 100644 index 0000000..074088e --- /dev/null +++ b/modules/aur/manifests/install.pp @@ -0,0 +1,28 @@ +define aur::install ( + $ensure = 'present', +) { + + case $ensure { + 'present': { + exec { "pacman::aur::install::${name}": + require => Class[aur::aura], + command => "/usr/bin/aura -A ${name}", + unless => "/usr/bin/aura -Qk ${name}", + logoutput => 'on_failure', + timeout => 1800, + } + } + 'absent': { + exec { "pacman::aur::remove::${name}": + require => Class[aur::aura], + command => "/usr/bin/aura -Rs ${name}", + onlyif => "/usr/bin/aura -Qi ${name}", + logoutput => 'on_failure', + } + } + default: { + fail("Pacman::Aur[${name}] ensure parameter must be either 'present' or 'absent'") + } + + } +} -- cgit v1.2.3