@@ -257,22 +257,22 @@ assert_file_provided() {
257
257
258
258
assert_kernel_mod () {
259
259
260
- local -r moduleName =$1
260
+ local -r module =$1
261
261
262
- log " checking for presence of kernel module: $moduleName "
262
+ log " checking for presence of kernel module: $module "
263
263
264
- lsmod | grep -Eq " ^$moduleName \\ s+" || [ -d " /sys/module/$moduleName " ]
264
+ lsmod | grep -Eq " ^$module \\ s+" || [ -d " /sys/module/$module " ]
265
265
266
- on_failure bail " $moduleName module is not loaded in the Docker host's kernel (try: modprobe $moduleName )"
266
+ on_failure bail " $module module is not loaded in the Docker host's kernel (try: modprobe $module )"
267
267
}
268
268
269
269
assert_port () {
270
270
271
- local -r envName =$1
272
- local -r value=${! envName }
271
+ local -r variable_name =$1
272
+ local -r value=${! variable_name }
273
273
274
274
if [[ -n " $value " && ( " $value " -lt 1 || " $value " -gt 65535 ) ]]; then
275
- bail " please set $1 to an integer between 1 and 65535 inclusive"
275
+ bail " please set $variable_name to an integer between 1 and 65535 inclusive"
276
276
fi
277
277
}
278
278
@@ -291,9 +291,9 @@ assert_disabled_nfs3() {
291
291
292
292
assert_nfsd_threads () {
293
293
294
- local -r requested =$( get_reqd_nfsd_threads)
294
+ local -r reqd_thread_count =$( get_reqd_nfsd_threads)
295
295
296
- if [[ " $requested " -lt 1 ]]; then
296
+ if [[ " $reqd_thread_count " -lt 1 ]]; then
297
297
bail " please set $ENV_VAR_NFS_SERVER_THREAD_COUNT to a positive integer"
298
298
fi
299
299
}
@@ -334,46 +334,47 @@ init_exports() {
334
334
return
335
335
fi
336
336
337
- local collected =0
337
+ local count_valid_exports =0
338
338
local exports=' '
339
- local candidateExportVariables
339
+ local candidate_export_vars
340
+ local candidate_export_var
340
341
341
- candidateExportVariables =$( compgen -A variable | grep -E ' NFS_EXPORT_[0-9]+' | sort)
342
+ candidate_export_vars =$( compgen -A variable | grep -E ' NFS_EXPORT_[0-9]+' | sort)
342
343
on_failure bail ' failed to detect NFS_EXPORT_* variables'
343
344
344
- if [[ -z " $candidateExportVariables " ]]; then
345
+ if [[ -z " $candidate_export_vars " ]]; then
345
346
bail " please provide $PATH_FILE_ETC_EXPORTS to the container or set at least one NFS_EXPORT_* environment variable"
346
347
fi
347
348
348
349
log " building $PATH_FILE_ETC_EXPORTS from environment variables"
349
350
350
- for exportVariable in $candidateExportVariables ; do
351
+ for candidate_export_var in $candidate_export_vars ; do
351
352
352
- local line=${! exportVariable }
353
- local lineAsArray
354
- read -r -a lineAsArray <<< " $line"
355
- local dir=" ${lineAsArray [0]} "
353
+ local line=${! candidate_export_var }
354
+ local line_as_array
355
+ read -r -a line_as_array <<< " $line"
356
+ local dir=" ${line_as_array [0]} "
356
357
357
358
if [[ ! -d " $dir " ]]; then
358
- log_warning " skipping $exportVariable since $dir is not a container directory"
359
+ log_warning " skipping $candidate_export_var since $dir is not a container directory"
359
360
continue
360
361
fi
361
362
362
363
log " will export $line "
363
364
364
- if [[ $collected -gt 0 ]]; then
365
+ if [[ $count_valid_exports -gt 0 ]]; then
365
366
exports=$exports $' \n '
366
367
fi
367
368
368
369
exports=$exports$line
369
370
370
- (( collected ++ ))
371
+ (( count_valid_exports ++ ))
371
372
372
373
done
373
374
374
- log " collected $collected valid export(s) from NFS_EXPORT_* environment variables"
375
+ log " collected $count_valid_exports valid export(s) from NFS_EXPORT_* environment variables"
375
376
376
- if [[ $collected -eq 0 ]]; then
377
+ if [[ $count_valid_exports -eq 0 ]]; then
377
378
bail ' no valid exports'
378
379
fi
379
380
@@ -426,18 +427,18 @@ boot_helper_mount() {
426
427
427
428
boot_helper_get_version_flags () {
428
429
429
- local -r requestedVersion =" $( get_reqd_nfs_version) "
430
- local versionFlags =(' --nfs-version' " $requestedVersion " ' --no-nfs-version' 2)
430
+ local -r reqd_version =" $( get_reqd_nfs_version) "
431
+ local flags =(' --nfs-version' " $reqd_version " ' --no-nfs-version' 2)
431
432
432
433
if [[ -z " $( is_nfs3_enabled) " ]]; then
433
- versionFlags +=(' --no-nfs-version' 3)
434
+ flags +=(' --no-nfs-version' 3)
434
435
fi
435
436
436
- if [[ " $requestedVersion " == ' 3' ]]; then
437
- versionFlags +=(' --no-nfs-version' 4)
437
+ if [[ " $reqd_version " == ' 3' ]]; then
438
+ flags +=(' --no-nfs-version' 4)
438
439
fi
439
440
440
- echo " ${versionFlags [@]} "
441
+ echo " ${flags [@]} "
441
442
}
442
443
443
444
@@ -461,10 +462,10 @@ boot_main_exportfs() {
461
462
462
463
boot_main_mountd () {
463
464
464
- local versionFlags
465
- read -r -a versionFlags <<< " $(boot_helper_get_version_flags)"
465
+ local version_flags
466
+ read -r -a version_flags <<< " $(boot_helper_get_version_flags)"
466
467
local -r port=$( get_reqd_mountd_port)
467
- local -r args=(' --debug' ' all' ' --port' " $port " " ${versionFlags [@]} " )
468
+ local -r args=(' --debug' ' all' ' --port' " $port " " ${version_flags [@]} " )
468
469
469
470
# yes, rpc.mountd is required even for NFS v4: https://forums.gentoo.org/viewtopic-p-7724856.html#7724856
470
471
log " starting rpc.mountd on port $port "
@@ -497,22 +498,22 @@ boot_main_statd() {
497
498
return
498
499
fi
499
500
500
- local -r inPort =$( get_reqd_statd_in_port)
501
- local -r outPort =$( get_reqd_statd_out_port)
502
- local -r args=(' --no-notify' ' --port' " $inPort " ' --outgoing-port' " $outPort " )
501
+ local -r port_in =$( get_reqd_statd_in_port)
502
+ local -r port_out =$( get_reqd_statd_out_port)
503
+ local -r args=(' --no-notify' ' --port' " $port_in " ' --outgoing-port' " $port_out " )
503
504
504
- log " starting statd on port $inPort (outgoing connections from port $outPort )"
505
+ log " starting statd on port $port_in (outgoing connections from port $port_out )"
505
506
$PATH_BIN_STATD " ${args[@]} "
506
507
on_failure stop ' statd failed'
507
508
}
508
509
509
510
boot_main_nfsd () {
510
511
511
- local versionFlags
512
- read -r -a versionFlags <<< " $(boot_helper_get_version_flags)"
512
+ local version_flags
513
+ read -r -a version_flags <<< " $(boot_helper_get_version_flags)"
513
514
local -r threads=$( get_reqd_nfsd_threads)
514
515
local -r port=$( get_reqd_nfsd_port)
515
- local -r args=(' --debug' 8 ' --port' " $port " " ${versionFlags [@]} " " $threads " )
516
+ local -r args=(' --debug' 8 ' --port' " $port " " ${version_flags [@]} " " $threads " )
516
517
517
518
log " starting rpc.nfsd on port $port with $threads server thread(s)"
518
519
$PATH_BIN_NFSD " ${args[@]} "
@@ -577,14 +578,14 @@ summarize_exports() {
577
578
578
579
summarize_ports () {
579
580
580
- local -r nfsdPort =" $( get_reqd_nfsd_port) "
581
+ local -r port_nfsd =" $( get_reqd_nfsd_port) "
581
582
582
583
if [[ -z " $( is_nfs3_enabled) " ]]; then
583
- log " list of container ports that should be exposed: $nfsdPort (TCP)"
584
+ log " list of container ports that should be exposed: $port_nfsd (TCP)"
584
585
else
585
586
log ' list of container ports that should be exposed:'
586
587
log ' 111 (TCP and UDP)'
587
- log " $nfsdPort (TCP and UDP)"
588
+ log " $port_nfsd (TCP and UDP)"
588
589
log " $( get_reqd_statd_in_port) (TCP and UDP)"
589
590
log " $( get_reqd_mountd_port) (TCP and UDP)"
590
591
fi
0 commit comments