Skip to content

Commit 4d57ff6

Browse files
authored
Merge pull request #2220 from afbjorklund/accept-colorterm
Support /etc/ssh/sshd_config.d for AcceptEnv
2 parents 77dee19 + 7e0d03f commit 4d57ff6

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

pkg/cidata/cidata.TEMPLATE.d/boot/11-colorterm-environment.sh

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
11
#!/bin/sh
22
set -eux
33

4-
# openSUSE Tumbleweed uses /etc/ssh/sshd_config.d, not /etc/ssh/sshd_config
5-
# TODO: support /etc/ssh/sshd_config.d
6-
if [ ! -e /etc/ssh/sshd_config ]; then
7-
exit 0
8-
fi
4+
if [ -d /etc/ssh/sshd_config.d ]; then
5+
if [ -e /etc/ssh/sshd_config.d/10-acceptenv-colorterm.conf ]; then
6+
exit 0
7+
fi
8+
9+
# accept any incoming COLORTERM environment variable
10+
echo "AcceptEnv COLORTERM" >/etc/ssh/sshd_config.d/10-acceptenv-colorterm.conf
11+
elif [ -e /etc/ssh/sshd_config ]; then
12+
if grep -q "COLORTERM" /etc/ssh/sshd_config; then
13+
exit 0
14+
fi
915

10-
if grep -q "COLORTERM" /etc/ssh/sshd_config; then
16+
# accept any incoming COLORTERM environment variable
17+
sed -i 's/^AcceptEnv LANG LC_\*$/AcceptEnv COLORTERM LANG LC_*/' /etc/ssh/sshd_config
18+
else
1119
exit 0
1220
fi
1321

14-
# accept any incoming COLORTERM environment variable
15-
sed -i 's/^AcceptEnv LANG LC_\*$/AcceptEnv COLORTERM LANG LC_*/' /etc/ssh/sshd_config
1622
if [ -f /sbin/openrc-run ]; then
1723
rc-service --ifstarted sshd reload
1824
elif command -v systemctl >/dev/null 2>&1; then

0 commit comments

Comments
 (0)