Skip to content
This repository has been archived by the owner on Aug 25, 2021. It is now read-only.

Commit

Permalink
dracut/30ignition: support coreos.no_persist_ip
Browse files Browse the repository at this point in the history
When `coreos.no_persist_ip` is not specified in a true value persist
ifcfg files created by the `write-ifcfg.sh` script run as part of the
dracut `45ifcfg` module to the real root.
  • Loading branch information
arithx committed Jul 19, 2019
1 parent 9f9d731 commit ec81125
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
2 changes: 2 additions & 0 deletions dracut/30ignition/module-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ install() {

# needed for openstack config drive support
inst_rules 60-cdrom_id.rules

inst_hook pre-pivot 90 "$moddir/persist-ifcfg.sh"
}

has_fw_cfg_module() {
Expand Down
30 changes: 30 additions & 0 deletions dracut/30ignition/persist-ifcfg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

set -e

cmdline=( $(</proc/cmdline) )

cmdline_arg() {
local name="$1" value="$2"
for arg in "${cmdline[@]}"; do
if [[ "${arg%%=*}" == "${name}" ]]; then
value="${arg#*=}"
fi
done
echo "${value}"
}

cmdline_bool() {
local value=$(cmdline_arg "$@")
case "$value" in
""|0|no|off) return 1;;
*) return 0;;
esac
}

if ! $(cmdline_bool 'coreos.no_persist_ip' 0); then
cp /tmp/ifcfg/* /sysroot/etc/sysconfig/network-scripts/
fi

2 changes: 1 addition & 1 deletion grub/02_ignition_firstboot
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ if [ -f "(${bootpart})/ignition.firstboot" ]; then
source "(${bootpart})/ignition.firstboot"

# we support setting variables in the
set ignition_firstboot="ignition.firstboot $ignition_network_kcmdline"
set ignition_firstboot="ignition.firstboot $ignition_network_kcmdline $ignition_extra_kcmdline"
fi

0 comments on commit ec81125

Please sign in to comment.