Added support for Linux Mint

This commit is contained in:
Gene Liverman 2017-09-18 19:01:57 -07:00 committed by Gene Liverman
parent e23ea50d4b
commit b0ec3a08ba
23 changed files with 337 additions and 87 deletions

20
Gemfile
View file

@ -5,7 +5,7 @@ source 'https://rubygems.org'
if ENV.key?('PUPPET_VERSION')
puppetversion = ENV['PUPPET_VERSION'].to_s
else
puppetversion = ['>= 4.9', '< 5']
puppetversion = ['>= 5', '< 6']
end
# rubocop:enable ConditionalAssignment
@ -13,23 +13,23 @@ group :production do
gem 'os', '~> 1.0'
gem 'puppet', puppetversion
gem 'r10k', '~> 2.5'
gem 'rugged', '~> 0.24'
gem 'rugged', '~> 0.26'
gem 'xmlrpc', '~> 0.3.0' if RUBY_VERSION >= '2.3'
end
group :development, :unit_tests do
gem 'json', '>= 2.0.2'
gem 'metadata-json-lint', '~> 1.2'
gem 'puppetlabs_spec_helper', '~> 2.1'
gem 'rspec-puppet', '~> 2.5'
gem 'rubocop', '~> 0.49'
gem 'tty-command', '~> 0.4'
gem 'tty-file', '~> 0.3'
gem 'tty-prompt', '~> 0.12'
gem 'metadata-json-lint', '~> 2.0'
gem 'puppetlabs_spec_helper', '~> 2.3'
gem 'rspec-puppet', '~> 2.6'
gem 'rubocop', '~> 0.50'
gem 'tty-command', '~> 0.6'
gem 'tty-file', '~> 0.4'
gem 'tty-prompt', '~> 0.13'
gem 'yamllint', '~> 0.0.9'
# puppet-lint and plugins
gem 'puppet-lint', '~> 2.2'
gem 'puppet-lint', '~> 2.3'
gem 'puppet-lint-absolute_classname-check', '~> 0.2'
gem 'puppet-lint-absolute_template_path', '~> 1.0'
gem 'puppet-lint-empty_string-check', '~> 0.2'

View file

@ -1,66 +1,68 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (2.2.8)
CFPropertyList (2.3.5)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
ast (2.3.0)
colored (1.2)
cri (2.6.1)
colored (~> 1.2)
diff-lcs (1.3)
equatable (0.5.0)
facter (2.4.6)
facter (2.4.6-universal-darwin)
CFPropertyList (~> 2.2.6)
facter (2.5.1)
facter (2.5.1-universal-darwin)
CFPropertyList (~> 2.2)
faraday (0.9.2)
multipart-post (>= 1.2, < 3)
faraday_middleware (0.10.1)
faraday (>= 0.7.4, < 1.0)
fast_gettext (1.1.0)
gettext (3.2.2)
gettext (3.2.4)
locale (>= 2.0.5)
text (>= 1.3.0)
gettext-setup (0.25)
gettext-setup (0.28)
fast_gettext (~> 1.1.0)
gettext (>= 3.0.2)
locale
hiera (3.3.1)
hiera (3.4.2)
hitimes (1.2.6)
json (2.1.0)
json_pure (1.8.6)
json-schema (2.8.0)
addressable (>= 2.4)
locale (2.1.2)
log4r (1.1.10)
metaclass (0.0.4)
metadata-json-lint (1.2.2)
json
semantic_puppet (>= 0.1.2, < 2.0.0)
metadata-json-lint (2.0.2)
json-schema (~> 2.8)
spdx-licenses (~> 1.0)
minitar (0.6.1)
mocha (1.2.1)
mocha (1.3.0)
metaclass (~> 0.0.1)
multi_json (1.12.1)
multi_json (1.12.2)
multipart-post (2.0.0)
necromancer (0.4.0)
os (1.0.0)
parallel (1.11.2)
parallel (1.12.0)
parser (2.4.0.0)
ast (~> 2.2)
pastel (0.7.1)
equatable (~> 0.5.0)
tty-color (~> 0.4.0)
powerpack (0.1.1)
puppet (4.10.1)
public_suffix (3.0.0)
puppet (5.3.2)
facter (> 2.0, < 4)
gettext-setup (>= 0.10, < 1)
hiera (>= 2.0, < 4)
json_pure (~> 1.8)
hiera (>= 3.2.1, < 4)
locale (~> 2.1)
puppet (4.10.1-universal-darwin)
CFPropertyList (~> 2.2.6)
puppet (5.3.2-universal-darwin)
CFPropertyList (~> 2.2)
facter (> 2.0, < 4)
gettext-setup (>= 0.10, < 1)
hiera (>= 2.0, < 4)
json_pure (~> 1.8)
hiera (>= 3.2.1, < 4)
locale (~> 2.1)
puppet-lint (2.2.1)
puppet-lint (2.3.3)
puppet-lint-absolute_classname-check (0.2.4)
puppet-lint (>= 1.0, < 3.0)
puppet-lint-absolute_template_path (1.0.1)
@ -81,15 +83,15 @@ GEM
puppet-lint (>= 1.0, < 3.0)
puppet-lint-variable_contains_upcase (1.2.0)
puppet-lint (>= 1.0, < 3.0)
puppet-syntax (2.4.0)
puppet-syntax (2.4.1)
rake
puppet_forge (2.2.4)
puppet_forge (2.2.6)
faraday (~> 0.9.0)
faraday_middleware (>= 0.9.0, < 0.11.0)
gettext-setup (~> 0.11)
minitar
semantic_puppet (~> 0.1.0)
puppetlabs_spec_helper (2.1.3)
puppetlabs_spec_helper (2.3.2)
mocha (~> 1.0)
puppet-lint (~> 2.0)
puppet-syntax (~> 2.0)
@ -104,7 +106,7 @@ GEM
semantic_puppet (~> 0.1.0)
rainbow (2.2.2)
rake
rake (12.0.0)
rake (12.1.0)
rspec (3.6.0)
rspec-core (~> 3.6.0)
rspec-expectations (~> 3.6.0)
@ -117,38 +119,43 @@ GEM
rspec-mocks (3.6.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.6.0)
rspec-puppet (2.5.0)
rspec-puppet (2.6.9)
rspec
rspec-support (3.6.0)
rubocop (0.49.1)
rubocop (0.50.0)
parallel (~> 1.10)
parser (>= 2.3.3.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
rainbow (>= 2.2.2, < 3.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.8.1)
rugged (0.25.1.1)
ruby-progressbar (1.9.0)
rugged (0.26.0)
semantic_puppet (0.1.4)
gettext-setup (>= 0.3)
spdx-licenses (1.1.0)
text (1.3.1)
timers (4.1.2)
hitimes
trollop (2.1.2)
tty-color (0.4.2)
tty-command (0.4.0)
tty-command (0.6.0)
pastel (~> 0.7.0)
tty-cursor (0.4.0)
tty-file (0.3.0)
tty-cursor (0.5.0)
tty-file (0.4.0)
diff-lcs (~> 1.3.0)
pastel (~> 0.7.0)
tty-prompt (~> 0.12.0)
tty-prompt (0.12.0)
pastel (~> 0.7.1)
tty-prompt (~> 0.13.2)
tty-prompt (0.13.2)
necromancer (~> 0.4.0)
pastel (~> 0.7.0)
tty-cursor (~> 0.4.0)
wisper (~> 1.6.1)
unicode-display_width (1.2.1)
wisper (1.6.1)
timers (~> 4.1.2)
tty-cursor (~> 0.5.0)
tty-reader (~> 0.1.0)
tty-reader (0.1.0)
wisper (~> 2.0.0)
unicode-display_width (1.3.0)
wisper (2.0.0)
xmlrpc (0.3.0)
yamllint (0.0.9)
trollop (~> 2)
@ -160,10 +167,10 @@ PLATFORMS
DEPENDENCIES
json (>= 2.0.2)
metadata-json-lint (~> 1.2)
metadata-json-lint (~> 2.0)
os (~> 1.0)
puppet (>= 4.9, < 5)
puppet-lint (~> 2.2)
puppet (>= 5, < 6)
puppet-lint (~> 2.3)
puppet-lint-absolute_classname-check (~> 0.2)
puppet-lint-absolute_template_path (~> 1.0)
puppet-lint-empty_string-check (~> 0.2)
@ -174,16 +181,16 @@ DEPENDENCIES
puppet-lint-undef_in_function-check (~> 0.2)
puppet-lint-unquoted_string-check (~> 0.3)
puppet-lint-variable_contains_upcase (~> 1.2)
puppetlabs_spec_helper (~> 2.1)
puppetlabs_spec_helper (~> 2.3)
r10k (~> 2.5)
rspec-puppet (~> 2.5)
rubocop (~> 0.49)
rugged (~> 0.24)
tty-command (~> 0.4)
tty-file (~> 0.3)
tty-prompt (~> 0.12)
rspec-puppet (~> 2.6)
rubocop (~> 0.50)
rugged (~> 0.26)
tty-command (~> 0.6)
tty-file (~> 0.4)
tty-prompt (~> 0.13)
xmlrpc (~> 0.3.0)
yamllint (~> 0.0.9)
BUNDLED WITH
1.14.6
1.15.4

View file

@ -3,7 +3,7 @@ echo 'This script takes care of getting dots ready to use'
echo 'Enter the number of the task you want to perform:'
PS3='Task: '
select TASK in 'Mac setup' 'EL setup' 'Quit';
select TASK in 'Mac setup' 'EL setup' 'Mint setup' 'Quit';
do
case $TASK in
'Mac setup' )
@ -12,6 +12,9 @@ do
'EL setup' )
~/.dotfiles/bin/bootstrap/bootstrap_el.sh now
;;
'Mint setup' )
~/.dotfiles/bin/bootstrap/bootstrap_mint.sh now
;;
'Quit' )
echo 'Exiting'
exit 0

0
bin/bootstrap/bootstrap_el.sh Normal file → Executable file
View file

21
bin/bootstrap/bootstrap_mint.sh Executable file
View file

@ -0,0 +1,21 @@
#!/bin/bash
if [[ $1 == 'now' ]]; then
# Install dot's dependencies
sudo apt-add-repository ppa:brightbox/ruby-ng
sudo apt-get update
sudo apt-get install ruby2.4 ruby2.4-dev ruby-switch cmake build-essential
sudo ruby-switch --set ruby2.4
sudo gem install --no-ri --no-rdoc bundler
# Make dot usable
cd ~/.dotfiles
bundle install
# Install Puppet modules
bundle exec rake dots:run_r10k
# Display tasks that can be run
echo 'These are the task that can now be executed:'
bundle exec rake -T |grep --color=never 'rake dots'
fi

View file

@ -10,7 +10,7 @@ cmd = TTY::Command.new
@home = File.expand_path('~')
@dotroot = File.dirname(File.dirname(File.expand_path($PROGRAM_NAME)))
@excludes = %w[mac nix ssh]
@excludes = %w[linux mac nix ssh]
@files_copy = Dir.glob("#{@dotroot}/copy/*")
@files_link = Dir.glob("#{@dotroot}/link/*")
@ssh_link = Dir.glob("#{@dotroot}/link/ssh/*")
@ -30,7 +30,7 @@ elsif OS.mac?
@files_link.concat Dir.glob("#{@dotroot}/link/mac/*")
elsif OS.linux?
puts 'It seems you are on Linux'
@files_link.concat Dir.glob("#{@dotroot}/link/linux/*")
else
abort("I'm not sure what to do with this OS...") unless OS.posix?

1
link/linux/tmux.conf Normal file
View file

@ -0,0 +1 @@
source "/usr/share/powerline/bindings/tmux/powerline.conf"

View file

@ -0,0 +1 @@
set rtp+='/usr/share/vim/addons/plugin/powerline.vim'

View file

@ -0,0 +1,3 @@
python from powerline.vim import setup as powerline_setup
python powerline_setup()
python del powerline_setup

View file

@ -57,7 +57,4 @@ let g:syntastic_ruby_checkers = ['rubocop']
let g:syntastic_quiet_messages = {'level': 'warnings'}
let g:vim_markdown_folding_disabled = 1
python from powerline.vim import setup as powerline_setup
python powerline_setup()
python del powerline_setup
source ~/.vimrc_os_specific

View file

@ -4,10 +4,13 @@ export ZSH=~/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
#ZSH_THEME="af-magic"
#ZSH_THEME="pygmalion"
#ZSH_THEME="muse"
ZSH_THEME="beanbag"
if [[ `uname` == 'Linux' ]]; then
ZSH_THEME="af-magic"
else
ZSH_THEME="beanbag"
#ZSH_THEME="pygmalion"
#ZSH_THEME="muse"
fi
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
@ -61,6 +64,11 @@ source $ZSH/oh-my-zsh.sh
# export MANPATH="/usr/local/man:$MANPATH"
# Start GPG agent
export GPG_TTY=$(tty)
gpg-connect-agent /bye
export SSH_AUTH_SOCK=~/.gnupg/S.gpg-agent.ssh
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.

View file

@ -1,4 +1,4 @@
# rubocop:disable Lint/UnneededDisable, Style/FileName
# rubocop:disable Lint/UnneededDisable, Naming
forge 'http://forge.puppetlabs.com'
# rubocop:disable Metrics/LineLength
@ -6,6 +6,8 @@ forge 'http://forge.puppetlabs.com'
moduledir "#{File.dirname(File.dirname(File.dirname(__FILE__)))}/vendor/puppet_modules"
# rubocop:enable Metrics/LineLength
mod 'puppetlabs-apt', '4.1.0'
mod 'puppetlabs-stdlib', '4.20.0'
mod 'puppetlabs-vcsrepo', '2.0.0'
mod 'thekevjames-homebrew',
git: 'https://github.com/genebean/puppet-homebrew.git',

View file

@ -0,0 +1,2 @@
---
homedir: '/home/gene'

View file

@ -0,0 +1,10 @@
Puppet::Functions.create_function(:find_group) do
dispatch :find_group do
param 'String', :some_path
return_type 'String'
end
def find_group(some_path)
File.stat(some_path).gid.to_s
end
end

View file

@ -0,0 +1,10 @@
Puppet::Functions.create_function(:find_owner) do
dispatch :find_owner do
param 'String', :some_path
return_type 'String'
end
def find_owner(some_path)
File.stat(some_path).uid.to_s
end
end

View file

@ -11,11 +11,15 @@ node default {
notify{'This is from the default node.':}
}
node 'yellowbadger' {
include ::role::workstation
}
node 'gene' {
include ::role::workstation
}
node 'mintstring' {
include ::role::workstation
}
node 'yellowbadger' {
include ::role::workstation
}

View file

@ -0,0 +1,19 @@
Facter.add(:os_release) do
confine kernel: 'Linux'
setcode do
file_path = '/etc/os-release'
if File.exist?(file_path)
os_release_hash = {}
File.open(file_path, 'r') do |file|
file.each_line do |line|
line_data = line.split('=')
key = line_data[0].downcase
value = line_data[1].strip.gsub(/(^\")|(\"$)/, '')
os_release_hash[key] = value
end
end
os_release_hash
end
end
end

View file

@ -1,13 +1,5 @@
# the base profile should include component modules that will be on all nodes
class profile::base {
$pip_packages = [
'psutil',
'powerline-status',
]
package { $pip_packages:
ensure => 'latest',
provider => 'pip',
require => Package['python'],
}
}

View file

@ -0,0 +1,20 @@
# Select a profile based on the OS family
class profile::linux {
case $facts['os']['family'] {
'Debian': { include ::profile::linux::debian }
default: { fail("${facts['os']['family']} isn't supported yet") }
}
exec { 'download hub':
path => '/bin:/usr/bin',
command => "curl -s https://api.github.com/repos/github/hub/releases/latest | grep \"browser_download_url.*linux-amd64\" | cut -d '\"' -f4 | xargs -n 1 curl -L | tar -xzvf - -C /tmp && mv /tmp/hub* /usr/local/hub",
creates => '/usr/local/hub',
}
file {'/usr/local/bin/hub':
ensure => 'link',
target => '/usr/local/hub/bin/hub',
}
}

View file

@ -0,0 +1,135 @@
# Profile for the Debian family of OS's
class profile::linux::debian {
$homedir = lookup('homedir')
$uid = find_owner($homedir)
$gid = find_group($homedir)
File {
owner => $uid,
group => $gid,
}
Vcsrepo {
user => $uid,
owner => $uid,
group => $gid,
}
if $facts['os_release']['ubuntu_codename'] {
$release = $facts['os_release']['ubuntu_codename']
}
elsif $facts['os']['lsb']['distcodename'] {
$release = $facts['os']['lsb']['distcodename']
}
else {
fail("Can't determine what to use in 'release' for the Docker repo")
}
apt::source { 'docker':
location => 'https://download.docker.com/linux/ubuntu',
release => $release,
repos => 'stable',
key => {
'id' => '9DC858229FC7DD38854AE2D88D81803C0EBFCD88',
'source' => 'https://download.docker.com/linux/ubuntu/gpg',
},
}
$apt_packages = [
'apt-transport-https',
'bash-completion',
'ca-certificates',
'cmake',
'coreutils',
'curl',
'figlet',
'git',
'git-flow',
'pinentry-gnome3',
'powerline',
'python',
'python-pip',
'python-psutil',
'scdaemon',
'software-properties-common',
'tmux',
'tree',
'yubikey-personalization-gui',
'zsh',
]
package { $apt_packages:
ensure => 'installed',
require => Apt::Source['docker'],
}
exec { 'set-shell-to-zsh':
path => '/bin:/usr/bin',
command => "chsh -s /usr/bin/zsh `grep '${uid}:${gid}' /etc/passwd |cut -d ':' -f1`",
cwd => $homedir,
logoutput => true,
environment => "HOME=${homedir}",
unless => "grep '${uid}:${gid}' /etc/passwd | grep '/usr/bin/zsh'",
}
$dirs = [
"${homedir}/.local",
"${homedir}/.local/share",
"${homedir}/.local/share/fonts",
"${homedir}/.vim",
"${homedir}/.vim/bundle",
"${homedir}/repos",
]
file { $dirs:
ensure => 'directory',
}
vcsrepo { "${homedir}/.oh-my-zsh":
ensure => 'present',
provider => 'git',
source => 'https://github.com/robbyrussell/oh-my-zsh.git',
}
vcsrepo { "${homedir}/.oh-my-zsh/custom/themes":
ensure => 'latest',
provider => 'git',
source => 'git@github.com:genebean/my-oh-zsh-themes.git',
}
vcsrepo { "${homedir}/.vim/bundle/Vundle.vim":
ensure => 'latest',
provider => 'git',
source => 'https://github.com/VundleVim/Vundle.vim.git',
require => File[$dirs],
}
vcsrepo { "${homedir}/repos/powerline-fonts":
ensure => 'latest',
provider => 'git',
source => 'https://github.com/powerline/fonts.git',
require => File[$dirs],
notify => Exec['update-fonts'],
}
exec { 'update-fonts':
command => "${homedir}/repos/powerline-fonts/install.sh",
cwd => "${homedir}/repos/powerline-fonts",
logoutput => true,
environment => "HOME=${homedir}",
refreshonly => true,
notify => Exec['set-font-ownership'],
}
exec { 'set-font-ownership':
path => '/bin:/usr/bin',
command => "chown -R ${uid}:${gid} ${homedir}/.local/share/fonts/*",
cwd => $homedir,
logoutput => true,
environment => "HOME=${homedir}",
require => Exec['update-fonts'],
refreshonly => true,
}
}

View file

@ -71,6 +71,18 @@ class profile::mac {
provider => 'brewcask',
}
$pip_packages = [
'psutil',
'powerline-status',
]
package { $pip_packages:
ensure => 'latest',
provider => 'pip',
require => Package['python'],
}
file { "${homedir}/repos":
ensure => 'directory',
}

View file

@ -6,6 +6,9 @@ class role::workstation {
'Darwin': {
include ::profile::mac
}
'Linux': {
include ::profile::linux
}
default: {
fail("${facts['kernel']} hasn't been setup in the workstation role yet.")
}