Skip to content
This repository was archived by the owner on Oct 6, 2023. It is now read-only.

Commit 7af66e7

Browse files
committed
renaming a few functions
1 parent 68f6552 commit 7af66e7

File tree

1 file changed

+25
-21
lines changed

1 file changed

+25
-21
lines changed

entrypoint.sh

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -197,32 +197,32 @@ stop() {
197197
### runtime environment detection
198198
######################################################################################
199199

200-
get_reqd_nfs_version() {
200+
get_requested_nfs_version() {
201201

202202
echo "${!ENV_VAR_NFS_VERSION:-$DEFAULT_NFS_VERSION}"
203203
}
204204

205-
get_reqd_nfsd_threads() {
205+
get_requested_count_nfsd_threads() {
206206

207207
echo "${!ENV_VAR_NFS_SERVER_THREAD_COUNT:-$DEFAULT_NFS_SERVER_THREAD_COUNT}"
208208
}
209209

210-
get_reqd_mountd_port() {
210+
get_requested_port_mountd() {
211211

212212
echo "${!ENV_VAR_NFS_PORT_MOUNTD:-$DEFAULT_NFS_PORT_MOUNTD}"
213213
}
214214

215-
get_reqd_nfsd_port() {
215+
get_requested_port_nfsd() {
216216

217217
echo "${!ENV_VAR_NFS_PORT:-$DEFAULT_NFS_PORT}"
218218
}
219219

220-
get_reqd_statd_in_port() {
220+
get_requested_port_statd_in() {
221221

222222
echo "${!ENV_VAR_NFS_PORT_STATD_IN:-$DEFAULT_NFS_PORT_STATD_IN}"
223223
}
224224

225-
get_reqd_statd_out_port() {
225+
get_requested_port_statd_out() {
226226

227227
echo "${!ENV_VAR_NFS_PORT_STATD_OUT:-$DEFAULT_NFS_PORT_STATD_OUT}"
228228
}
@@ -276,17 +276,19 @@ assert_port() {
276276

277277
assert_nfs_version() {
278278

279-
get_reqd_nfs_version | grep -Eq '^(3|4|4\.1|4\.2)$'
279+
local -r version="$(get_requested_nfs_version)"
280+
281+
echo "$version" | grep -Eq '^(3|4|4\.1|4\.2)$'
280282
on_failure bail "please set $ENV_VAR_NFS_VERSION to one of: 4.2, 4.1, 4, 3"
281283

282-
if [[ -z "$(is_nfs3_enabled)" && "$(get_reqd_nfs_version)" == '3' ]]; then
284+
if [[ -z "$(is_nfs3_enabled)" && "$version" = '3' ]]; then
283285
bail 'you cannot simultaneously enable and disable NFS version 3'
284286
fi
285287
}
286288

287289
assert_nfsd_threads() {
288290

289-
local -r reqd_thread_count=$(get_reqd_nfsd_threads)
291+
local -r reqd_thread_count=$(get_requested_count_nfsd_threads)
290292

291293
if [[ "$reqd_thread_count" -lt 1 ]]; then
292294
bail "please set $ENV_VAR_NFS_SERVER_THREAD_COUNT to a positive integer"
@@ -433,14 +435,14 @@ boot_helper_mount() {
433435

434436
boot_helper_get_version_flags() {
435437

436-
local -r reqd_version="$(get_reqd_nfs_version)"
438+
local -r reqd_version="$(get_requested_nfs_version)"
437439
local flags=('--nfs-version' "$reqd_version" '--no-nfs-version' 2)
438440

439441
if [[ -z "$(is_nfs3_enabled)" ]]; then
440442
flags+=('--no-nfs-version' 3)
441443
fi
442444

443-
if [[ "$reqd_version" == '3' ]]; then
445+
if [[ "$reqd_version" = '3' ]]; then
444446
flags+=('--no-nfs-version' 4)
445447
fi
446448

@@ -470,7 +472,7 @@ boot_main_mountd() {
470472

471473
local version_flags
472474
read -r -a version_flags <<< "$(boot_helper_get_version_flags)"
473-
local -r port=$(get_reqd_mountd_port)
475+
local -r port=$(get_requested_port_mountd)
474476
local -r args=('--debug' 'all' '--port' "$port" "${version_flags[@]}")
475477

476478
# yes, rpc.mountd is required even for NFS v4: https://forums.gentoo.org/viewtopic-p-7724856.html#7724856
@@ -491,7 +493,7 @@ boot_main_rpcbind() {
491493

492494
boot_main_idmapd() {
493495

494-
if [[ "$(get_reqd_nfs_version)" != '3' && -f "$PATH_FILE_ETC_IDMAPD_CONF" ]]; then
496+
if [[ "$(get_requested_nfs_version)" != '3' && -f "$PATH_FILE_ETC_IDMAPD_CONF" ]]; then
495497
log 'starting idmapd'
496498
$PATH_BIN_IDMAPD -v -S
497499
on_failure stop 'idmapd failed'
@@ -504,8 +506,8 @@ boot_main_statd() {
504506
return
505507
fi
506508

507-
local -r port_in=$(get_reqd_statd_in_port)
508-
local -r port_out=$(get_reqd_statd_out_port)
509+
local -r port_in=$(get_requested_port_statd_in)
510+
local -r port_out=$(get_requested_port_statd_out)
509511
local -r args=('--no-notify' '--port' "$port_in" '--outgoing-port' "$port_out")
510512

511513
log "starting statd on port $port_in (outgoing connections from port $port_out)"
@@ -517,8 +519,8 @@ boot_main_nfsd() {
517519

518520
local version_flags
519521
read -r -a version_flags <<< "$(boot_helper_get_version_flags)"
520-
local -r threads=$(get_reqd_nfsd_threads)
521-
local -r port=$(get_reqd_nfsd_port)
522+
local -r threads=$(get_requested_count_nfsd_threads)
523+
local -r port=$(get_requested_port_nfsd)
522524
local -r args=('--debug' 8 '--port' "$port" "${version_flags[@]}" "$threads")
523525

524526
log "starting rpc.nfsd on port $port with $threads server thread(s)"
@@ -548,7 +550,7 @@ boot_main_svcgssd() {
548550

549551
summarize_nfs_versions() {
550552

551-
local -r reqd_version="$(get_reqd_nfs_version)"
553+
local -r reqd_version="$(get_requested_nfs_version)"
552554
local versions=''
553555

554556
case "$reqd_version" in
@@ -592,16 +594,18 @@ summarize_exports() {
592594

593595
summarize_ports() {
594596

595-
local -r port_nfsd="$(get_reqd_nfsd_port)"
597+
local -r port_nfsd="$(get_requested_port_nfsd)"
598+
local -r port_mountd="$(get_requested_port_mountd)"
599+
local -r port_statd_in="$(get_requested_port_statd_in)"
596600

597601
if [[ -z "$(is_nfs3_enabled)" ]]; then
598602
log "list of container ports that should be exposed: $port_nfsd (TCP)"
599603
else
600604
log 'list of container ports that should be exposed:'
601605
log ' 111 (TCP and UDP)'
602606
log " $port_nfsd (TCP and UDP)"
603-
log " $(get_reqd_statd_in_port) (TCP and UDP)"
604-
log " $(get_reqd_mountd_port) (TCP and UDP)"
607+
log " $port_statd_in (TCP and UDP)"
608+
log " $port_mountd (TCP and UDP)"
605609
fi
606610
}
607611

0 commit comments

Comments
 (0)