## ## ** mod-mosh: Live session with `lmosh` command ** # #* version: 2019-11-16 #* author: Michael Arbet (marbet@redhat.com) #* home: https://github.com/micharbet/CLE #* license: GNU GPL v2 #* Copyright (C) 2019 by Michael Arbet # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # ## `lmosh [user@]host` - live remote session with mobile shell lmosh () ( [ "$1" ] || { cle help lmosh; return 1; } _clepak tar # Here is the issue: other wrappers use /var/tmp/$USER but mosh simply can't. # Preparation phase runs as 'server' code before start mosh-server. At this # point the $USER contains remote username. # On the other side, there's the command run by mosh itself but this code # is run locally and the remote username might not be known! # Temporary home must be defined outside mosh command. TEMPHOME=/var/tmp/$CLE_USER command mosh --no-init --server=" # H=/var/tmp/\$USER; mkdir -m 755 -p \$H; cd \$H mkdir -p $TEMPHOME cd $TEMPHOME [ $OSTYPE = darwin ] && D=D || D=d base64 -\$D <<<$C64 | tar xzf - 2>/dev/null mosh-server" \ $@ $TEMPHOME/$RC )