This file is indexed.

postinst is in udev 237-3ubuntu10.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/bin/sh -e

chrooted() {
  if [ "$(stat -c %d/%i /)" = "$(stat -Lc %d/%i /proc/1/root 2>/dev/null)" ];
  then
    # the devicenumber/inode pair of / is the same as that of /sbin/init's
    # root, so we're *not* in a chroot and hence return false.
    return 1
  fi
  echo "A chroot environment has been detected, udev not started."
  return 0
}

in_debootstrap() {
  # debootstrap --second-stage may be run in an emulator instead of a chroot,
  # we need to check for this special case because start-stop-daemon would
  # not be available. (#520742)
  if [ -d /debootstrap/ ]; then
    echo "Being installed by debootstrap, udev not started."
    return 0
  fi
  return 1
} 

can_start_udevd() {
  if [ ! -d /sys/class/ ]; then
    echo "udev requires a mounted sysfs, not started."
    return 1
  fi
  return 0
}

enable_udev() {
  can_start_udevd || return 0
  invoke-rc.d udev start
}

update_initramfs() {
  [ -x /usr/sbin/update-initramfs -a -e /etc/initramfs-tools/initramfs.conf ] \
    || return 0
  update-initramfs -u
}

upgrade_fixes() {
  if dpkg --compare-versions "$2" lt "226-1"; then
    update-rc.d udev-finish remove
  fi

  # we enabled net.ifnames in 220-7 by default; don't change iface names in
  # virtualized envs (where 75-persistent-net-generator.rules didn't work)
  if dpkg --compare-versions "$2" lt-nl "220-7~" &&
     [ ! -e /etc/udev/rules.d/70-persistent-net.rules ] &&
     [ ! -e /etc/udev/rules.d/80-net-setup-link.rules ] &&
     [ ! -e /etc/systemd/network/99-default.link ] &&
     [ ! -L /etc/systemd/network/99-default.link ] &&
     ! grep -q net.ifnames /proc/cmdline && ! chrooted; then
    mkdir -p /etc/systemd/network
    cat <<EOF > /etc/systemd/network/99-default.link
# This machine is most likely a virtualized guest, where the old persistent
# network interface mechanism (75-persistent-net-generator.rules) did not work.
# This file disables /lib/systemd/network/99-default.link to avoid
# changing network interface names on upgrade. Please read
# /usr/share/doc/udev/README.Debian.gz about how to migrate to the currently
# supported mechanism.
EOF
  fi

  # 226 introduced predictable interface names for virtio
  # (https://github.com/systemd/systemd/pull/1119); disable for upgrades
  if dpkg --compare-versions "$2" lt-nl "226-2~" &&
      [ ! -e /etc/systemd/network/50-virtio-kernel-names.link ] &&
      ls -d /sys/bus/virtio/drivers/virtio_net/virt* >/dev/null 2>&1; then
    echo "virtio network devices detected, disabling predictable interface names in /etc/systemd/network/50-virtio-kernel-names.link"
    mkdir -p /etc/systemd/network/
    cat <<EOF > /etc/systemd/network/50-virtio-kernel-names.link
# udev 226 introduced predictable interface names for virtio;
# disable this for upgrades. You can remove this file if you update your
# network configuration to move to the ens* names instead.
# See /usr/share/doc/udev/README.Debian.gz for details about predictable
# network interface names.
[Match]
Driver=virtio_net

[Link]
NamePolicy=onboard kernel
EOF
  fi

  # 232-20 (232-21ubuntu3 in ubuntu) introduced predicable interface names on
  # s390x for virtio However, we should preserve ethX names on upgrade.
  if [ -x /usr/share/systemd/write_persistent_net_s390x_virtio ]; then
      if dpkg --compare-versions "$2" lt-nl "232-21ubuntu3~"; then
          /usr/share/systemd/write_persistent_net_s390x_virtio || true
      fi
  fi
}

update_hwdb() {
  systemd-hwdb --usr update || true
}

case "$1" in
    configure)
    # update/create hwdb before we (re)start udev
    update_hwdb

    # Add new system group used by udev rules
    addgroup --quiet --system input

    if [ -z "$2" ]; then # first install
      if ! chrooted && ! in_debootstrap; then
	enable_udev
      fi
    else # upgrades
      upgrade_fixes "$@"
      if ! chrooted; then
	if can_start_udevd; then
	  if [ -d /run/systemd/system ] ; then
	    systemctl daemon-reload || true
	  fi
	  invoke-rc.d udev restart
	fi
      fi
    fi

    update_initramfs
    ;;

    triggered)
    update_hwdb
    exit 0
    ;;
esac

# Automatically added by dh_installdeb/11.1.6ubuntu1
dpkg-maintscript-helper rm_conffile /etc/init.d/udev-finish 226-1\~ -- "$@"
dpkg-maintscript-helper rm_conffile /etc/init/udev-finish.conf 226-1\~ -- "$@"
dpkg-maintscript-helper rm_conffile /etc/init/udev-fallback-graphics.conf 226-1\~ -- "$@"
dpkg-maintscript-helper symlink_to_dir /usr/share/doc/udev libudev1 221-2\~ -- "$@"
dpkg-maintscript-helper rm_conffile /etc/modprobe.d/fbdev-blacklist.conf 229-6\~ -- "$@"
dpkg-maintscript-helper rm_conffile /etc/init/udev.conf 233-1\~ -- "$@"
dpkg-maintscript-helper rm_conffile /etc/init/udevmonitor.conf 233-1\~ -- "$@"
dpkg-maintscript-helper rm_conffile /etc/init/udevtrigger.conf 233-1\~ -- "$@"
# End automatically added section
# Automatically added by dh_installinit/11.1.6ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	if [ -x "/etc/init.d/udev" ]; then
		update-rc.d udev defaults >/dev/null || exit 1
	fi
fi
# End automatically added section