Debian Codegraph @

dracut/30ignition/ignition-generator

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
3 # ex: ts=8 sw=4 sts=4 et filetype=sh
4
5 set -e
6
7 # Generators don't have logging right now
8 # https://github.com/systemd/systemd/issues/15638
9 exec 1>/dev/kmsgscip-shell filesystem . . `/dev/kmsg`.; exec 2>&1
10
11 UNIT_DIR="${1:-/tmp}"
12
13 cmdline=( $(</proc/cmdlinscip-shell filesystem . . `/proc/cmdline`.e) )
14 cmdline_argscip-shell shell shell-project 0.0.0 cmdline_arg().() {
15 local name="$1" value="$2"
16 for arg in "${cmdline[@]}"; do
17 if [[ "${arg%%=*}" == "${name}" ]]; then
18 value="${arg#*=}"
19 fi
20 done
21 echoscip-shell system . . echo. "${value}"
22 }
23
24 cmdline_boolscip-shell shell shell-project 0.0.0 cmdline_bool().() {
25 local value=$(cmdline_argscip-shell shell shell-project 0.0.0 cmdline_arg(). "$@")
26 case "$value" in
27 ""|0|no|off) return 1;;
28 *) return 0;;
29 esac
30 }
31
32 add_requiresscip-shell shell shell-project 0.0.0 add_requires().() {
33 local name="$1"; shift
34 local target="$1"; shift
35 local requires_dir="${UNIT_DIR}/${target}.requires"
36 mkdirscip-shell system . . mkdir. -p "${requires_dir}"
37 lnscip-shell system . . ln. -sf "../${name}" "${requires_dir}/${name}"
38 }
39
40 # This can't be done with ConditionKernelCommandLine because that always
41 # starts the unit's dependencies. We want to start networking only on first
42 # boot.
43 if $(cmdline_boolscip-shell shell shell-project 0.0.0 cmdline_bool(). 'ignition.firstboot' 0); then
44 add_requiresscip-shell shell shell-project 0.0.0 add_requires(). ignition-complete.target initrd.target
45
46 # Invoke distro hook for detecting whether we're booted from a live image,
47 # and therefore won't have a root disk.
48 if ! command -v is-live-image >/dev/nullscip-shell filesystem . . `/dev/null`. || ! is-live-image; then
49 add_requiresscip-shell shell shell-project 0.0.0 add_requires(). ignition-diskful.target ignition-complete.target
50 fi
51 else
52 # If we're doing a non-Ignition (subsequent) boot, then
53 # queue a different target. This is necessary so that units
54 # like `ignition-ostree-mount-sysroot.service`
55 # can cleanly distinguish between the two.
56 add_requiresscip-shell shell shell-project 0.0.0 add_requires(). ignition-subsequent.target initrd.target
57 if ! command -v is-live-image >/dev/nullscip-shell filesystem . . `/dev/null`. || ! is-live-image; then
58 add_requiresscip-shell shell shell-project 0.0.0 add_requires(). ignition-diskful-subsequent.target ignition-subsequent.target
59 fi
60 fi
61
62 echoscip-shell system . . echo. "PLATFORM_ID=$(cmdline_argscip-shell shell shell-project 0.0.0 cmdline_arg(). ignition.platform.id)" > /run/ignition.envscip-shell filesystem . . `/run/ignition.env`.