From: Ian Kelling Date: Sat, 8 Apr 2017 23:42:58 +0000 (-0700) Subject: limit fai nfs export to host being installed X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=1885f9677fdf2bfeac95285cf13a7d60273d096a;p=automated-distro-installer limit fai nfs export to host being installed --- diff --git a/chost b/chost index 3e1acd2..77e17d4 100755 --- a/chost +++ b/chost @@ -7,7 +7,6 @@ set -eE -o pipefail trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR host=$1 -addr=$(host $host | sed -rn 's/^.*has address (.*)/\1/p;T;q') -h=$(host $addr) -h=${h##* } +addr=$(getent hosts $host | awk '{print $1}') +h=$(getent hosts $addr | awk '{print $2}') echo ${h%%.*} diff --git a/fai-redep b/fai-redep index b8fabac..4e354a2 100755 --- a/fai-redep +++ b/fai-redep @@ -81,4 +81,3 @@ chmod -R a+rX /srv/fai/config/distro-install-common #wget -nv -N $u EOF -faiserver-enable diff --git a/faiserver-disable b/faiserver-disable old mode 100755 new mode 100644 index 8f920d8..93819cc --- a/faiserver-disable +++ b/faiserver-disable @@ -15,4 +15,4 @@ if [[ $1 ]]; then usage 1 fi -ssh root@$(chost faiserver) "sed -ri --follow-symlinks 's,^/srv/fai/,#\0,' /etc/exports; exportfs -ra" +ssh root@$(chost faiserver) "sed -ri --follow-symlinks '\%^/srv/fai/d' /etc/exports; exportfs -ra" diff --git a/faiserver-enable b/faiserver-enable deleted file mode 100755 index 2492b2e..0000000 --- a/faiserver-enable +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -set -eE -o pipefail -trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR - -usage() { - cat </dev/null; then $sed '/^PACKAGES install$/a cryptsetup' /etc/fai/NFSROOT fi -e fai-setup -vf +e fai-setup -e -vf { head -n 1 /srv/fai/nfsroot/root/.ssh/known_hosts | awk '{print $1}' \ | tr '\n' ' '; ssh-keyscan localhost | grep -o "ecdsa-sha2-nistp256.*"; \ } >>/srv/fai/nfsroot/root/.ssh/known_hosts diff --git a/myfai-chboot b/myfai-chboot index 11c3eae..2a6e025 100755 --- a/myfai-chboot +++ b/myfai-chboot @@ -7,11 +7,12 @@ x=$(readlink -f "$BASH_SOURCE"); cd ${x%/*} usage() { cat <>/etc/exports <