alpine: workarounds for use cases with custom exports files
This commit is contained in:
parent
a75674f812
commit
6f0b01aeca
@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -xuo pipefail
|
||||
set -xo pipefail
|
||||
trap "stop; exit 0;" SIGTERM SIGINT
|
||||
|
||||
stop()
|
||||
@ -13,7 +13,7 @@ stop()
|
||||
exit
|
||||
}
|
||||
|
||||
DEFALUT_TIMEZONE="America/New York"
|
||||
DEFALUT_TIMEZONE="America/New_York"
|
||||
DEFAULT_PERMITTED="*"
|
||||
RW_MODE="rw"
|
||||
UID=${NFS_UID:-0}
|
||||
@ -39,6 +39,23 @@ if [ -n "${SHARED_DIRECTORY}" ]; then
|
||||
EOE
|
||||
|
||||
chmod 777 "${SHARED_DIRECTORY}"
|
||||
else
|
||||
cp /etc/exports.mnt /etc/exports
|
||||
grep -vi "^[[:space:]]*#" /etc/exports | while read -r line; do
|
||||
if [ -n "${line}" ]; then
|
||||
trimmed="${line##*([[:space:]])}"
|
||||
# shellcheck disable=SC2001
|
||||
rcdir="$(eval "declare -a str=($( echo "$trimmed" | sed 's/[][`~!@#$%^&*():;<>.,?|{}=+-]/\\&/g' )); echo \${str[0]}")"
|
||||
cdir="${rcdir##*(\")}"
|
||||
echo "${cdir}"
|
||||
mkdir -p "/exports${cdir}"
|
||||
mount --bind -o rw "${cdir}" "/exports${cdir}"
|
||||
chmod 777 "/exports${cdir}"
|
||||
fi
|
||||
done
|
||||
sed -i -r '/^[[:space:]]*#/!s/^("?)/\1\/exports/' /etc/exports
|
||||
# root entry
|
||||
echo -e "\n/exports *(rw,no_root_squash,insecure,no_subtree_check,nohide,fsid=0,sync,sec=krb5p:krb5i:krb5)" >> /etc/exports
|
||||
fi
|
||||
|
||||
# setup logging
|
||||
@ -48,9 +65,6 @@ syslogd
|
||||
|
||||
exportfs -rvaf
|
||||
|
||||
echo "${NFS_KRB_REALM}" > /etc/hostname
|
||||
|
||||
|
||||
export OPTS_RPC_MOUNTD='--debug all -t 8 -N 3'
|
||||
cat >> /etc/conf.d/nfs <<EOC
|
||||
OPTS_RPC_MOUNTD="${OPTS_RPC_MOUNTD}"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user