2 # Copyright (C) 2016 Ian Kelling
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
8 # http://www.apache.org/licenses/LICENSE-2.0
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.
16 if [[ -s ~
/.bashrc
]];then . ~
/.bashrc
;fi
19 if [[ $1 == -r ]]; then
26 Usage: ${0##*/} [OPTIONS] HOST
27 "distro setup full" using fai.
29 Note: relies on other repos and paths specific to Ian's system.
30 Note: disables btrbk.timer. If it was active before, it should
31 be manual reenabled after completion.
33 -k ssh to host and kexec, don't use pxe. implies --no-r
34 --no-r Don't ssh to host and reboot. Use this for when you are
35 booting or rebooting from some other means.
36 -h|--help Print help and exit.
38 Note: Uses GNU getopt options parsing style
43 ##### begin command line parsing ########
47 temp
=$
(getopt
-l help,no-r hk
"$@") || usage
1
51 --no-r) reboot
=false
; shift ;;
52 -k) kexec
=true
; reboot
=false
; shift ;;
55 *) echo "$0: Internal error!" ; exit 1 ;;
60 ##### end command line parsing ########
63 if [[ ! $host ]]; then
64 echo "$0: error: expected 1 arg of hostname"
73 err-cleanup
() { pxe-server
; }
77 # untested, this caused hang using here doc.
78 ssh root@
$host "touch /tmp/keyscript-off; reboot" ||
: &
86 for ((i
=0; i
<240; i
++)); do
87 if timeout
-s 9 10 ssh $host :; then
95 echo "$0: error: timeout"
98 while [[ $
(ser is-active btrbk.service
) == active
]]; do
101 # if we partitioned, we do this:
102 #btrbk-run -t $host archive