mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2025-12-16 15:25:53 +01:00
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>
This commit is contained in:
parent
3de996474e
commit
8ac08ac7d8
|
|
@ -0,0 +1,62 @@
|
|||
|
||||
SUMMARY = "Services for periodic btrfs maintenance tasks"
|
||||
DESCRIPTION = "A set of scripts supplementing the btrfs filesystem and aims \
|
||||
to automate a few maintenance tasks. This means the scrub, balance, trim \
|
||||
or defragmentation."
|
||||
HOMEPAGE = "https://github.com/kdave/btrfsmaintenance"
|
||||
LICENSE = "GPL-2.0-only"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=892f569a555ba9c07a568a7c0c4fa63a"
|
||||
|
||||
SECTION = "base"
|
||||
|
||||
DEPENDS = "btrfs-tools"
|
||||
|
||||
SRC_URI = "git://github.com/kdave/${BPN};branch=master;protocol=https \
|
||||
file://0001-change-sysconfig-path-to-etc-default.patch \
|
||||
file://0002-add-WantedBy-directive-to-btrfsmaintenance-refresh.s.patch \
|
||||
"
|
||||
SRCREV = "be42cb6267055d125994abd6927cf3a26deab74c"
|
||||
|
||||
UPSTREAM_CHECK_URI = "https://github.com/kdave/${BPN}/tags"
|
||||
UPSTREAM_CHECK_REGEX = "${BPN}/releases/tag/v(?P<pver>\d+(?:\.\d+)*)"
|
||||
|
||||
RDEPENDS:${PN} = "bash"
|
||||
|
||||
S="${WORKDIR}/git"
|
||||
|
||||
inherit allarch
|
||||
|
||||
do_configure[noexec] = "1"
|
||||
do_compile[noexec] = "1"
|
||||
|
||||
do_install() {
|
||||
install -Dm0644 ${S}/btrfsmaintenance-refresh.path \
|
||||
${D}${systemd_system_unitdir}/btrfsmaintenance-refresh.path
|
||||
install -Dm0644 ${S}/*.timer \
|
||||
${D}${systemd_system_unitdir}
|
||||
install -Dm0644 ${S}/*.service \
|
||||
${D}${systemd_system_unitdir}
|
||||
|
||||
install -Dm0644 ${S}/btrfsmaintenance-functions \
|
||||
${D}${datadir}/${PN}/btrfsmaintenance-functions
|
||||
install -Dm0755 ${S}/*.sh \
|
||||
${D}${datadir}/${PN}
|
||||
|
||||
install -Dm0644 ${S}/sysconfig.btrfsmaintenance \
|
||||
${D}${sysconfdir}/default/btrfsmaintenance
|
||||
}
|
||||
|
||||
inherit systemd
|
||||
SYSTEMD_PACKAGES = "${PN}"
|
||||
SYSTEMD_SERVICE:${PN} = " \
|
||||
btrfs-scrub.timer \
|
||||
btrfs-scrub.service \
|
||||
btrfs-trim.timer \
|
||||
btrfs-trim.service \
|
||||
btrfs-balance.timer \
|
||||
btrfs-balance.service \
|
||||
btrfs-defrag.timer \
|
||||
btrfs-defrag.service \
|
||||
btrfsmaintenance-refresh.service \
|
||||
btrfsmaintenance-refresh.path \
|
||||
"
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
From b49dbe17e0d9ae463e5a34e6991aa2d3c70d2fb1 Mon Sep 17 00:00:00 2001
|
||||
From: Claudius Heine <ch@denx.de>
|
||||
Date: Wed, 11 May 2022 14:33:13 +0200
|
||||
Subject: [PATCH] change sysconfig path to /etc/default
|
||||
|
||||
OE uses /etc/default for service configuration, not /etc/sysconfig which
|
||||
is used by SUSE and RedHat based distributions.
|
||||
|
||||
Change the files accordingly
|
||||
|
||||
Upstream-Status: Inappropriate [OE specific]
|
||||
|
||||
Signed-off-by: Claudius Heine <ch@denx.de>
|
||||
---
|
||||
btrfsmaintenance-refresh.path | 4 ++--
|
||||
btrfsmaintenance-refresh.service | 2 +-
|
||||
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/btrfsmaintenance-refresh.path b/btrfsmaintenance-refresh.path
|
||||
index d56ad11..f0b4132 100644
|
||||
--- a/btrfsmaintenance-refresh.path
|
||||
+++ b/btrfsmaintenance-refresh.path
|
||||
@@ -1,8 +1,8 @@
|
||||
[Unit]
|
||||
-Description=Watch /etc/sysconfig/btrfsmaintenance
|
||||
+Description=Watch /etc/default/btrfsmaintenance
|
||||
|
||||
[Path]
|
||||
-PathChanged=/etc/sysconfig/btrfsmaintenance
|
||||
+PathChanged=/etc/default/btrfsmaintenance
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
diff --git a/btrfsmaintenance-refresh.service b/btrfsmaintenance-refresh.service
|
||||
index 4ed1eb4..d6225a6 100644
|
||||
--- a/btrfsmaintenance-refresh.service
|
||||
+++ b/btrfsmaintenance-refresh.service
|
||||
@@ -1,5 +1,5 @@
|
||||
[Unit]
|
||||
-Description=Update cron periods from /etc/sysconfig/btrfsmaintenance
|
||||
+Description=Update cron periods from /etc/default/btrfsmaintenance
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/share/btrfsmaintenance/btrfsmaintenance-refresh-cron.sh systemd-timer
|
||||
--
|
||||
2.33.3
|
||||
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
From 420ae0f395838b852ae8b8fe5528056c36dc0919 Mon Sep 17 00:00:00 2001
|
||||
From: Claudius Heine <ch@denx.de>
|
||||
Date: Wed, 11 May 2022 15:14:22 +0200
|
||||
Subject: [PATCH] add WantedBy directive to btrfsmaintenance-refresh.service
|
||||
|
||||
Just trigger the service on the first boot, to configure services to the
|
||||
configuration file deployed in the package, afterwards disable the
|
||||
service, so that is only triggered when the configuration file has
|
||||
changed.
|
||||
|
||||
Upstream-Status: Inappropriate [OE specific]
|
||||
|
||||
Signed-off-by: Claudius Heine <ch@denx.de>
|
||||
---
|
||||
btrfsmaintenance-refresh.service | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/btrfsmaintenance-refresh.service b/btrfsmaintenance-refresh.service
|
||||
index d6225a6..58d0e09 100644
|
||||
--- a/btrfsmaintenance-refresh.service
|
||||
+++ b/btrfsmaintenance-refresh.service
|
||||
@@ -3,4 +3,8 @@ Description=Update cron periods from /etc/default/btrfsmaintenance
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/share/btrfsmaintenance/btrfsmaintenance-refresh-cron.sh systemd-timer
|
||||
+ExecStart=systemctl disable btrfsmaintenance-refresh.service
|
||||
Type=oneshot
|
||||
+
|
||||
+[Install]
|
||||
+WantedBy=multi-user.target
|
||||
--
|
||||
2.33.3
|
||||
|
||||
Loading…
Reference in New Issue
Block a user