Auto-launch ZSH shell for some IP addresses.
This commit is contained in:
parent
db2bf397b9
commit
493b968a5f
|
@ -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'
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
Reference in New Issue