]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Fix bad ls parsing
authorfoopub <45460217+foopub@users.noreply.github.com>
Wed, 3 Feb 2021 17:41:08 +0000 (17:41 +0000)
committerDaniel Molkentin <daniel@molkentin.de>
Mon, 8 Feb 2021 22:12:15 +0000 (23:12 +0100)
This used to cause some echo write/invalid argument errors. Simplest fix is to use readlink with -f for absolute path and -n to remove trailing newline.
See previous discussion here:
https://github.com/void-linux/void-packages/issues/13024

modules.d/95resume/resume.sh

index 8d366755f62f33f4f8582fbaa53ad4446ebb5334..e7becd0ae925f0993e2057f732ed6cece02106d7 100755 (executable)
@@ -14,9 +14,5 @@ PATH=/usr/sbin:/usr/bin:/sbin:/bin
     esac
     [ -x "$(command -v resume)" ] && command resume $a_splash "$resume"
 
-    # parsing the output of ls is Bad, but until there is a better way...
-    ls -lH "$resume" | (
-        read x x x x maj min x;
-        echo "${maj%,}:$min"> /sys/power/resume)
-    >/.resume
+    (readlink -fn $resume > /sys/power/resume)>/.resume
 }