fixes to last commit
[distro-setup] / maru-init
1 #!/bin/bash
2 # Copyright (C) 2017 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 set -eE -o pipefail
17 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
18
19
20 usage() {
21 cat <<EOF
22 Usage: ${0##*/}
23 Initial setup for maru debian for nexus 5.
24
25 We do this separately because it's constrained for space much more than
26 any other host. The maru debian takes up about 1.5G. We start with about
27 6.8G free. We want to keep a few gigs free to take pictures and
28 movies. I should really trade this in for a 32GB version.
29
30 -h|--help Print help and exit.
31 EOF
32 exit $1
33 }
34
35 case $1 in
36 *) usage ;;
37 esac
38
39
40 scp $(readlink -f $(which rootsshsync)) maru-init maru@n5:
41 ssh -t maru@n5 ./rootsshsync
42
43 ssh root@n5 bash <<'EOF'
44 echo "ian ALL=(ALL) NOPASSWD: ALL" >>/etc/sudoers
45 echo n5 >/etc/hostname
46 sed -i '/^127\.0\.1\.1/d' /etc/hosts
47 echo "127.0.1.1 n5.lan n5" >>/etc/hosts
48 hostname -F /etc/hostname
49
50 kill $(pgrep -U maru)
51 usermod -l ian -m -d /home/ian maru
52 groupmod -n ian maru
53 useradd -m -s /bin/bash user2
54 EOF
55
56 # then do myunison n5,
57 # then do conflink.