Repository: moby/moby
File: contrib/dockerd-rootless-setuptool.sh (Shell)

Code before:
					# Install newuidmap & newgidmap binaries
					dnf install -y shadow-utils
				EOI
			)
		elif command -v yum > /dev/null 2>&1; then
			instructions=$(
				cat <<- EOI
					${instructions}
					# Install newuidmap & newgidmap binaries
					yum install -y shadow-utils
				EOI
			)
		else
			ERROR "newuidmap binary not found. Please install with a package manager."
			exit 1
		fi
	fi

	# instruction: iptables dependency check
	faced_iptables_error=""
	iptables_command=$(PATH=$PATH:/sbin:/usr/sbin command -v iptables 2> /dev/null) || :
	iptables_version=""
	if [ -n "$iptables_command" ]; then
		iptables_version=$($iptables_command --version 2> /dev/null) || :
	else
		faced_iptables_error=1
		if [ -z "$OPT_SKIP_IPTABLES" ]; then
			if command -v apt-get > /dev/null 2>&1; then
				instructions=$(
					cat <<- EOI
						${instructions}
						# Install iptables
						apt-get install -y iptables
					EOI
				)
			elif command -v dnf > /dev/null 2>&1; then
				instructions=$(
					cat <<- EOI
						${instructions}
						# Install iptables
						dnf install -y iptables
					EOI
				)
			elif command -v yum > /dev/null 2>&1; then
				instructions=$(
					cat <<- EOI
						${instructions}
						# Install iptables
						yum install -y iptables
					EOI
				)

Review comment (suggestion):
Actually; so `iptables_version` is only used to set `iptables_module`, correct? In that case, we could just put all here? Or won't that work?

```suggestion
	# Many OSs now use iptables-nft by default so, check for module nf_tables by default. But,
	# if "iptables --version" worked and reported "legacy", check for module ip_tables instead.
	iptables_module="nf_tables"
	iptables_command=$(PATH=$PATH:/sbin:/usr/sbin command -v iptables 2> /dev/null) || :
	if [ -n "$iptables_command" ]; then
		iptables_version=$($iptables_command --version 2> /dev/null) || :
		case $iptables_version in
			*legacy*) iptables_module="ip_tables" ;;
		esac
```

Code after:
					# Install newuidmap & newgidmap binaries
					dnf install -y shadow-utils
				EOI
			)
		elif command -v yum > /dev/null 2>&1; then
			instructions=$(
				cat <<- EOI
					${instructions}
					# Install newuidmap & newgidmap binaries
					yum install -y shadow-utils
				EOI
			)
		else
			ERROR "newuidmap binary not found. Please install with a package manager."
			exit 1
		fi
	fi

	# instruction: iptables dependency check
	faced_iptables_error=""
	# Many OSs now use iptables-nft by default so, check for module nf_tables by default. But,
	# if "iptables --version" worked and reported "legacy", check for module ip_tables instead.
	iptables_module="nf_tables"
	iptables_command=$(PATH=$PATH:/sbin:/usr/sbin command -v iptables 2> /dev/null) || :
	if [ -n "$iptables_command" ]; then
		iptables_version=$($iptables_command --version 2> /dev/null) || :
		case $iptables_version in
			*legacy*) iptables_module="ip_tables" ;;
		esac
		faced_iptables_error=1
		if [ -z "$OPT_SKIP_IPTABLES" ]; then
			if command -v apt-get > /dev/null 2>&1; then
				instructions=$(
					cat <<- EOI
						${instructions}
						# Install iptables
						apt-get install -y iptables
					EOI
				)
			elif command -v dnf > /dev/null 2>&1; then
				instructions=$(
					cat <<- EOI
						${instructions}
						# Install iptables
						dnf install -y iptables
					EOI
				)
			elif command -v yum > /dev/null 2>&1; then
				instructions=$(
					cat <<- EOI
						${instructions}