cellinfo
/
puppet-root
Archived
2
0
Fork 0

Auto-launch ZSH shell for some IP addresses.

This commit is contained in:
Jeremy Gardais 2016-11-28 15:04:55 +01:00
parent db2bf397b9
commit 493b968a5f
3 changed files with 13 additions and 7 deletions

View File

@ -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'

View File

@ -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

View File

@ -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