1
0
mirror of https://github.com/systemd/systemd synced 2024-07-05 17:39:42 +00:00

battery-check: rework unit

Let's rename the unit to systemd-battery-check.service. We usually want
to name our own unit files like our tools they wrap, in particular if
they are entirely defined by us (i.e. not just wrappers of foreign
concepts)

While we are at it, also hook this in from initrd.target, and order it
against initrd-root-device.target so that it runs before the root device
is possibly written to (i.e. mounted or fsck'ed).

This is heavily inspired by @aafeijoo-suse's PR #28208, but quite
different ;-)
This commit is contained in:
Lennart Poettering 2023-06-30 17:09:21 +02:00 committed by Mike Yuan
parent a5e478b24c
commit 95dafd30da
4 changed files with 11 additions and 9 deletions

View File

@ -23,7 +23,6 @@ manpages = [
['hostname', '5', [], ''],
['hostnamectl', '1', [], 'ENABLE_HOSTNAMED'],
['hwdb', '7', [], 'ENABLE_HWDB'],
['initrd-battery-check.service', '8', ['systemd-battery-check'], ''],
['integritytab', '5', [], 'HAVE_LIBCRYPTSETUP'],
['iocost.conf', '5', [], ''],
['journal-remote.conf', '5', ['journal-remote.conf.d'], 'HAVE_MICROHTTPD'],
@ -889,6 +888,7 @@ manpages = [
''],
['systemd-ask-password', '1', [], ''],
['systemd-backlight@.service', '8', ['systemd-backlight'], 'ENABLE_BACKLIGHT'],
['systemd-battery-check.service', '8', ['systemd-battery-check'], ''],
['systemd-binfmt.service', '8', ['systemd-binfmt'], 'ENABLE_BINFMT'],
['systemd-bless-boot-generator', '8', [], 'ENABLE_BOOTLOADER'],
['systemd-bless-boot.service',

View File

@ -3,7 +3,7 @@
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
<refentry id="initrd-battery-check.service" xmlns:xi="http://www.w3.org/2001/XInclude">
<refentry id="systemd-battery-check.service" xmlns:xi="http://www.w3.org/2001/XInclude">
<refentryinfo>
<title>systemd-battery-check</title>
@ -11,18 +11,18 @@
</refentryinfo>
<refmeta>
<refentrytitle>initrd-battery-check.service</refentrytitle>
<refentrytitle>systemd-battery-check.service</refentrytitle>
<manvolnum>8</manvolnum>
</refmeta>
<refnamediv>
<refname>initrd-battery-check.service</refname>
<refname>systemd-battery-check.service</refname>
<refname>systemd-battery-check</refname>
<refpurpose>Check battery level whether there's enough charge, and power off if not.</refpurpose>
</refnamediv>
<refsynopsisdiv>
<para><filename>initrd-battery-check.service</filename></para>
<para><filename>systemd-battery-check.service</filename></para>
<cmdsynopsis>
<command>/usr/lib/systemd/systemd-battery-check</command>
<arg choice="opt" rep="repeat">OPTIONS</arg>
@ -33,7 +33,7 @@
<title>Description</title>
<para>
<filename>initrd-battery-check.service</filename> is used to check the battery level during the early
<filename>systemd-battery-check.service</filename> is used to check the battery level during the early
boot stage to determine whether there's sufficient battery power to carry on with the booting process.
</para>
<para>

View File

@ -56,8 +56,9 @@ units = [
'conditions' : ['ENABLE_HIBERNATE'],
},
{
'file' : 'initrd-battery-check.service.in',
'file' : 'systemd-battery-check.service.in',
'conditions' : ['ENABLE_INITRD'],
'symlinks' : ['initrd.target.wants/'],
},
{
'file' : 'initrd-cleanup.service',

View File

@ -9,10 +9,11 @@
[Unit]
Description=Check battery level during early boot
Documentation=man:initrd-battery-check.service(8)
Documentation=man:systemd-battery-check.service(8)
DefaultDependencies=no
AssertPathExists=/etc/initrd-release
Before=local-fs-pre.target
After=plymouth-start.service
Before=initrd-root-device.target
[Service]
Type=oneshot