summary refs log tree commit diff
diff options
context:
space:
mode:
authorArtturin <Artturin@artturin.com>2021-12-18 06:06:10 +0200
committerArtturin <Artturin@artturin.com>2021-12-18 06:06:10 +0200
commitc44f95a85539e4371620e6a4bcdef7bdc0a33849 (patch)
tree5e642b88b2c32ac00ef59858a1b0046d3766a77e
parent08adacb68fa477453fdd038803730a8e90b6d489 (diff)
downloadnixpkgs-c44f95a85539e4371620e6a4bcdef7bdc0a33849.tar
nixpkgs-c44f95a85539e4371620e6a4bcdef7bdc0a33849.tar.gz
nixpkgs-c44f95a85539e4371620e6a4bcdef7bdc0a33849.tar.bz2
nixpkgs-c44f95a85539e4371620e6a4bcdef7bdc0a33849.tar.lz
nixpkgs-c44f95a85539e4371620e6a4bcdef7bdc0a33849.tar.xz
nixpkgs-c44f95a85539e4371620e6a4bcdef7bdc0a33849.tar.zst
nixpkgs-c44f95a85539e4371620e6a4bcdef7bdc0a33849.zip
nixos/stage1: run fsck on battery too
We are in 2021 almost 2022 not in 2004 when this may have been an issue!

https://alioth-lists.debian.net/pipermail/pkg-sysvinit-devel/2009-May/003196.html
https://www.nico.schottelius.org/blog/debian-ubuntu-fsck-skip-on-battery-bug/
https://github.com/OpenRC/openrc/commit/d29daf395299fc97b8e13676bc282800a8bddae8
https://bugs.launchpad.net/ubuntu/+source/laptop-mode/+bug/11194
-rw-r--r--nixos/modules/system/boot/stage-1-init.sh16
1 files changed, 0 insertions, 16 deletions
diff --git a/nixos/modules/system/boot/stage-1-init.sh b/nixos/modules/system/boot/stage-1-init.sh
index e8e32bab6e3..98409ed6ae5 100644
--- a/nixos/modules/system/boot/stage-1-init.sh
+++ b/nixos/modules/system/boot/stage-1-init.sh
@@ -263,15 +263,6 @@ if test -n "$debug1devices"; then fail; fi
 @postDeviceCommands@
 
 
-# Return true if the machine is on AC power, or if we can't determine
-# whether it's on AC power.
-onACPower() {
-    ! test -d "/proc/acpi/battery" ||
-    ! ls /proc/acpi/battery/BAT[0-9]* > /dev/null 2>&1 ||
-    ! cat /proc/acpi/battery/BAT*/state | grep "^charging state" | grep -q "discharg"
-}
-
-
 # Check the specified file system, if appropriate.
 checkFS() {
     local device="$1"
@@ -316,13 +307,6 @@ checkFS() {
         return 0
     fi
 
-    # Don't run `fsck' if the machine is on battery power.  !!! Is
-    # this a good idea?
-    if ! onACPower; then
-        echo "on battery power, so no \`fsck' will be performed on \`$device'"
-        return 0
-    fi
-
     echo "checking $device..."
 
     fsckFlags=