| 1 | #!/bin/sh |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | set -eux |
| 7 | |
| 8 | if [ -d /etc/ssh/sshd_config.d ]; then |
| 9 | if [ -e /etc/ssh/sshd_config.d/10-acceptenv-colorterm.conf ]; then |
| 10 | exit 0 |
| 11 | fi |
| 12 | |
| 13 | |
| 14 | echo "AcceptEnv COLORTERM" >/etc/ssh/sshd_config.d/10-acceptenv-colorterm.conf |
| 15 | elif [ -e /etc/ssh/sshd_config ]; then |
| 16 | if grep -q "COLORTERM" /etc/ssh/sshd_config; then |
| 17 | exit 0 |
| 18 | fi |
| 19 | |
| 20 | |
| 21 | sed -i 's/^AcceptEnv LANG LC_\*$/AcceptEnv COLORTERM LANG LC_*/' /etc/ssh/sshd_config |
| 22 | else |
| 23 | exit 0 |
| 24 | fi |
| 25 | |
| 26 | if [ -f /sbin/openrc-run ]; then |
| 27 | if [ -f etc/init.d/ssh ]; then |
| 28 | rc-service --ifstarted ssh reload |
| 29 | elif [ -f etc/init.d/sshd ]; then |
| 30 | rc-service --ifstarted sshd reload |
| 31 | fi |
| 32 | elif command -v systemctl >/dev/null 2>&1; then |
| 33 | if systemctl -q is-active ssh; then |
| 34 | systemctl reload ssh |
| 35 | elif systemctl -q is-active sshd; then |
| 36 | systemctl reload sshd |
| 37 | fi |
| 38 | fi |