Modify kazu634
cookbook for LXC containers.
This commit is contained in:
parent
6b53c30a77
commit
c1cc2589c4
12
cookbooks/kazu634/attributes.rb
Normal file
12
cookbooks/kazu634/attributes.rb
Normal file
@ -0,0 +1,12 @@
|
||||
# If it is a VM, use `zsh`. Otherwise, `bash`:
|
||||
unless node['base']['lxc']
|
||||
SHELL = '/usr/bin/zsh'
|
||||
else
|
||||
SHELL = '/usr/bin/bash'
|
||||
end
|
||||
|
||||
node.reverse_merge!({
|
||||
'kazu634' => {
|
||||
'shell' => SHELL
|
||||
}
|
||||
})
|
@ -1,9 +1,14 @@
|
||||
include_recipe './attributes.rb'
|
||||
|
||||
include_recipe './kazu634.rb'
|
||||
|
||||
include_recipe './ssh.rb'
|
||||
|
||||
include_recipe './vim.rb'
|
||||
# if it is inside a VM, do the followings:
|
||||
unless node['base']['lxc']
|
||||
include_recipe './vim.rb'
|
||||
|
||||
include_recipe './mc.rb'
|
||||
include_recipe './mc.rb'
|
||||
|
||||
include_recipe './mise.rb'
|
||||
include_recipe './mise.rb'
|
||||
end
|
||||
|
@ -7,63 +7,7 @@ user 'kazu634' do
|
||||
create_home true
|
||||
home HOME
|
||||
|
||||
shell '/usr/bin/zsh'
|
||||
end
|
||||
|
||||
# Create directories:
|
||||
%w( repo src tmp works .cache ).each do |d|
|
||||
directory "#{HOME}/#{d}" do
|
||||
owner 'kazu634'
|
||||
group 'kazu634'
|
||||
mode '755'
|
||||
end
|
||||
end
|
||||
|
||||
# `git-now` deployment:
|
||||
git '/home/kazu634/repo/git-now' do
|
||||
repository 'https://github.com/iwata/git-now.git'
|
||||
user 'kazu634'
|
||||
|
||||
recursive true
|
||||
end
|
||||
|
||||
execute 'make install' do
|
||||
user 'root'
|
||||
cwd '/home/kazu634/repo/git-now/'
|
||||
|
||||
not_if 'which git-now'
|
||||
end
|
||||
|
||||
# Deploy dot files:
|
||||
git '/home/kazu634/repo/dotfiles' do
|
||||
repository 'https://gitea.kazu634.com/kazu634/dotfiles.git'
|
||||
user 'kazu634'
|
||||
end
|
||||
|
||||
execute 'install_dotfiles' do
|
||||
user 'root'
|
||||
command 'su - kazu634 -c "/home/kazu634/repo/dotfiles/install.sh"'
|
||||
|
||||
not_if 'test -f /home/kazu634/.zshenv'
|
||||
end
|
||||
|
||||
# Deploy `zplug`:
|
||||
git '/home/kazu634/.zplug' do
|
||||
repository 'https://github.com/zplug/zplug.git'
|
||||
user 'kazu634'
|
||||
end
|
||||
|
||||
# Starship config
|
||||
directory '/home/kazu634/.config' do
|
||||
owner 'kazu634'
|
||||
group 'kazu634'
|
||||
mode '0740'
|
||||
end
|
||||
|
||||
remote_file '/home/kazu634/.config/starship.toml' do
|
||||
owner 'kazu634'
|
||||
group 'kazu634'
|
||||
mode '0640'
|
||||
shell node['kazu634']['shell']
|
||||
end
|
||||
|
||||
# sudoers
|
||||
@ -73,18 +17,77 @@ remote_file '/etc/sudoers.d/kazu634' do
|
||||
mode '440'
|
||||
end
|
||||
|
||||
# automatically delete the /home/kazu634/tmp directory:
|
||||
remote_file '/etc/cron.d/remove_tmp' do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '644'
|
||||
end
|
||||
# if it is inside a VM, do the followings:
|
||||
unless node['base']['lxc']
|
||||
# Create directories:
|
||||
%w( repo src tmp works .cache ).each do |d|
|
||||
directory "#{HOME}/#{d}" do
|
||||
owner 'kazu634'
|
||||
group 'kazu634'
|
||||
mode '755'
|
||||
end
|
||||
end
|
||||
|
||||
# Deploy `~/works/rsync.sh`:
|
||||
%w( rsync.sh lsyncd.conf.lua ).each do |file|
|
||||
remote_file "/home/kazu634/works/#{file}" do
|
||||
# `git-now` deployment:
|
||||
git '/home/kazu634/repo/git-now' do
|
||||
repository 'https://github.com/iwata/git-now.git'
|
||||
user 'kazu634'
|
||||
|
||||
recursive true
|
||||
end
|
||||
|
||||
execute 'make install' do
|
||||
user 'root'
|
||||
cwd '/home/kazu634/repo/git-now/'
|
||||
|
||||
not_if 'which git-now'
|
||||
end
|
||||
|
||||
# Deploy dot files:
|
||||
git '/home/kazu634/repo/dotfiles' do
|
||||
repository 'https://gitea.kazu634.com/kazu634/dotfiles.git'
|
||||
user 'kazu634'
|
||||
end
|
||||
|
||||
execute 'install_dotfiles' do
|
||||
user 'root'
|
||||
command 'su - kazu634 -c "/home/kazu634/repo/dotfiles/install.sh"'
|
||||
|
||||
not_if 'test -f /home/kazu634/.zshenv'
|
||||
end
|
||||
|
||||
# Deploy `zplug`:
|
||||
git '/home/kazu634/.zplug' do
|
||||
repository 'https://github.com/zplug/zplug.git'
|
||||
user 'kazu634'
|
||||
end
|
||||
|
||||
# Starship config
|
||||
directory '/home/kazu634/.config' do
|
||||
owner 'kazu634'
|
||||
group 'kazu634'
|
||||
mode '755'
|
||||
mode '0740'
|
||||
end
|
||||
|
||||
remote_file '/home/kazu634/.config/starship.toml' do
|
||||
owner 'kazu634'
|
||||
group 'kazu634'
|
||||
mode '0640'
|
||||
end
|
||||
|
||||
# automatically delete the /home/kazu634/tmp directory:
|
||||
remote_file '/etc/cron.d/remove_tmp' do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '644'
|
||||
end
|
||||
|
||||
# Deploy `~/works/rsync.sh`:
|
||||
%w( rsync.sh lsyncd.conf.lua ).each do |file|
|
||||
remote_file "/home/kazu634/works/#{file}" do
|
||||
owner 'kazu634'
|
||||
group 'kazu634'
|
||||
mode '755'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user