File: cloud-init-hotplugd

package info (click to toggle)
cloud-init 25.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,412 kB
  • sloc: python: 135,894; sh: 3,883; makefile: 141; javascript: 30; xml: 22
file content (22 lines) | stat: -rwxr-xr-x 730 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
# This file is part of cloud-init. See LICENSE file for license information.

# This script is used on non-systemd systems. It is called by the
# cloud-init-hotplug init.d script.
#
# Creates a named pipe and then continually listens to this pipe. The pipe
# is written to by the hook-hotplug script (which is called by a udev rule
# upon a network device event). Anything received via the pipe is then
# passed on via the "cloud-init devel hotplug-hook handle" command.

PIPE="/run/cloud-init/share/hook-hotplug-cmd"

[ -p $PIPE ] || mkfifo -m700 $PIPE

while true; do
  # shellcheck disable=SC2162
  if read args < $PIPE; then
    # shellcheck disable=SC2086
    /usr/bin/cloud-init devel hotplug-hook $args
  fi
done