Defined Type: ohmyzsh::profile
- Defined in:
- manifests/profile.pp
Overview
Define: ohmyzsh::profile
This is the ohmyzsh module. It creates a profile directory under user home and allows custom scripts to setup and made avalible on the path.
This module is called ohmyzsh as Puppet does not support hyphens in module names.
oh-my-zsh is a community-driven framework for managing your zsh configuration.
Parameters
scripts: (array) An array of paths to all the scripts
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'manifests/profile.pp', line 15
define ohmyzsh::profile (
Hash $scripts = {},
) {
include ohmyzsh
if $name == 'root' {
$home = '/root'
$group = fact('os.family') ? {
/(Free|Open)BSD/ => 'wheel',
default => 'root',
}
} else {
$home = "${ohmyzsh::home}/${name}"
$group = $name
}
$shell_resource_path = "${home}/.zshrc"
file { "${home}/profile":
ensure => directory,
group => $group,
owner => $name,
require => User[$name],
}
-> file_line { "${home}-profile":
ensure => present,
line => 'for f in ~/profile/*; do source "$f"; done',
match => 'for f in ~/profile/*; do source "$f"; done',
path => $shell_resource_path,
require => [
User[$name],
Ohmyzsh::Install[$name],
],
}
$scripts.each |$script_name, $script_path| {
file { "${home}/profile/${script_name}":
ensure => file,
owner => $name,
group => $group,
mode => '0744',
source => $script_path,
require => File["${home}/profile"],
}
}
}
|