]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
battery-check: rework unit
authorLennart Poettering <lennart@poettering.net>
Fri, 30 Jun 2023 15:09:21 +0000 (17:09 +0200)
committerMike Yuan <me@yhndnzj.com>
Fri, 30 Jun 2023 19:19:16 +0000 (03:19 +0800)
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 ;-)

man/rules/meson.build
man/systemd-battery-check.service.xml [moved from man/initrd-battery-check.service.xml with 83% similarity]
units/meson.build
units/systemd-battery-check.service.in [moved from units/initrd-battery-check.service.in with 83% similarity]

index e8c5a967ad95a36f3631a31af0e133e1d9301f1b..8fc158bd9109115064226ab46439e78e62517688 100644 (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',
similarity index 83%
rename from man/initrd-battery-check.service.xml
rename to man/systemd-battery-check.service.xml
index 582b2269fb5cfa343c5ade7ae16b14a22bbd175d..2d9005696eb7c1fceddcea6882df19f2e7f8dd26 100644 (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>
   </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>
index a552dd6c3fb0458af12e236db7da6f8ad088357d..5161ec502996309ab7098b1603978bd808eacb3d 100644 (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',
similarity index 83%
rename from units/initrd-battery-check.service.in
rename to units/systemd-battery-check.service.in
index 052586f3c78c482223b9ccac86dc202d0e738f46..3de8ba1d8eb92b69cb94f9ec113a5d4bc52e183d 100644 (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