From 33daa08b99d993b40190ef59ae8f1ae81b8bd379 Mon Sep 17 00:00:00 2001
From: Timothée Ravier <tim@siosm.fr>
Date: Oct 20 2021 15:06:32 +0000
Subject: [PATCH 1/6] Remove fedora-iot-rawhide.tdl


---

diff --git a/fedora-iot-rawhide.tdl b/fedora-iot-rawhide.tdl
deleted file mode 100644
index 8ad38cb..0000000
--- a/fedora-iot-rawhide.tdl
+++ /dev/null
@@ -1,13 +0,0 @@
-<template>
-    <name>rawhide</name>
-    <os>
-        <name>Fedora</name>
-        <version>20</version>
-        <arch>x86_64</arch>
-        <install type='url'>
-            <url>http://dl.fedoraproject.org/pub/fedora/linux/development/22/x86_64/os/</url>
-        </install>
-        <rootpw>ewwwwwww</rootpw>
-    </os>
-</template>
-

From 093ddd6c5588a3d87f897e05f61c0bd7b51a303e Mon Sep 17 00:00:00 2001
From: Timothée Ravier <tim@siosm.fr>
Date: Oct 20 2021 15:06:32 +0000
Subject: [PATCH 2/6] Remove fedora-iot.spec


Support for jigdo/rojig was dropped from rpm-ostree.

See:
- https://github.com/coreos/rpm-ostree/pull/2841
- https://github.com/coreos/rpm-ostree/pull/2842

---

diff --git a/fedora-iot.spec b/fedora-iot.spec
deleted file mode 100644
index f8b12a5..0000000
--- a/fedora-iot.spec
+++ /dev/null
@@ -1,22 +0,0 @@
-# Suppress most build root processing since we are just carrying binary data
-%global __os_install_post /usr/lib/rpm/brp-compress %{nil}
-Name: fedora-iot
-Version:	%{ostree_version}
-Release:	1%{?dist}
-Summary:	Image (rpm-ostree jigdo) for Fedora IoT
-License:	MIT
-#@@@rpmostree_jigdo_meta@@@
-
-%description
-%{summary}
-
-%prep
-
-%build
-
-%install
-mkdir -p %{buildroot}%{_prefix}/lib/ostree-jigdo/%{name}
-for x in *; do mv ${x} %{buildroot}%{_prefix}/lib/ostree-jigdo/%{name}; done
-
-%files
-%{_prefix}/lib/ostree-jigdo/%{name}

From 147f9b151c5aa43b99d2a682a060b63e54159588 Mon Sep 17 00:00:00 2001
From: Timothée Ravier <tim@siosm.fr>
Date: Oct 20 2021 15:07:46 +0000
Subject: [PATCH 3/6] Convert treefiles to YAML


---

diff --git a/fedora-iot-base.json b/fedora-iot-base.json
deleted file mode 100644
index e7b83b4..0000000
--- a/fedora-iot-base.json
+++ /dev/null
@@ -1,135 +0,0 @@
-{
-    "ref": "fedora/rawhide/${basearch}/iot",
-    "ex-jigdo-spec": "fedora-iot.spec",
-
-    "repos": [],
-
-    "selinux": true,
-
-    "recommends": false,
-
-    "documentation": false,
-
-    "automatic_version_prefix": "36",
-    "mutate-os-release": "36",
-
-    "initramfs-args": ["--no-hostonly",
-                       "--add", "ignition watchdog"],
-    "boot_location": "new",
-
-    "install-langs-comment": "Keep this in sync with treecompose-post.sh",
-    "install-langs": [
-      "pt_BR",
-      "fr",
-      "fr_FR",
-      "de",
-      "de_DE",
-      "it",
-      "it_IT",
-      "ru",
-      "ru_RU",
-      "es",
-      "es_ES",
-      "en_US",
-      "zh_CN",
-      "ja",
-      "ja_JP",
-      "ko",
-      "ko_KR",
-      "zh_TW",
-      "as",
-      "as_IN",
-      "bn",
-      "bn_IN",
-      "gu",
-      "gu_IN",
-      "hi",
-      "hi_IN",
-      "kn",
-      "kn_IN",
-      "ml",
-      "ml_IN",
-      "mr",
-      "mr_IN",
-      "or",
-      "or_IN",
-      "pa",
-      "pa_IN",
-      "ta",
-      "ta_IN",
-      "te",
-      "te_IN"
-    ],
-
-    "postprocess-script": "treecompose-post.sh",
-
-    "etc-group-members": ["wheel", "docker"],
-
-    "ignore-removed-users": ["root"],
-    "ignore-removed-groups": ["root"],
-    "check-passwd": { "type": "file", "filename": "passwd" },
-    "check-groups": { "type": "file", "filename": "group" },
-
-    "packages": ["fedora-release-iot",
-         "glibc", "glibc-minimal-langpack", "nss-altfiles",
-         "sssd-client", "libsss_sudo", "shadow-utils",
-         "kernel",
-         "dracut-config-generic", "dracut-network",
-         "rpm-ostree", "polkit", "lvm2",
-         "cryptsetup", "pinentry",
-         "keyutils", "cracklib-dicts",
-         "e2fsprogs", "xfsprogs", "dosfstools",
-         "gnupg2",
-         "basesystem", "python3", "bash",
-         "xz", "gzip",
-         "coreutils", "which", "curl",
-         "firewalld", "iptables",
-         "NetworkManager", "NetworkManager-wifi", "NetworkManager-wwan",
-         "wpa_supplicant", "wireless-regdb", "iwd", "tpm2-pkcs11",
-         "dnsmasq", "traceroute",
-         "hostname", "iproute", "iputils",
-         "openssh-clients", "openssh-server", "passwd",
-         "policycoreutils", "procps-ng", "rootfiles", "rpm",
-         "selinux-policy-targeted", "setup", "shadow-utils",
-         "sudo", "util-linux", "vim-minimal",
-         "systemd", "systemd-resolved",
-         "less", "tar",
-	 "fwupd", "fwupd-plugin-modem-manager",
-         "greenboot", "greenboot-grub2", "greenboot-rpm-ostree-grub2", "greenboot-reboot", "greenboot-status",
-         "ignition", "zezere-ignition",
-         "zram-generator", "zram-generator-defaults",
-         "rsync", "attr",
-         "ima-evm-utils", "openssl",
-         "bash-completion",
-         "tmux", "screen",
-         "policycoreutils-python-utils",
-         "setools-console", "usbguard",
-         "rng-tools", "chrony",
-         "bluez", "bluez-libs", "bluez-mesh",
-         "kernel-tools", "libgpiod-utils",
-         "podman", "podman-plugins", "container-selinux", "skopeo", "criu", "slirp4netns",
-         "clevis", "clevis-dracut", "clevis-luks", "clevis-pin-tpm2",
-         "parsec", "dbus-parsec"],
-
-    "packages-aarch64": ["grub2-efi-aa64", "efibootmgr", "shim-aa64", "fwupd-efi",
-                         "uboot-tools", "uboot-images-armv8", "bcm283x-firmware",
-                         "arm-image-installer", "iwl7260-firmware", "iwlax2xx-firmware"],
-
-    "packages-armhfp": ["grub2-efi-arm", "efibootmgr",
-                        "uboot-tools", "uboot-images-armv7", "bcm283x-firmware",
-                        "arm-image-installer"],
-
-    "packages-x86_64": ["grub2", "grub2-efi-x64", "efibootmgr", "shim-x64", "fwupd-efi", "microcode_ctl",
-                        "iwl1000-firmware", "iwl100-firmware", "iwl105-firmware", "iwl135-firmware",
-                        "iwl2000-firmware", "iwl2030-firmware", "iwl3160-firmware", "iwl5000-firmware",
-                        "iwl5150-firmware", "iwl6000-firmware", "iwl6050-firmware", "iwl7260-firmware",
-                        "iwlax2xx-firmware"],
-
-    "default_target": "multi-user.target",
-
-    "units": ["NetworkManager.service", "firewalld.service", "rngd.service", "sshd.service",
-              "zezere_ignition.timer", "zezere_ignition_banner.service",
-              "greenboot-grub2-set-counter.service", "greenboot-grub2-set-success.service", "greenboot-healthcheck.service", 
-              "greenboot-rpm-ostree-grub2-check-fallback.service", "greenboot-status.service", "greenboot-task-runner.service",
-              "parsec.service", "dbus-parsec.service"]
-}
diff --git a/fedora-iot-base.yaml b/fedora-iot-base.yaml
new file mode 100644
index 0000000..b76b81e
--- /dev/null
+++ b/fedora-iot-base.yaml
@@ -0,0 +1,231 @@
+ref: fedora/rawhide/${basearch}/iot
+
+automatic_version_prefix: "36"
+mutate-os-release: "36"
+
+install-langs-comment: Keep this in sync with treecompose-post.sh
+install-langs:
+  - pt_BR
+  - fr
+  - fr_FR
+  - de
+  - de_DE
+  - it
+  - it_IT
+  - ru
+  - ru_RU
+  - es
+  - es_ES
+  - en_US
+  - zh_CN
+  - ja
+  - ja_JP
+  - ko
+  - ko_KR
+  - zh_TW
+  - as
+  - as_IN
+  - bn
+  - bn_IN
+  - gu
+  - gu_IN
+  - hi
+  - hi_IN
+  - kn
+  - kn_IN
+  - ml
+  - ml_IN
+  - mr
+  - mr_IN
+  - or
+  - or_IN
+  - pa
+  - pa_IN
+  - ta
+  - ta_IN
+  - te
+  - te_IN
+
+selinux: true
+documentation: false
+boot_location: new
+recommends: false
+
+etc-group-members:
+  - wheel
+  - docker
+
+postprocess-script: treecompose-post.sh
+
+ignore-removed-users:
+  - root
+ignore-removed-groups:
+  - root
+check-passwd:
+  type: file
+  filename: passwd
+check-groups:
+  type: file
+  filename: group
+
+default_target: multi-user.target
+
+initramfs-args:
+  - --no-hostonly
+  - --add
+  - ignition watchdog
+
+packages:
+  - fedora-release-iot
+  - glibc
+  - glibc-minimal-langpack
+  - nss-altfiles
+  - sssd-client
+  - libsss_sudo
+  - shadow-utils
+  - kernel
+  - dracut-config-generic
+  - dracut-network
+  - rpm-ostree
+  - polkit
+  - lvm2
+  - cryptsetup
+  - pinentry
+  - keyutils
+  - cracklib-dicts
+  - e2fsprogs
+  - xfsprogs
+  - dosfstools
+  - gnupg2
+  - basesystem
+  - python3
+  - bash
+  - xz
+  - gzip
+  - coreutils
+  - which
+  - curl
+  - firewalld
+  - iptables
+  - NetworkManager
+  - NetworkManager-wifi
+  - NetworkManager-wwan
+  - wpa_supplicant
+  - wireless-regdb
+  - iwd
+  - tpm2-pkcs11
+  - dnsmasq
+  - traceroute
+  - hostname
+  - iproute
+  - iputils
+  - openssh-clients
+  - openssh-server
+  - passwd
+  - policycoreutils
+  - procps-ng
+  - rootfiles
+  - rpm
+  - selinux-policy-targeted
+  - setup
+  - shadow-utils
+  - sudo
+  - util-linux
+  - vim-minimal
+  - systemd
+  - systemd-resolved
+  - less
+  - tar
+  - fwupd
+  - fwupd-plugin-modem-manager
+  - greenboot
+  - greenboot-grub2
+  - greenboot-rpm-ostree-grub2
+  - greenboot-reboot
+  - greenboot-status
+  - ignition
+  - zezere-ignition
+  - zram-generator
+  - zram-generator-defaults
+  - rsync
+  - attr
+  - ima-evm-utils
+  - openssl
+  - bash-completion
+  - tmux
+  - screen
+  - policycoreutils-python-utils
+  - setools-console
+  - usbguard
+  - rng-tools
+  - chrony
+  - bluez
+  - bluez-libs
+  - bluez-mesh
+  - kernel-tools
+  - libgpiod-utils
+  - podman
+  - podman-plugins
+  - container-selinux
+  - skopeo
+  - criu
+  - slirp4netns
+  - clevis
+  - clevis-dracut
+  - clevis-luks
+  - clevis-pin-tpm2
+  - parsec
+  - dbus-parsec
+packages-aarch64:
+  - grub2-efi-aa64
+  - efibootmgr
+  - shim-aa64
+  - fwupd-efi
+  - uboot-tools
+  - uboot-images-armv8
+  - bcm283x-firmware
+  - arm-image-installer
+  - iwl7260-firmware
+packages-armhfp:
+  - grub2-efi-arm
+  - efibootmgr
+  - uboot-tools
+  - uboot-images-armv7
+  - bcm283x-firmware
+  - arm-image-installer
+packages-x86_64:
+  - grub2
+  - grub2-efi-x64
+  - efibootmgr
+  - shim-x64
+  - fwupd-efi
+  - microcode_ctl
+  - iwl1000-firmware
+  - iwl100-firmware
+  - iwl105-firmware
+  - iwl135-firmware
+  - iwl2000-firmware
+  - iwl2030-firmware
+  - iwl3160-firmware
+  - iwl5000-firmware
+  - iwl5150-firmware
+  - iwl6000-firmware
+  - iwl6050-firmware
+  - iwl7260-firmware
+  - iwlax2xx-firmware
+
+units:
+  - NetworkManager.service
+  - firewalld.service
+  - rngd.service
+  - sshd.service
+  - zezere_ignition.timer
+  - zezere_ignition_banner.service
+  - greenboot-grub2-set-counter.service
+  - greenboot-grub2-set-success.service
+  - greenboot-healthcheck.service
+  - greenboot-rpm-ostree-grub2-check-fallback.service
+  - greenboot-status.service
+  - greenboot-task-runner.service
+  - parsec.service
+  - dbus-parsec.service
diff --git a/fedora-iot-updates-stable.json b/fedora-iot-updates-stable.json
deleted file mode 100644
index 1bacd21..0000000
--- a/fedora-iot-updates-stable.json
+++ /dev/null
@@ -1,5 +0,0 @@
-
-    "ref": "fedora/devel/${basearch}/updates/iot",
-    "ex-jigdo-spec": "fedora-iot.spec",
-    "include": "fedora-iot-base.json"
-}
diff --git a/fedora-iot-updates-testing.json b/fedora-iot-updates-testing.json
deleted file mode 100644
index 96b50ac..0000000
--- a/fedora-iot-updates-testing.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
-    "ref": "fedora/rawhide/${basearch}/testing/iot",
-    "ex-jigdo-spec": "fedora-iot.spec",
-    "include": "fedora-iot-base.json"
-}
diff --git a/fedora-iot.json b/fedora-iot.json
deleted file mode 100644
index df9035d..0000000
--- a/fedora-iot.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
-    "ref": "fedora/rawhide/${basearch}/iot",
-    "ex-jigdo-spec": "fedora-iot.spec",
-    "repos": ["fedora-36"],
-    "include": "fedora-iot-base.json"
-}
diff --git a/fedora-iot.json b/fedora-iot.json
new file mode 120000
index 0000000..355743f
--- /dev/null
+++ b/fedora-iot.json
@@ -0,0 +1 @@
+fedora-iot.yaml
\ No newline at end of file
diff --git a/fedora-iot.yaml b/fedora-iot.yaml
new file mode 100644
index 0000000..6f519b9
--- /dev/null
+++ b/fedora-iot.yaml
@@ -0,0 +1,4 @@
+ref: fedora/rawhide/${basearch}/iot
+repos:
+  - fedora-36
+include: fedora-iot-base.yaml

From 8939e430dea1232d384be0c1d1d7c0efbdf33255 Mon Sep 17 00:00:00 2001
From: Timothée Ravier <tim@siosm.fr>
Date: Oct 20 2021 15:07:49 +0000
Subject: [PATCH 4/6] fedora-iot-base: Move post script inline


This was difficult with the JSON based manifests but is now easy with
the YAML ones.

---

diff --git a/fedora-iot-base.yaml b/fedora-iot-base.yaml
index b76b81e..bc25b1e 100644
--- a/fedora-iot-base.yaml
+++ b/fedora-iot-base.yaml
@@ -55,8 +55,6 @@ etc-group-members:
   - wheel
   - docker
 
-postprocess-script: treecompose-post.sh
-
 ignore-removed-users:
   - root
 ignore-removed-groups:
@@ -229,3 +227,25 @@ units:
   - greenboot-task-runner.service
   - parsec.service
   - dbus-parsec.service
+
+postprocess:
+  - |
+    #!/usr/bin/env bash
+    set -xeuo pipefail
+
+    # Work around https://bugzilla.redhat.com/show_bug.cgi?id=1265295
+    # Also note the create-new-then-rename dance for rofiles-fuse compat
+    if ! grep -q '^Storage=persistent' /etc/systemd/journald.conf; then
+        (cat /etc/systemd/journald.conf && echo 'Storage=persistent') > /etc/systemd.journald.conf.new
+        mv /etc/systemd.journald.conf{.new,}
+    fi
+
+    # See: https://src.fedoraproject.org/rpms/glibc/pull-request/4
+    # Basically that program handles deleting old shared library directories
+    # mid-transaction, which never applies to rpm-ostree. This is structured as a
+    # loop/glob to avoid hardcoding (or trying to match) the architecture.
+    for x in /usr/sbin/glibc_post_upgrade.*; do
+        if test -f ${x}; then
+            ln -srf /usr/bin/true ${x}
+        fi
+    done

From 7ef953e2cf7b12667eaf79d6123a139bc5d5b33c Mon Sep 17 00:00:00 2001
From: Timothée Ravier <tim@siosm.fr>
Date: Oct 20 2021 15:07:49 +0000
Subject: [PATCH 5/6] fedora-iot-base: Update persistent journal workaround


Add a systemd configuration drop-in instead of modyfing the default
configuration file.

Imported from:
https://github.com/coreos/fedora-coreos-config/blob/testing-devel/overlay.d/05core/usr/lib/systemd/journald.conf.d/10-coreos-persistent.conf

---

diff --git a/fedora-iot-base.yaml b/fedora-iot-base.yaml
index bc25b1e..65cc71f 100644
--- a/fedora-iot-base.yaml
+++ b/fedora-iot-base.yaml
@@ -233,12 +233,8 @@ postprocess:
     #!/usr/bin/env bash
     set -xeuo pipefail
 
-    # Work around https://bugzilla.redhat.com/show_bug.cgi?id=1265295
-    # Also note the create-new-then-rename dance for rofiles-fuse compat
-    if ! grep -q '^Storage=persistent' /etc/systemd/journald.conf; then
-        (cat /etc/systemd/journald.conf && echo 'Storage=persistent') > /etc/systemd.journald.conf.new
-        mv /etc/systemd.journald.conf{.new,}
-    fi
+    # From https://github.com/coreos/fedora-coreos-config/blob/testing-devel/overlay.d/05core/usr/lib/systemd/journald.conf.d/10-coreos-persistent.conf
+    echo -e "[Journal]\nStorage=persistent" > /usr/lib/systemd/journald.conf.d/10-persistent.conf
 
     # See: https://src.fedoraproject.org/rpms/glibc/pull-request/4
     # Basically that program handles deleting old shared library directories

From 7b11e7e739edba5be550e03933722a958afe2ab7 Mon Sep 17 00:00:00 2001
From: Timothée Ravier <tim@siosm.fr>
Date: Oct 20 2021 15:07:49 +0000
Subject: [PATCH 6/6] README: Minor update


---

diff --git a/README.md b/README.md
index 25e27d2..2eb5265 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,3 @@
-# ostree 
+# Fedora IoT ostree/rpm-ostree treefiles
 
 This is the repo for the ostree compose configs for Fedora IoT.

