Modify kazu634 cookbook for LXC containers.

This commit is contained in:
Kazuhiro MUSASHI 2025-01-19 22:15:24 +09:00
parent 6b53c30a77
commit c1cc2589c4
3 changed files with 90 additions and 70 deletions

View 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
}
})

View File

@ -1,9 +1,14 @@
include_recipe './attributes.rb'
include_recipe './kazu634.rb' include_recipe './kazu634.rb'
include_recipe './ssh.rb' include_recipe './ssh.rb'
# if it is inside a VM, do the followings:
unless node['base']['lxc']
include_recipe './vim.rb' include_recipe './vim.rb'
include_recipe './mc.rb' include_recipe './mc.rb'
include_recipe './mise.rb' include_recipe './mise.rb'
end

View File

@ -7,9 +7,18 @@ user 'kazu634' do
create_home true create_home true
home HOME home HOME
shell '/usr/bin/zsh' shell node['kazu634']['shell']
end end
# sudoers
remote_file '/etc/sudoers.d/kazu634' do
owner 'root'
group 'root'
mode '440'
end
# if it is inside a VM, do the followings:
unless node['base']['lxc']
# Create directories: # Create directories:
%w( repo src tmp works .cache ).each do |d| %w( repo src tmp works .cache ).each do |d|
directory "#{HOME}/#{d}" do directory "#{HOME}/#{d}" do
@ -66,13 +75,6 @@ remote_file '/home/kazu634/.config/starship.toml' do
mode '0640' mode '0640'
end end
# sudoers
remote_file '/etc/sudoers.d/kazu634' do
owner 'root'
group 'root'
mode '440'
end
# automatically delete the /home/kazu634/tmp directory: # automatically delete the /home/kazu634/tmp directory:
remote_file '/etc/cron.d/remove_tmp' do remote_file '/etc/cron.d/remove_tmp' do
owner 'root' owner 'root'
@ -88,3 +90,4 @@ end
mode '755' mode '755'
end end
end end
end