minor fix and add automatic updates
[distro-setup] / ssh-emacs-setup
1 #!/bin/bash -l
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
21 set -eE -o pipefail
22 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?"' ERR
23
24 cd $(dirname $0)
25 teeu /etc/ssh/ssh_config 'SendEnv INSIDE_EMACS BASH_LOGIN_SHELL COLUMNS'
26 teeu /etc/ssh/sshd_config 'AcceptEnv INSIDE_EMACS BASH_LOGIN_SHELL COLUMNS'
27 # get rid of useless motd stuff
28 sed -i --follow-symlinks 's/^\s*PrintLastLog .*/PrintLastLog no/' /etc/ssh/sshd_config
29 rm -f /etc/update-motd.d/10-help-text /etc/update-motd.d/00-header
30
31
32 if isdeb; then
33 # fyi: debconf-set-selections doesn't like mixing tabs and spaces
34 echo "debconf debconf/frontend select Readline" | debconf-set-selections
35 service ssh reload
36 else
37 systemctl reload sshd
38 fi