lots: shellcheck, streaming stuff, fixes
[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 # shellcheck source=/a/bin/ds/.bashrc
21 if [[ -s ~/.bashrc ]];then . ~/.bashrc;fi
22
23
24 set -eE -o pipefail
25 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?"' ERR
26
27 readonly this_file; this_file="$(readlink -f -- "${BASH_SOURCE[0]}")"; cd ${this_file%/*}
28 # get rid of useless motd stuff
29 sed -i --follow-symlinks 's/^\s*PrintLastLog .*/PrintLastLog no/' /etc/ssh/sshd_config
30 rm -f /etc/update-motd.d/10-help-text /etc/update-motd.d/00-header
31
32
33 if isdeb; then
34 # fyi: debconf-set-selections doesn't like mixing tabs and spaces
35 echo "debconf debconf/frontend select Readline" | debconf-set-selections
36 service ssh reload
37 else
38 systemctl reload sshd
39 fi