forked from apnar/docker-image-nfs-ganesha
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
115 lines (93 loc) · 2.32 KB
/
start.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/bin/bash
# Based on https://github.com/apnar/docker-image-nfs-ganesha
set -e
# Options for starting Ganesha
: ${GANESHA_LOGFILE:="/dev/stdout"}
: ${GANESHA_LOGLEVEL:="DEBUG"}
: ${GANESHA_CONFIGFILE:="/etc/ganesha/ganesha.conf"}
: ${GANESHA_OPTIONS:="-N NIV_EVENT"} # NIV_DEBUG
: ${GANESHA_EPOCH:=""}
: ${GANESHA_EXPORT_ID:="77"}
: ${GANESHA_EXPORT:="/export"}
: ${GANESHA_PSEUDO_PATH:="/"}
: ${GANESHA_ACCESS:="*"}
: ${GANESHA_ROOT_ACCESS:="*"}
: ${GANESHA_NFS_PROTOCOLS:="3,4"}
: ${GANESHA_TRANSPORTS:="UDP,TCP"}
: ${GANESHA_BOOTSTRAP_CONFIG:="yes"}
: ${GANESHA_GRACELESS:=true}
function bootstrap_config {
echo "Bootstrapping Ganesha NFS config"
cat <<END >${GANESHA_CONFIGFILE}
EXPORT
{
# Export Id (mandatory, each EXPORT must have a unique Export_Id)
Export_Id = ${GANESHA_EXPORT_ID};
# Exported path (mandatory)
Path = ${GANESHA_EXPORT};
# Pseudo Path (for NFS v4)
Pseudo = ${GANESHA_PSEUDO_PATH};
# Access control options
Access_Type = RW;
Squash = None;
#Root_Access = "${GANESHA_ROOT_ACCESS}";
#Access = "${GANESHA_ACCESS}";
# NFS protocol options
#Transports = "${GANESHA_TRANSPORTS}";
#Protocols = "${GANESHA_NFS_PROTOCOLS}";
#SecType = "sys";
# Exporting FSAL
FSAL {
Name = MEM;
}
}
NFSV4 {
Graceless = ${GANESHA_GRACELESS};
}
LOG {
Default_Log_Level = ${GANESHA_LOGLEVEL};
}
MEM {
# This is the size needed to pass pyNFS. Default is 0
Inode_Size = 1114112;
# This creates a thread that exercises UP calls
UP_Test_Interval = 20;
}
END
}
function bootstrap_export {
if [ ! -f ${GANESHA_EXPORT} ]; then
mkdir -p "${GANESHA_EXPORT}"
fi
}
function init_rpc {
echo "Starting rpcbind"
rpcbind || return 0
rpc.statd -L || return 0
rpc.idmapd || return 0
sleep 1
}
function init_dbus {
echo "Starting dbus"
rm -f /var/run/dbus/system_bus_socket
rm -f /var/run/dbus/pid
dbus-uuidgen --ensure
dbus-daemon --system --fork
sleep 1
}
function startup_script {
if [ -f "${STARTUP_SCRIPT}" ]; then
/bin/sh ${STARTUP_SCRIPT}
fi
}
if [[ "${GANESHA_BOOTSTRAP_CONFIG}" = "yes" ]]
then
bootstrap_config
fi
bootstrap_export
startup_script
init_rpc
init_dbus
echo "Starting Ganesha NFS"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib
exec /usr/bin/ganesha.nfsd -F -L ${GANESHA_LOGFILE} -f ${GANESHA_CONFIGFILE} ${GANESHA_OPTIONS}