File: inetd

package info (click to toggle)
unit-translator 0.8-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 632 kB
  • sloc: sh: 909; makefile: 28
file content (25 lines) | stat: -rw-r--r-- 746 bytes parent folder | download | duplicates (2)
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
# inetd output backend
# shellcheck shell=bash

export_inetd() {
	systemd_unit=$1
	base_dir=$2

	if [[ "${socket[ListenStream]:-}" ]]; then
		port="${socket[ListenStream]}"
		type="stream"
		proto="tcp"
		flags="wait"
	elif [[ "${socket[ListenDatagram]:-}" ]]; then
		port="${socket[ListenDatagram]}"
		type="dgram"
		proto="udp"
		flags="nowait"
	elif [[ "${socket[ListenSequentialPackets]:-}" ]]; then
	     	echo "Sequential Packets not supported by inetd backend" >&2
		exit 1
	fi
	# <service_name> <sock_type> <proto> <flags> <user> <server_path> <args>
	printf 'Run "update-inetd --add '
	printf "'%s %s %s %s %s %s %s'\n" "$port" "$type" "$proto" "$flags" "${service[User]:-root}" "${service[ExecStart]// */}" "${service[ExecStart]#* }"
}