This file is indexed.

/usr/share/initramfs-tools/scripts/local-top/nbd is in nbd-client 1:3.7-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
#!/bin/sh

# We don't have any prerequisites
case $1 in
prereqs)
	exit 0
	;;
esac

for x in $(cat /proc/cmdline); do
	case "$x" in
		nbddev=*)
			nbddev="${x#nbddev=}"
			;;
		nbdroot=*)
			nbdroot="${x#nbdroot=}"
			;;
		root=/dev/nbd*)
			nbddev="${x#root=}"
			;;
	esac
done

# if nbd root is not requested exit early and silently
if [ -z "$nbdroot" ] && [ -z "$nbddev" ]
then
	exit 0
fi

. /scripts/functions

log_begin_msg "Setting up nbd-client"

wait_for_udev
configure_networking

# Support setting stuff using DHCP by overloading 'option root-path'
case "$nbdroot" in
	''|dhcp)
		nbdroot=$ROOTPATH
		;;
esac

nbdrootdev="$nbddev"
nbdbasedev="${nbddev#/dev/}"

case "$nbdroot" in
	*,*,*)
		nbdsrv="${nbdroot%%,*}"
		nbdport="${nbdroot%,*}"
		nbdport="${nbdport##*,}"
		# root= parameter overrides three-option nbdroot= parameter
		if [ -z "$nbdrootdev" ]
		then
			nbdbasedev="${nbdroot##*,}"
			nbdrootdev=/dev/$nbdbasedev
		fi
		;;
	*,*)
		nbdsrv="${nbdroot%,*}"
		nbdport="${nbdroot#*,}"
		;;
	\[*\]*)
		# [ipv6]:port/path
		nbdsrv=${nbdroot%\]*}
		nbdsrv=${nbdsrv#\[}
		nbdportpath=${nbdroot#\[$nbdsrv\]}
		nbdportpath=${nbdportpath#:}
		nbdport=${nbdportpath%%/*}
		nbdpath=${nbdportpath#$nbdport}
		;;
	*)
		# ipv4:port/path
		nbdsrv=${nbdroot%%[:/]*}
		nbdportpath=${nbdroot#$nbdsrv}
		nbdportpath=${nbdportpath#:}
		nbdport=${nbdportpath%%/*}
		nbdpath=${nbdportpath#$nbdport}
		;;
esac

case "$nbdport" in
	*[^0-9]*)
		# non-numeric characters, assume a name rather than a port
		nbdpath="$nbdport"
		unset nbdport
		;;
esac

nbdrootdev=${nbdrootdev%p*}
nbdbasedev=${nbdbasedev%p*}
# If host is omitted, use ROOTSERVER from DHCP.
case "$nbdsrv" in
	''|dhcp)
		nbdsrv=$ROOTSERVER
		;;
esac

if [ -z "$nbdsrv" ] || [ -z "$nbdrootdev" ] || ( [ -z "$nbdpath" ] && [ -z "$nbdport" ] )
then
	log_failure_msg "Insufficient information to set up nbd, quitting (nbdroot=$nbdroot, host=$nbdsrv, name=$nbdpath, port=$nbdport, nbd-device=$nbdrootdev)"
	exit 0
fi

# Support defining an alternate launch script with env variable NBDCLIENT.
NBDCLIENT=${NBDCLIENT:-/sbin/nbd-client}
$NBDCLIENT $nbdsrv ${nbdpath:+-N} $nbdpath $nbdport $nbdrootdev -swap -persist

# This should be removed once the cfq scheduler no longer deadlocks nbd
# devices
if grep -q '\[cfq\]' /sys/block/$nbdbasedev/queue/scheduler
then
	echo deadline > /sys/block/$nbdbasedev/queue/scheduler
fi