diff options
3 files changed, 142 insertions, 0 deletions
diff --git a/meta-filesystems/recipes-utils/btrfsmaintenance/btrfsmaintenance_0.5.bb b/meta-filesystems/recipes-utils/btrfsmaintenance/btrfsmaintenance_0.5.bb new file mode 100644 index 0000000000..a4573cf596 --- /dev/null +++ b/meta-filesystems/recipes-utils/btrfsmaintenance/btrfsmaintenance_0.5.bb | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | |||
| 2 | SUMMARY = "Services for periodic btrfs maintenance tasks" | ||
| 3 | DESCRIPTION = "A set of scripts supplementing the btrfs filesystem and aims \ | ||
| 4 | to automate a few maintenance tasks. This means the scrub, balance, trim \ | ||
| 5 | or defragmentation." | ||
| 6 | HOMEPAGE = "https://github.com/kdave/btrfsmaintenance" | ||
| 7 | LICENSE = "GPL-2.0-only" | ||
| 8 | LIC_FILES_CHKSUM = "file://COPYING;md5=892f569a555ba9c07a568a7c0c4fa63a" | ||
| 9 | |||
| 10 | SECTION = "base" | ||
| 11 | |||
| 12 | DEPENDS = "btrfs-tools" | ||
| 13 | |||
| 14 | SRC_URI = "git://github.com/kdave/${BPN};branch=master;protocol=https \ | ||
| 15 | file://0001-change-sysconfig-path-to-etc-default.patch \ | ||
| 16 | file://0002-add-WantedBy-directive-to-btrfsmaintenance-refresh.s.patch \ | ||
| 17 | " | ||
| 18 | SRCREV = "be42cb6267055d125994abd6927cf3a26deab74c" | ||
| 19 | |||
| 20 | UPSTREAM_CHECK_URI = "https://github.com/kdave/${BPN}/tags" | ||
| 21 | UPSTREAM_CHECK_REGEX = "${BPN}/releases/tag/v(?P<pver>\d+(?:\.\d+)*)" | ||
| 22 | |||
| 23 | RDEPENDS:${PN} = "bash" | ||
| 24 | |||
| 25 | S="${WORKDIR}/git" | ||
| 26 | |||
| 27 | inherit allarch | ||
| 28 | |||
| 29 | do_configure[noexec] = "1" | ||
| 30 | do_compile[noexec] = "1" | ||
| 31 | |||
| 32 | do_install() { | ||
| 33 | install -Dm0644 ${S}/btrfsmaintenance-refresh.path \ | ||
| 34 | ${D}${systemd_system_unitdir}/btrfsmaintenance-refresh.path | ||
| 35 | install -Dm0644 ${S}/*.timer \ | ||
| 36 | ${D}${systemd_system_unitdir} | ||
| 37 | install -Dm0644 ${S}/*.service \ | ||
| 38 | ${D}${systemd_system_unitdir} | ||
| 39 | |||
| 40 | install -Dm0644 ${S}/btrfsmaintenance-functions \ | ||
| 41 | ${D}${datadir}/${PN}/btrfsmaintenance-functions | ||
| 42 | install -Dm0755 ${S}/*.sh \ | ||
| 43 | ${D}${datadir}/${PN} | ||
| 44 | |||
| 45 | install -Dm0644 ${S}/sysconfig.btrfsmaintenance \ | ||
| 46 | ${D}${sysconfdir}/default/btrfsmaintenance | ||
| 47 | } | ||
| 48 | |||
| 49 | inherit systemd | ||
| 50 | SYSTEMD_PACKAGES = "${PN}" | ||
| 51 | SYSTEMD_SERVICE:${PN} = " \ | ||
| 52 | btrfs-scrub.timer \ | ||
| 53 | btrfs-scrub.service \ | ||
| 54 | btrfs-trim.timer \ | ||
| 55 | btrfs-trim.service \ | ||
| 56 | btrfs-balance.timer \ | ||
| 57 | btrfs-balance.service \ | ||
| 58 | btrfs-defrag.timer \ | ||
| 59 | btrfs-defrag.service \ | ||
| 60 | btrfsmaintenance-refresh.service \ | ||
| 61 | btrfsmaintenance-refresh.path \ | ||
| 62 | " | ||
diff --git a/meta-filesystems/recipes-utils/btrfsmaintenance/files/0001-change-sysconfig-path-to-etc-default.patch b/meta-filesystems/recipes-utils/btrfsmaintenance/files/0001-change-sysconfig-path-to-etc-default.patch new file mode 100644 index 0000000000..d425206f0e --- /dev/null +++ b/meta-filesystems/recipes-utils/btrfsmaintenance/files/0001-change-sysconfig-path-to-etc-default.patch | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | From b49dbe17e0d9ae463e5a34e6991aa2d3c70d2fb1 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Claudius Heine <ch@denx.de> | ||
| 3 | Date: Wed, 11 May 2022 14:33:13 +0200 | ||
| 4 | Subject: [PATCH] change sysconfig path to /etc/default | ||
| 5 | |||
| 6 | OE uses /etc/default for service configuration, not /etc/sysconfig which | ||
| 7 | is used by SUSE and RedHat based distributions. | ||
| 8 | |||
| 9 | Change the files accordingly | ||
| 10 | |||
| 11 | Upstream-Status: Inappropriate [OE specific] | ||
| 12 | |||
| 13 | Signed-off-by: Claudius Heine <ch@denx.de> | ||
| 14 | --- | ||
| 15 | btrfsmaintenance-refresh.path | 4 ++-- | ||
| 16 | btrfsmaintenance-refresh.service | 2 +- | ||
| 17 | 2 files changed, 3 insertions(+), 3 deletions(-) | ||
| 18 | |||
| 19 | diff --git a/btrfsmaintenance-refresh.path b/btrfsmaintenance-refresh.path | ||
| 20 | index d56ad11..f0b4132 100644 | ||
| 21 | --- a/btrfsmaintenance-refresh.path | ||
| 22 | +++ b/btrfsmaintenance-refresh.path | ||
| 23 | @@ -1,8 +1,8 @@ | ||
| 24 | [Unit] | ||
| 25 | -Description=Watch /etc/sysconfig/btrfsmaintenance | ||
| 26 | +Description=Watch /etc/default/btrfsmaintenance | ||
| 27 | |||
| 28 | [Path] | ||
| 29 | -PathChanged=/etc/sysconfig/btrfsmaintenance | ||
| 30 | +PathChanged=/etc/default/btrfsmaintenance | ||
| 31 | |||
| 32 | [Install] | ||
| 33 | WantedBy=multi-user.target | ||
| 34 | diff --git a/btrfsmaintenance-refresh.service b/btrfsmaintenance-refresh.service | ||
| 35 | index 4ed1eb4..d6225a6 100644 | ||
| 36 | --- a/btrfsmaintenance-refresh.service | ||
| 37 | +++ b/btrfsmaintenance-refresh.service | ||
| 38 | @@ -1,5 +1,5 @@ | ||
| 39 | [Unit] | ||
| 40 | -Description=Update cron periods from /etc/sysconfig/btrfsmaintenance | ||
| 41 | +Description=Update cron periods from /etc/default/btrfsmaintenance | ||
| 42 | |||
| 43 | [Service] | ||
| 44 | ExecStart=/usr/share/btrfsmaintenance/btrfsmaintenance-refresh-cron.sh systemd-timer | ||
| 45 | -- | ||
| 46 | 2.33.3 | ||
| 47 | |||
diff --git a/meta-filesystems/recipes-utils/btrfsmaintenance/files/0002-add-WantedBy-directive-to-btrfsmaintenance-refresh.s.patch b/meta-filesystems/recipes-utils/btrfsmaintenance/files/0002-add-WantedBy-directive-to-btrfsmaintenance-refresh.s.patch new file mode 100644 index 0000000000..0da7992a09 --- /dev/null +++ b/meta-filesystems/recipes-utils/btrfsmaintenance/files/0002-add-WantedBy-directive-to-btrfsmaintenance-refresh.s.patch | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | From 420ae0f395838b852ae8b8fe5528056c36dc0919 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Claudius Heine <ch@denx.de> | ||
| 3 | Date: Wed, 11 May 2022 15:14:22 +0200 | ||
| 4 | Subject: [PATCH] add WantedBy directive to btrfsmaintenance-refresh.service | ||
| 5 | |||
| 6 | Just trigger the service on the first boot, to configure services to the | ||
| 7 | configuration file deployed in the package, afterwards disable the | ||
| 8 | service, so that is only triggered when the configuration file has | ||
| 9 | changed. | ||
| 10 | |||
| 11 | Upstream-Status: Inappropriate [OE specific] | ||
| 12 | |||
| 13 | Signed-off-by: Claudius Heine <ch@denx.de> | ||
| 14 | --- | ||
| 15 | btrfsmaintenance-refresh.service | 4 ++++ | ||
| 16 | 1 file changed, 4 insertions(+) | ||
| 17 | |||
| 18 | diff --git a/btrfsmaintenance-refresh.service b/btrfsmaintenance-refresh.service | ||
| 19 | index d6225a6..58d0e09 100644 | ||
| 20 | --- a/btrfsmaintenance-refresh.service | ||
| 21 | +++ b/btrfsmaintenance-refresh.service | ||
| 22 | @@ -3,4 +3,8 @@ Description=Update cron periods from /etc/default/btrfsmaintenance | ||
| 23 | |||
| 24 | [Service] | ||
| 25 | ExecStart=/usr/share/btrfsmaintenance/btrfsmaintenance-refresh-cron.sh systemd-timer | ||
| 26 | +ExecStart=systemctl disable btrfsmaintenance-refresh.service | ||
| 27 | Type=oneshot | ||
| 28 | + | ||
| 29 | +[Install] | ||
| 30 | +WantedBy=multi-user.target | ||
| 31 | -- | ||
| 32 | 2.33.3 | ||
| 33 | |||
