From 525434b8a4c11271b8bf8aef8ea53251c16d8dcd Mon Sep 17 00:00:00 2001 From: Brayan Almonte Date: Mon, 13 Jan 2025 10:52:16 -0500 Subject: [PATCH] opentrons-systemd-units: add a systemd service to clear the fontconfig cache. (#186) --- .../files/opentrons-clear-fontconfig-cache.service | 6 ++++++ .../files/ot-clear-fontconfig-cache | 5 +++++ .../opentrons-systemd-units.bb | 13 ++++++++++--- 3 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 layers/meta-opentrons/recipes-robot/opentrons-systemd-units/files/opentrons-clear-fontconfig-cache.service create mode 100755 layers/meta-opentrons/recipes-robot/opentrons-systemd-units/files/ot-clear-fontconfig-cache diff --git a/layers/meta-opentrons/recipes-robot/opentrons-systemd-units/files/opentrons-clear-fontconfig-cache.service b/layers/meta-opentrons/recipes-robot/opentrons-systemd-units/files/opentrons-clear-fontconfig-cache.service new file mode 100644 index 00000000..2d9b0e5f --- /dev/null +++ b/layers/meta-opentrons/recipes-robot/opentrons-systemd-units/files/opentrons-clear-fontconfig-cache.service @@ -0,0 +1,6 @@ +[Service] +Type=oneshot +ExecStart=/usr/bin/ot-clear-fontconfig-cache + +[Install] +WantedBy=basic.target diff --git a/layers/meta-opentrons/recipes-robot/opentrons-systemd-units/files/ot-clear-fontconfig-cache b/layers/meta-opentrons/recipes-robot/opentrons-systemd-units/files/ot-clear-fontconfig-cache new file mode 100755 index 00000000..50de66f3 --- /dev/null +++ b/layers/meta-opentrons/recipes-robot/opentrons-systemd-units/files/ot-clear-fontconfig-cache @@ -0,0 +1,5 @@ +#!/usr/bin/env sh + +echo "Clear Fontconfig cache." +rm -rf /var/cache/fontconfig/* +fc-cache -rf diff --git a/layers/meta-opentrons/recipes-robot/opentrons-systemd-units/opentrons-systemd-units.bb b/layers/meta-opentrons/recipes-robot/opentrons-systemd-units/opentrons-systemd-units.bb index e1ad4b7d..c07555b8 100644 --- a/layers/meta-opentrons/recipes-robot/opentrons-systemd-units/opentrons-systemd-units.bb +++ b/layers/meta-opentrons/recipes-robot/opentrons-systemd-units/opentrons-systemd-units.bb @@ -8,26 +8,33 @@ FILESEXTRAPATHS:prepend = "${THISDIR}/files:" SRC_URI += "\ file://var-log-journal.service \ file://opentrons-commit-machine-id.service \ + file://opentrons-clear-fontconfig-cache.service \ file://ot-commit-machine-id \ + file://ot-clear-fontconfig-cache \ " SYSTEMD_AUTO_ENABLE = "enable" SYSTEMD_SERVICE:${PN} += "var-log-journal.service" SYSTEMD_SERVICE:${PN} += "opentrons-commit-machine-id.service" +SYSTEMD_SERVICE:${PN} += "opentrons-clear-fontconfig-cache.service" SYSTEMD_PACKAGES = "${PN}" FILES:${PN} += "\ ${systemd_system_unitdir}/var-log-journal.service \ ${systemd_system_unitdir}/opentrons-commit-machine-id.service \ + ${systemd_system_unitdir}/opentrons-clear-fontconfig-cache.service \ ${bindir}/ot-commit-machine-id \ + ${bindir}/ot-clear-fontconfig-cache \ " do_install() { install -d ${D}/${systemd_system_unitdir} - install -m 0644 ${WORKDIR}/var-log-journal.service ${D}/${systemd_system_unitdir}/var-log-journal.service - install -m 0644 ${WORKDIR}/opentrons-commit-machine-id.service ${D}/${systemd_system_unitdir}/opentrons-commit-machine-id.service + install -m 0644 ${WORKDIR}/var-log-journal.service ${D}/${systemd_system_unitdir}/ + install -m 0644 ${WORKDIR}/opentrons-commit-machine-id.service ${D}/${systemd_system_unitdir}/ + install -m 0644 ${WORKDIR}/opentrons-clear-fontconfig-cache.service ${D}/${systemd_system_unitdir}/ # install supporting files install -d ${D}/${bindir} - install -m 0744 ${WORKDIR}/ot-commit-machine-id ${D}/${bindir}/ot-commit-machine-id + install -m 0744 ${WORKDIR}/ot-commit-machine-id ${D}/${bindir}/ + install -m 0744 ${WORKDIR}/ot-clear-fontconfig-cache ${D}/${bindir}/ }