From 4d952faadf066f58eb1a274c2f6c3f0c96aef1d6 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 19 Sep 2014 18:35:41 -0400 Subject: [PATCH] Add bash install script --- rake/pkg/bash.rake | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 rake/pkg/bash.rake diff --git a/rake/pkg/bash.rake b/rake/pkg/bash.rake new file mode 100644 index 00000000..78ecfcde --- /dev/null +++ b/rake/pkg/bash.rake @@ -0,0 +1,30 @@ +desc "Ensure bash is setup & up-to-date" +task :bash => 'bash:update' + +namespace :bash do + task :install do + if is_mac? + echo "Attempting to install bash + completion" + Package.install "bash" + Package.install "bash-completion" + + # Write the new bash into shells if it isn't already there + bash_bin = "/usr/local/bin/bash" + if `cat /etc/shells | grep "^#{bash_bin}$"` + echo "Writing '#{bash_bin}' to /etc/shells", 2 + sh_safe "echo '#{bash_bin}' | sudo tee -a /etc/shells" + end + + sh_safe "chsh -s #{bash_bin}" + end + end + + task :update => "bash:install" + + task :remove do + if is_mac? + Package.remove "bash" + Package.remove "bash-completion" + end + end +end