various changes around data volumes
[distro-setup] / mount-latest-remote
1 #!/bin/bash
2
3 set -eE -o pipefail
4 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
5
6 script_dir=$(dirname $(readlink -f "$BASH_SOURCE"))
7
8 if [[ ! $@ ]]; then
9 echo "mount-latest-remote: error: expected 1 or more host arguments"
10 exit 1
11 fi
12
13 for tg; do
14 scp $script_dir/{mount-latest-subvol,check-subvol-stale} \
15 root@$tg:/usr/local/bin
16 ssh root@$tg bash <<'EOF'
17 set -e
18 chmod +x /usr/local/bin/{mount-latest-subvol,check-subvol-stale}
19 mount-latest-subvol
20 EOF
21 done