summaryrefslogtreecommitdiffstats
path: root/modules/package/manifests/makepkg.pp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/package/manifests/makepkg.pp')
-rw-r--r--modules/package/manifests/makepkg.pp41
1 files changed, 41 insertions, 0 deletions
diff --git a/modules/package/manifests/makepkg.pp b/modules/package/manifests/makepkg.pp
new file mode 100644
index 0000000..c9d0318
--- /dev/null
+++ b/modules/package/manifests/makepkg.pp
@@ -0,0 +1,41 @@
+define package::makepkg($ensure, $build_user, $asdeps=false) {
+ if $asdeps {
+ $extra_cmdline = " --asdeps"
+ }
+ else {
+ $extra_cmdline = ""
+ }
+
+ include c_toolchain
+ include git
+
+ case $ensure {
+ 'installed': {
+ exec { "makepkg install $name":
+ provider => "shell",
+ command => "
+ cd /tmp
+ rm -rf 'makepkg-$name'
+ su $build_user -c 'git clone https://aur.archlinux.org/$name.git makepkg-$name'
+ cd 'makepkg-$name'
+ su $build_user -c makepkg
+ pacman -U --noconfirm --needed $extra_cmdline $name-*.pkg.tar.xz
+ ",
+ unless => "pacman -Q $name > /dev/null 2>&1",
+ path => "/usr/bin",
+ require => [
+ Class["git"],
+ Class["c_toolchain"],
+ ];
+ }
+ }
+ 'absent': {
+ exec { "makepkg uninstall $name":
+ provider => "shell",
+ command => "pacman --noconfirm -Rsn $name",
+ onlyif => "pacman -Q $name > /dev/null 2>&1",
+ path => "/usr/bin";
+ }
+ }
+ }
+}