From 95a0f189bfdfdbd448fe33c69d1c67155ffd63bb Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Wed, 27 Feb 2019 11:46:19 -0500 Subject: [PATCH] dracut/30ignition: general hack cleanups We're past the MVP phase now. Let's reflect that in our codebase by dropping all the telltale signs of quick hacks and experimentations. This makes the tree nicer to hack on as well. Remember, all your code are belong to Git. We can always revive things as needed as we get around to supporting Packet/DO, etc... Though those units will need to be tweaked anyway. Closes: #33 --- .../coreos-digitalocean-network.service | 10 ------ .../30ignition/coreos-static-network.service | 13 -------- dracut/30ignition/ignition-generator | 26 +-------------- dracut/30ignition/module-setup.sh | 12 ------- dracut/30ignition/retry-umount.sh | 32 ------------------- dracut/30ignition/sysroot-boot.service | 21 ------------ 6 files changed, 1 insertion(+), 113 deletions(-) delete mode 100644 dracut/30ignition/coreos-digitalocean-network.service delete mode 100644 dracut/30ignition/coreos-static-network.service delete mode 100755 dracut/30ignition/retry-umount.sh delete mode 100644 dracut/30ignition/sysroot-boot.service diff --git a/dracut/30ignition/coreos-digitalocean-network.service b/dracut/30ignition/coreos-digitalocean-network.service deleted file mode 100644 index a06bdac..0000000 --- a/dracut/30ignition/coreos-digitalocean-network.service +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=CoreOS DigitalOcean Network Agent -DefaultDependencies=false -Before=initrd.target -After=systemd-networkd.service initrd-root-fs.target -Wants=systemd-networkd.service initrd-root-fs.target - -[Service] -Type=oneshot -ExecStart=/usr/bin/coreos-metadata --cmdline --network-units=/run/systemd/network/ --hostname=/sysroot/etc/hostname diff --git a/dracut/30ignition/coreos-static-network.service b/dracut/30ignition/coreos-static-network.service deleted file mode 100644 index a738b1b..0000000 --- a/dracut/30ignition/coreos-static-network.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=CoreOS Static Network Agent -DefaultDependencies=false -Before=initrd.target -After=systemd-networkd.service initrd-root-fs.target -Wants=systemd-networkd.service initrd-root-fs.target - -# Ensure Ignition can overwrite /etc/hostname -Before=ignition-files.service - -[Service] -Type=oneshot -ExecStart=/usr/bin/coreos-metadata --cmdline --network-units=/sysroot/etc/systemd/network/ --hostname=/sysroot/etc/hostname diff --git a/dracut/30ignition/ignition-generator b/dracut/30ignition/ignition-generator index 6353804..1a0c404 100755 --- a/dracut/30ignition/ignition-generator +++ b/dracut/30ignition/ignition-generator @@ -36,27 +36,12 @@ add_requires() { } # This can't be done with ConditionKernelCommandLine because that always -# starts the unit's dependencies. We want to start networkd only on first +# starts the unit's dependencies. We want to start networking only on first # boot. if $(cmdline_bool 'ignition.firstboot' 0); then add_requires ignition-disks.service add_requires ignition-files.service add_requires ignition-ask-var-mount.service - #if [[ $platform_id == "packet" ]]; then - # add_requires coreos-static-network.service - #fi - - # On EC2, shut down systemd-networkd if ignition fails so that the instance - # fails EC2 instance checks. - #if [[ $platform_id == "ec2" ]]; then - # mkdir -p ${UNIT_DIR}/systemd-networkd.service.d - # cat > ${UNIT_DIR}/systemd-networkd.service.d/10-conflict-emergency.conf < /run/ignition.env diff --git a/dracut/30ignition/module-setup.sh b/dracut/30ignition/module-setup.sh index 4b1c1aa..ce0359e 100755 --- a/dracut/30ignition/module-setup.sh +++ b/dracut/30ignition/module-setup.sh @@ -29,9 +29,6 @@ install() { inst_script "$moddir/ignition-setup.sh" \ "/usr/sbin/ignition-setup" -# inst_script "$moddir/retry-umount.sh" \ -# "/usr/sbin/retry-umount" - inst_simple "$moddir/ignition-generator" \ "$systemdutildir/system-generators/ignition-generator" @@ -46,15 +43,6 @@ install() { inst_simple "$moddir/ignition-remount-sysroot.service" \ "$systemdutildir/system/ignition-remount-sysroot.service" - -# inst_simple "$moddir/sysroot-boot.service" \ -# "$systemdsystemunitdir/sysroot-boot.service" - -# inst_simple "$moddir/coreos-digitalocean-network.service" \ -# "$systemdsystemunitdir/coreos-digitalocean-network.service" - -# inst_simple "$moddir/coreos-static-network.service" \ -# "$systemdsystemunitdir/coreos-static-network.service" } has_builtin_fw_cfg() { diff --git a/dracut/30ignition/retry-umount.sh b/dracut/30ignition/retry-umount.sh deleted file mode 100755 index 4a62b33..0000000 --- a/dracut/30ignition/retry-umount.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# Unmount $1, retrying a few times. - -set -e - -mp="$1" -if [ -z "$mp" ] ; then - echo "Usage: $0 " - exit 1 -fi - -if ! mountpoint -q "$mp"; then - exit 0 -fi - -tries=5 -while true; do - umount "$mp" ||: - # Apparently umount may return failure when it actually succeeded - if ! mountpoint -q "$mp"; then - exit 0 - fi - - tries=$(( $tries - 1 )) - if [[ $tries = 0 ]]; then - echo "Giving up." >&2 - exit 1 - fi - - echo "Couldn't unmount $mp; retrying..." >&2 - sleep 1 -done diff --git a/dracut/30ignition/sysroot-boot.service b/dracut/30ignition/sysroot-boot.service deleted file mode 100644 index cdeca18..0000000 --- a/dracut/30ignition/sysroot-boot.service +++ /dev/null @@ -1,21 +0,0 @@ -[Unit] -Description=/sysroot/boot -DefaultDependencies=false - -BindsTo=dev-disk-by\x2dlabel-EFI\x2dSYSTEM.device -After=dev-disk-by\x2dlabel-EFI\x2dSYSTEM.device - -RequiresMountsFor=/sysroot - -# Creates mountpoint -Requires=initrd-setup-root.service -After=initrd-setup-root.service - -Conflicts=dracut-emergency.service emergency.service emergency.target -Conflicts=initrd-switch-root.target umount.target - -[Service] -Type=oneshot -RemainAfterExit=true -ExecStart=/usr/bin/mount /dev/disk/by-label/EFI-SYSTEM /sysroot/boot -ExecStop=/usr/sbin/retry-umount /sysroot/boot