forked from openSUSE/suse-module-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
udev-trigger-generator
32 lines (29 loc) · 1011 Bytes
/
udev-trigger-generator
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
#! /bin/bash
# Copyright (c) 2020 SUSE LLC
# SPDX-License-Identifier: GPL-2.0-or-later
#
# bsc#1174287: On PowerPC, exclude memory devices from udev coldplug
#
# This generator creates a drop-in for systemd-udev-trigger.service
# that overrides the default action, skipping coldplug for memory devices.
export PATH=/usr/bin
# /tmp may not be writable yet. Use a different TMPDIR that's guaranteed
# to be writable. Needed for the "here-document" below.
export TMPDIR=/dev/shm
trap 'echo $0: error in "$BASH_COMMAND" >&2' ERR
[[ $(uname -m) = ppc64le ]] || [[ $(uname -m) = ppc64 ]] || exit 0
case $(systemd-detect-virt) in
none|powervm) ;;
*) exit 0;;
esac
DIR=$1
[[ $DIR && -d "$DIR" ]]
DROPIN="$DIR/systemd-udev-trigger.service.d"
mkdir -p "$DROPIN"
cat >"$DROPIN/30-skip-memory-devices.conf" <<EOF
# generated by $0
[Service]
ExecStart=
ExecStart=/usr/bin/udevadm trigger --type=subsystems --action=add
ExecStart=/usr/bin/udevadm trigger --type=devices --action=add --subsystem-nomatch=memory
EOF