forked from apnar/docker-image-nfs-ganesha
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
executable file
·96 lines (77 loc) · 1.85 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
#!/bin/bash
set -e
# Options for starting Ganesha
: ${GANESHA_LOGFILE:="/dev/stdout"}
: ${GANESHA_CONFIGFILE:="/etc/ganesha/ganesha.conf"}
: ${GANESHA_OPTIONS:="-N NIV_EVENT"} # NIV_DEBUG
: ${GANESHA_EPOCH:=""}
: ${GANESHA_EXPORT_ID:="77"}
: ${GANESHA_EXPORT:="/export"}
: ${GANESHA_ACCESS:="*"}
: ${GANESHA_ROOT_ACCESS:="*"}
: ${GANESHA_NFS_PROTOCOLS:="3,4"}
: ${GANESHA_TRANSPORTS:="UDP,TCP"}
: ${GANESHA_BOOTSTRAP_CONFIG:="yes"}
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 = /;
# Access control options
Access_Type = RW;
Squash = No_Root_Squash;
Root_Access = "${GANESHA_ROOT_ACCESS}";
Access = "${GANESHA_ACCESS}";
# NFS protocol options
Transports = "${GANESHA_TRANSPORTS}";
Protocols = "${GANESHA_NFS_PROTOCOLS}";
SecType = "sys";
# Exporting FSAL
FSAL {
Name = VFS;
}
}
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}