mirror of https://github.com/tildeclub/welcome.git
Added editor selection to firstlogin script
This commit is contained in:
parent
9b02a25b3d
commit
c110781ba2
35
welcome.rb
35
welcome.rb
|
@ -64,9 +64,33 @@ until success do
|
||||||
success = system "chsh -s #{shell}"
|
success = system "chsh -s #{shell}"
|
||||||
end
|
end
|
||||||
|
|
||||||
# byobu or not
|
# default text editor
|
||||||
sep
|
sep
|
||||||
puts "step 3:"
|
puts "step 3:"
|
||||||
|
puts " now, let's pick your default text editor"
|
||||||
|
puts
|
||||||
|
puts " You can change the default command-line text"
|
||||||
|
puts " editor used by various programs, such as crontab"
|
||||||
|
puts
|
||||||
|
|
||||||
|
editors = File.readlines("/etc/editors")
|
||||||
|
.select { |line| !line.start_with?("#") }
|
||||||
|
.map(&:chomp)
|
||||||
|
.map { |line| [File.basename(line), line] }
|
||||||
|
.to_h
|
||||||
|
|
||||||
|
editors = prompt.select(" which editor would you like to use?", editors, per_page: editors.count)
|
||||||
|
puts
|
||||||
|
puts " great, you've picked #{editors}!"
|
||||||
|
|
||||||
|
success = false
|
||||||
|
until success do
|
||||||
|
success = system "echo 'export EDITOR=#{editors}' >> #{Dir.home}/.profile"
|
||||||
|
end
|
||||||
|
|
||||||
|
# byobu or not
|
||||||
|
sep
|
||||||
|
puts "step 4:"
|
||||||
puts " we recommend using a terminal multiplexer, which is a tool that allows you"
|
puts " we recommend using a terminal multiplexer, which is a tool that allows you"
|
||||||
puts " to have tabs in your shell and even disconnect while leaving things running"
|
puts " to have tabs in your shell and even disconnect while leaving things running"
|
||||||
puts " as you left them."
|
puts " as you left them."
|
||||||
|
@ -86,7 +110,7 @@ end
|
||||||
|
|
||||||
# tz
|
# tz
|
||||||
sep
|
sep
|
||||||
puts "step 4:"
|
puts "step 5:"
|
||||||
puts " great, let's set up your timezone!"
|
puts " great, let's set up your timezone!"
|
||||||
puts
|
puts
|
||||||
tz = %x{tzselect}.chomp
|
tz = %x{tzselect}.chomp
|
||||||
|
@ -97,7 +121,7 @@ open("#{Dir.home}/.profile", "a") { |f| f.puts "export TZ='#{tz}'" }
|
||||||
|
|
||||||
# email forwarding
|
# email forwarding
|
||||||
sep
|
sep
|
||||||
puts "step 5:"
|
puts "step 6:"
|
||||||
puts " tilde.club has a standard mailserver that you can use to send"
|
puts " tilde.club has a standard mailserver that you can use to send"
|
||||||
puts " and receive mail using #{Etc.getlogin}@tilde.club"
|
puts " and receive mail using #{Etc.getlogin}@tilde.club"
|
||||||
puts
|
puts
|
||||||
|
@ -126,7 +150,7 @@ puts
|
||||||
|
|
||||||
# 2fa
|
# 2fa
|
||||||
sep
|
sep
|
||||||
puts "step 6:"
|
puts "step 7:"
|
||||||
puts " tilde.club supports two factor authentication."
|
puts " tilde.club supports two factor authentication."
|
||||||
if prompt.yes?("would you like to set up 2fa now?")
|
if prompt.yes?("would you like to set up 2fa now?")
|
||||||
system "setup-2fa"
|
system "setup-2fa"
|
||||||
|
@ -139,7 +163,7 @@ puts
|
||||||
|
|
||||||
# pronouns
|
# pronouns
|
||||||
sep
|
sep
|
||||||
puts "step 7:"
|
puts "step 8:"
|
||||||
pronouns = prompt.ask(" what are your preferred pronouns?")
|
pronouns = prompt.ask(" what are your preferred pronouns?")
|
||||||
puts " saving your pronouns to your ~/.pronouns file."
|
puts " saving your pronouns to your ~/.pronouns file."
|
||||||
puts " feel free to update it as needed!"
|
puts " feel free to update it as needed!"
|
||||||
|
@ -158,4 +182,3 @@ File.delete("#{Dir.home}/.new_user")
|
||||||
if enable_byobu
|
if enable_byobu
|
||||||
exec "byobu"
|
exec "byobu"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue