diff --git a/Dockerfile b/Dockerfile index ca4b24f..cde7190 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,14 +2,12 @@ ARG BUILD_FROM=alpine:latest FROM $BUILD_FROM -RUN apk --update --no-cache add bash nfs-utils && \ - \ +RUN apk --update --no-cache add bash nfs-utils tzdata && \ # remove the default config files - rm -v /etc/idmapd.conf /etc/exports - -# http://wiki.linux-nfs.org/wiki/index.php/Nfsv4_configuration -RUN mkdir -p /var/lib/nfs/rpc_pipefs && \ - mkdir -p /var/lib/nfs/v4recovery && \ + rm -v /etc/idmapd.conf /etc/exports && \ + # http://wiki.linux-nfs.org/wiki/index.php/Nfsv4_configuration + mkdir -p /var/lib/nfs/rpc_pipefs /var/lib/nfs/v4recovery && \ + mkdir /export && chmod a+rwxt /export && \ echo "rpc_pipefs /var/lib/nfs/rpc_pipefs rpc_pipefs defaults 0 0" >> /etc/fstab && \ echo "nfsd /proc/fs/nfsd nfsd defaults 0 0" >> /etc/fstab diff --git a/entrypoint.sh b/entrypoint.sh index a9f963e..e6b1842 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -273,14 +273,13 @@ is_kernel_module_loaded() { is_granted_linux_capability() { - if capsh --print | grep -Eq "^Current: = .*,?${1}(,|$)"; then + if capsh --has-p=${1} || capsh --has-p=cap_${1}; then return 0 fi - + return 1 } - ###################################################################################### ### runtime configuration assertions ###################################################################################### @@ -443,6 +442,10 @@ init_exports() { log "building $PATH_FILE_ETC_EXPORTS from environment variables" + mkdir -p /share && chmod a+rwxt /share + exports='/share *(ro,async,no_subtree_check,no_auth_nlm,insecure,no_root_squash,fsid=root)' + exports=$exports$'\n' + for candidate_export_var in $candidate_export_vars; do local line="${!candidate_export_var}" @@ -592,6 +595,10 @@ boot_main_exportfs() { args+=('-v') fi + echo 'Generated /etc/exports:' + cat /etc/exports + echo '' + boot_helper_start_daemon 'starting exportfs' $PATH_BIN_EXPORTFS "${args[@]}" }