]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(warpclock): minor cleanups
authorJóhann B. Guðmundsson <johannbg@gmail.com>
Tue, 18 May 2021 10:34:46 +0000 (10:34 +0000)
committerDaniel Molkentin <daniel@molkentin.de>
Tue, 25 May 2021 12:00:52 +0000 (14:00 +0200)
- Removing shell mode lines
- Remove uncessary file requirements
- Remove hard coded path to binary
- Add missing license header
- Document sections
- refactor install section

modules.d/00warpclock/module-setup.sh
modules.d/00warpclock/warpclock.sh

index e6fc47119558b6754f1a28e45f311e63e9635670..44aa17790f1cb68cf915b2e41eb7d24a1b296133 100644 (file)
@@ -1,29 +1,39 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
+# This file is part of dracut.
+# SPDX-License-Identifier: GPL-2.0-or-later
 
-# called by dracut
+# Prerequisite check(s) for module.
 check() {
+
     # hwclock does not exist on S390(x), bail out silently then
     local _arch=${DRACUT_ARCH:-$(uname -m)}
     [ "$_arch" = "s390" -o "$_arch" = "s390x" ] && return 1
 
-    [ -e /etc/localtime -a -e /etc/adjtime ] || return 1
-    require_binaries /sbin/hwclock || return 1
+    # If the binary(s) requirements are not fulfilled the module can't be installed.
+    require_binaries hwclock || return 1
 
+    # Return 255 to only include the module, if another module requires it.
     return 255
+
 }
 
-# called by dracut
+# Module dependency requirements.
 depends() {
+
+    # Return 0 to include the dependent module(s) in the initramfs.
     return 0
+
 }
 
-# called by dracut
+# Install the required file(s) and directories for the module in the initramfs.
 install() {
-    inst /usr/share/zoneinfo/UTC
-    inst /etc/localtime
-    inst /etc/adjtime
+
     inst_hook pre-trigger 00 "$moddir/warpclock.sh"
-    inst /sbin/hwclock
+
+    inst_multiple -o \
+        /usr/share/zoneinfo/UTC \
+        /etc/localtime \
+        /etc/adjtime \
+        hwclock
+
 }
index c97eb6013df76c5d718d581088ea52b67b7d61b6..fb4df0b8efe7ed7507ce5053cf3bb52bf4189cbe 100644 (file)
@@ -1,4 +1,9 @@
 #!/bin/sh
+# This file is part of dracut warpclock module.
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+# Set the kernel's timezone and reset the system time
+# if adjtime is set to LOCAL.
 
 if test -e /etc/adjtime; then
     while read -r line; do