various fixes, mostly for etiona
[distro-setup] / ssh-emacs-setup
1 #!/bin/bash
2 # Copyright (C) 2016 Ian Kelling
3
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7
8 # http://www.apache.org/licenses/LICENSE-2.0
9
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 if [[ $EUID != 0 ]]; then
17 sudo "$0"
18 exit
19 fi
20 if [[ -s ~/.bashrc ]];then . ~/.bashrc;fi
21
22
23 set -eE -o pipefail
24 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?"' ERR
25
26 cd $(dirname $0)
27 teeu /etc/ssh/ssh_config 'SendEnv INSIDE_EMACS BRC COLUMNS'
28 teeu /etc/ssh/sshd_config 'AcceptEnv INSIDE_EMACS BRC COLUMNS'
29 # get rid of useless motd stuff
30 sed -i --follow-symlinks 's/^\s*PrintLastLog .*/PrintLastLog no/' /etc/ssh/sshd_config
31 rm -f /etc/update-motd.d/10-help-text /etc/update-motd.d/00-header
32
33
34 if isdeb; then
35 # fyi: debconf-set-selections doesn't like mixing tabs and spaces
36 echo "debconf debconf/frontend select Readline" | debconf-set-selections
37 service ssh reload
38 else
39 systemctl reload sshd
40 fi