summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaudius Heine <ch@denx.de>2022-05-12 11:27:21 +0200
committerKhem Raj <raj.khem@gmail.com>2022-05-12 09:16:11 -0700
commit8ac08ac7d82c9d53338733cab3cf9201541a939e (patch)
tree005eb34ae1296ef1266a5464394897d450ba1ce8
parent3de996474e0b7fdff1d265fcad747bd60851b1eb (diff)
downloadmeta-openembedded-8ac08ac7d82c9d53338733cab3cf9201541a939e.tar.gz
btrfsmaintenance: add recipe for btrfsmaintenance scripts
Btrfs requires regular maintenance in order to self-heal. Other distributions like OpenSUSE, Debian and Fedora use these scripts to perform those. Signed-off-by: Claudius Heine <ch@denx.de> Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--meta-filesystems/recipes-utils/btrfsmaintenance/btrfsmaintenance_0.5.bb62
-rw-r--r--meta-filesystems/recipes-utils/btrfsmaintenance/files/0001-change-sysconfig-path-to-etc-default.patch47
-rw-r--r--meta-filesystems/recipes-utils/btrfsmaintenance/files/0002-add-WantedBy-directive-to-btrfsmaintenance-refresh.s.patch33
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 000000000..a4573cf59
--- /dev/null
+++ b/meta-filesystems/recipes-utils/btrfsmaintenance/btrfsmaintenance_0.5.bb
@@ -0,0 +1,62 @@
1
2SUMMARY = "Services for periodic btrfs maintenance tasks"
3DESCRIPTION = "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."
6HOMEPAGE = "https://github.com/kdave/btrfsmaintenance"
7LICENSE = "GPL-2.0-only"
8LIC_FILES_CHKSUM = "file://COPYING;md5=892f569a555ba9c07a568a7c0c4fa63a"
9
10SECTION = "base"
11
12DEPENDS = "btrfs-tools"
13
14SRC_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"
18SRCREV = "be42cb6267055d125994abd6927cf3a26deab74c"
19
20UPSTREAM_CHECK_URI = "https://github.com/kdave/${BPN}/tags"
21UPSTREAM_CHECK_REGEX = "${BPN}/releases/tag/v(?P<pver>\d+(?:\.\d+)*)"
22
23RDEPENDS:${PN} = "bash"
24
25S="${WORKDIR}/git"
26
27inherit allarch
28
29do_configure[noexec] = "1"
30do_compile[noexec] = "1"
31
32do_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
49inherit systemd
50SYSTEMD_PACKAGES = "${PN}"
51SYSTEMD_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 000000000..d425206f0
--- /dev/null
+++ b/meta-filesystems/recipes-utils/btrfsmaintenance/files/0001-change-sysconfig-path-to-etc-default.patch
@@ -0,0 +1,47 @@
1From b49dbe17e0d9ae463e5a34e6991aa2d3c70d2fb1 Mon Sep 17 00:00:00 2001
2From: Claudius Heine <ch@denx.de>
3Date: Wed, 11 May 2022 14:33:13 +0200
4Subject: [PATCH] change sysconfig path to /etc/default
5
6OE uses /etc/default for service configuration, not /etc/sysconfig which
7is used by SUSE and RedHat based distributions.
8
9Change the files accordingly
10
11Upstream-Status: Inappropriate [OE specific]
12
13Signed-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
19diff --git a/btrfsmaintenance-refresh.path b/btrfsmaintenance-refresh.path
20index 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
34diff --git a/btrfsmaintenance-refresh.service b/btrfsmaintenance-refresh.service
35index 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--
462.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 000000000..0da7992a0
--- /dev/null
+++ b/meta-filesystems/recipes-utils/btrfsmaintenance/files/0002-add-WantedBy-directive-to-btrfsmaintenance-refresh.s.patch
@@ -0,0 +1,33 @@
1From 420ae0f395838b852ae8b8fe5528056c36dc0919 Mon Sep 17 00:00:00 2001
2From: Claudius Heine <ch@denx.de>
3Date: Wed, 11 May 2022 15:14:22 +0200
4Subject: [PATCH] add WantedBy directive to btrfsmaintenance-refresh.service
5
6Just trigger the service on the first boot, to configure services to the
7configuration file deployed in the package, afterwards disable the
8service, so that is only triggered when the configuration file has
9changed.
10
11Upstream-Status: Inappropriate [OE specific]
12
13Signed-off-by: Claudius Heine <ch@denx.de>
14---
15 btrfsmaintenance-refresh.service | 4 ++++
16 1 file changed, 4 insertions(+)
17
18diff --git a/btrfsmaintenance-refresh.service b/btrfsmaintenance-refresh.service
19index 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--
322.33.3
33