fix vpn host naming
[distro-setup] / demohost-mount
1 #!/bin/bash
2 if [[ -s ~/.bashrc ]];then . ~/.bashrc;fi
3
4 [[ $EUID == 0 ]] || exec sudo -E "${BASH_SOURCE[0]}" "$@"
5
6
7
8
9 ip=$(host demohost | sed -rn 's/^\S+ has address //p;T;q')/32
10 cedit demohost /etc/exports <<EOF || exportfs -ra
11 /a $ip(async,rw,no_subtree_check,no_root_squash)
12 /q $ip(async,rw,no_subtree_check,no_root_squash)
13 EOF
14
15
16 ssh root@demohost bash -s <<'EOFOUTER'
17 set -eE -o pipefail
18
19 apt-get install -y nfs-common
20
21 sed -ri '\%^(faiserver:/[aq]|/q/p)\s%d' /etc/fstab
22 cat >>/etc/fstab <<'EOF'
23 faiserver:/a /a nfs defaults 0 0
24 faiserver:/q /q nfs defaults 0 0
25 /q/p /p none bind 0 0
26 EOF
27
28 mkdir -p /a /q /p
29 mount /a
30 mount /q
31 mount /p
32 EOFOUTER