mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-17 14:04:52 +02:00
ssh kitten: Allow to configure HOME environment variable
Useful if the user does not have a home directory or the directory is not writable.
This commit is contained in:
@@ -20,8 +20,13 @@ echo_on = int('ECHO_ON')
|
||||
data_dir = shell_integration_dir = ''
|
||||
request_data = int('REQUEST_DATA')
|
||||
leading_data = b''
|
||||
HOME = os.path.expanduser('~')
|
||||
login_shell = pwd.getpwuid(os.geteuid()).pw_shell or os.environ.get('SHELL') or 'sh'
|
||||
export_home_cmd = b'EXPORT_HOME_CMD'
|
||||
if export_home_cmd:
|
||||
HOME = base64.standard_b64decode(export_home_cmd).decode('utf-8')
|
||||
os.chdir(HOME)
|
||||
else:
|
||||
HOME = os.path.expanduser('~')
|
||||
|
||||
|
||||
def set_echo(fd, on=False):
|
||||
|
||||
@@ -62,6 +62,8 @@ dcs_to_kitty() { printf "\033P@kitty-$1|%s\033\134" "$(printf "%s" "$2" | base64
|
||||
debug() { dcs_to_kitty "print" "debug: $1"; }
|
||||
echo_via_kitty() { dcs_to_kitty "echo" "$1"; }
|
||||
|
||||
# If $HOME is configured set it here
|
||||
EXPORT_HOME_CMD
|
||||
# ensure $HOME is set
|
||||
[ -z "$HOME" ] && HOME=~
|
||||
# ensure $USER is set
|
||||
|
||||
Reference in New Issue
Block a user