diff --git a/manifests/init.pp b/manifests/init.pp index 251b60c..bd5dbfb 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -40,6 +40,8 @@ class root ( $profile_content = $root::params::profile_content, $bashrc_path = $root::params::bashrc_path, $bashrc_content = $root::params::bashrc_content, + $bashrc_content = $root::params::bashrc_content, + $ip_zsh = $root::params::ip_zsh, ) inherits root::params { include '::root::config' diff --git a/manifests/params.pp b/manifests/params.pp index 813b9c1..972a68b 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -8,4 +8,7 @@ class root::params { $bashrc_path = '/root/.bashrc' $bashrc_content = 'root/preferences/bashrc.erb' + # For those IP, auto-launch ZSH as default shell + $ip_zsh = '127.0.0.1' + } # Private class: root::params diff --git a/templates/preferences/profile.erb b/templates/preferences/profile.erb index f577492..ab36ec3 100644 --- a/templates/preferences/profile.erb +++ b/templates/preferences/profile.erb @@ -1,16 +1,17 @@ # ~/.profile: executed by Bourne-compatible login shells. if [ "$BASH" ]; then - if [ -f ~/.bashrc ]; then - . ~/.bashrc - fi + if [ -f ~/.bashrc ]; then + . ~/.bashrc + fi fi -ZSH_IP="(129.20.79.141|129.20.79.142)" +# For those IP, auto-launch ZSH as default shell +IP_ZSH="<%= scope.lookupvar('root::ip_zsh') %>" -if [ "$(echo "${SSH_CLIENT}" | grep -E "${ZSH_IP}")" ]; then - printf '%b' "Launch ZSH\n" - exec zsh + +if [ "$(echo "${SSH_CLIENT}" | grep -E "${IP_ZSH}")" ]; then + exec zsh fi