From 4a071406d7164729418cfbc736e1094184e1cdb7 Mon Sep 17 00:00:00 2001 From: Ossi Salmi Date: Mon, 20 Jan 2014 00:54:02 +0200 Subject: [PATCH] tmux: Make config file optional and configurable --- tmux/files/tmux.conf | 9 --------- tmux/manifests/init.pp | 34 ++++++++++++++++++++++------------ 2 files changed, 22 insertions(+), 21 deletions(-) delete mode 100644 tmux/files/tmux.conf diff --git a/tmux/files/tmux.conf b/tmux/files/tmux.conf deleted file mode 100644 index 327a50a..0000000 --- a/tmux/files/tmux.conf +++ /dev/null @@ -1,9 +0,0 @@ -set -g prefix C-a -set -g base-index 1 -set -g status off -bind C-a send-prefix -bind C-l last-window -bind C-n next-window -bind C-p previous-window -bind C-@ next-window -bind Space next-window diff --git a/tmux/manifests/init.pp b/tmux/manifests/init.pp index fdd3a89..c73c437 100644 --- a/tmux/manifests/init.pp +++ b/tmux/manifests/init.pp @@ -1,23 +1,33 @@ -# Install tmux +# Install tmux. # -class tmux { +# === Parameters +# +# $source: +# Configuration file source. None by default. +# +class tmux($source=undef) { if $::operatingsystem != "OpenBSD" { package { "tmux": ensure => installed, - before => File["/etc/tmux.conf"], + before => $source ? { + undef => undef, + default => File["/etc/tmux.conf"], + }, } } - file { "/etc/tmux.conf": - ensure => present, - mode => "0644", - owner => "root", - group => $::operatingsystem ? { - "openbsd" => "wheel", - default => "root", - }, - source => "puppet:///modules/tmux/tmux.conf", + if $source { + file { "/etc/tmux.conf": + ensure => present, + mode => "0644", + owner => "root", + group => $::operatingsystem ? { + "openbsd" => "wheel", + default => "root", + }, + source => $source, + } } }