use screen on ssh connection, rename ttyd.sh to remote-login.sh

This commit is contained in:
Tobias Powalowski 2023-07-29 07:45:41 +02:00
parent 2f9b2f4293
commit 01e87254e8
4 changed files with 10 additions and 5 deletions

View file

@ -33,7 +33,7 @@ build ()
add_symlink /etc/systemd/system/multi-user.target.wants/sshd.service /usr/lib/systemd/system/sshd.service
# start ttyd on startup
add_file /usr/lib/libwebsockets-evlib_uv.so
add_file /usr/share/archboot/remote/usr/bin/ttyd.sh /usr/bin/ttyd.sh
add_file /usr/share/archboot/remote/usr/bin/remote-login.sh /usr/bin/remote-login.sh
add_file /usr/share/archboot/remote/etc/systemd/system/ttyd.service /etc/systemd/system/ttyd.service
add_symlink /etc/systemd/system/multi-user.target.wants/ttyd.service /etc/systemd/system/ttyd.service
# fix licenses

View file

@ -25,3 +25,8 @@ fi
if [[ -z "${TTY}" && -z "${SSH_TTY}" ]]; then
[[ "${SHLVL}" == "2" ]] && cat /etc/motd
fi
# run remote-login.sh on ssh connection
if [[ -z "${STY}" && -n "${SSH_TTY}" ]]; then
/usr/bin/remote-login.sh
exit 0
fi

View file

@ -7,7 +7,7 @@ After=syslog.target
After=network.target
[Service]
ExecStart=/usr/bin/ttyd ttyd.sh
ExecStart=/usr/bin/ttyd remote-login.sh
Type=simple
Restart=always
User=root

View file

@ -2,11 +2,11 @@
# SPDX-License-Identifier: GPL-2.0-only
# Created by Tobias Powalowski <tpowa@archlinux.org>
# simulate login from tty
if ! [[ -e /tmp/.setup-running ]]; then
# simulate login from tty on first screen session
if ! screen -ls &>/dev/null; then
cat /etc/motd
echo -e "Hit \e[1m\e[92mENTER\e[m for \e[1mshell\e[m login."
read -r
fi
. /etc/profile
screen -q -R
screen -q -xRR