# See the License for the specific language governing permissions and
# limitations under the License.
-set -eE -o pipefail
-cleanup() { :; }
-trap 'cleanup; echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
+x="$(readlink -f "$BASH_SOURCE")"; source "${x%/*}/bash-trace"
reboot=true
if [[ $1 == -r ]]; then
usage() {
cat <<EOF
Usage: ${0##*/} [OPTIONS] HOST
-distro setup full using fai. (assuming we already synced data files to the host)
+"distro setup full" using fai.
+
+Note: relies on other repos and paths specific to Ian's system.
+Note: disables btrbk.timer. If it was active before, it should
+be manual reenabled after completion.
---no-r Don't ssh to host and reboot.
-k ssh to host and kexec, don't use pxe. implies --no-r
+--no-r Don't ssh to host and reboot. Use this for when you are
+ booting or rebooting from some other means.
-h|--help Print help and exit.
Note: Uses GNU getopt options parsing style
##### end command line parsing ########
-
+e ser stop btrbk.timer
if [[ ! $host ]]; then
echo "$0: error: expected 1 arg of hostname"
exit 1
e myfai-chboot $host
e fai-kexec $host ||:
else
- cleanup() { pxe-server; }
+ cleanup() { pxe-server; }; _errcatch_cleanup=cleanup
e pxe-server $host fai
if $reboot; then
fi
e pxe-server -a
- cleanup() { :; }
+ unset _errcatch_cleanup
fi
error=true
fi
sleep 5
done
+e faiserver-disable
if $error; then
echo "$0: error: timeout"
exit 1
fi
-e dsremote $host
+while [[ $(ser is-active btrbk.service) == active ]]; do
+ sleep 5
+done
+e btrbk-run -t $host
+ssh $host /a/bin/distro-setup/distro-begin
+#e dsremote $host