-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.sh
executable file
·87 lines (71 loc) · 1.53 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
#!/bin/bash
set -e
# Options for starting Ganesha
: ${GANESHA_OPTIONS:="-N NIV_EVENT"} # NIV_DEBUG
: ${GANESHA_PROTOCOLS:="4"}
: ${GANESHA_TRANSPORTS:="UDP,TCP"}
: ${GANESHA_KRB5:="true"}
: ${GANESHA_SECTYPE:="krb5"}
function bootstrap_config {
echo "Bootstrapping Ganesha NFS config"
cat <<EOF > /usr/local/etc/ganesha/ganesha.conf
NFSv4 {
Graceless = true;
}
NFS_KRB5 {
Active_krb5 = ${GANESHA_KRB5};
}
EXPORT {
# Export Id (mandatory, each EXPORT must have a unique Export_Id)
Export_Id = 1;
# Exported path (mandatory)
Path = /export;
# Pseudo Path (for NFS v4)
Pseudo = /;
# Access control options
Access_Type = RW;
Squash = No_Root_Squash;
# NFS protocol options
Transports = ${GANESHA_TRANSPORTS};
Protocols = ${GANESHA_PROTOCOLS};
SecType = ${GANESHA_SECTYPE};
# Exporting FSAL
FSAL {
Name = VFS;
}
}
EOF
}
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
}
bootstrap_config
bootstrap_export
startup_script
init_rpc
init_dbus
echo "Starting Ganesha NFS"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib
exec /usr/local/bin/ganesha.nfsd -F -L /dev/stdout ${GANESHA_OPTIONS}