From: Joe Pelkey <pelkeyj-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: ls to stat patch
Date: Thu, 03 Sep 2009 02:33:41 -0400 [thread overview]
Message-ID: <4A9F6345.4050003@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 284 bytes --]
Hi,
I was randomly looking through the git repository and came across
modules.d/95resume/resume.sh and its comment about not liking the use of
ls. I modified it to use stat instead, and since stat has been in
coreutils since at least late 2005, I assume it's safe to use.
Thanks
[-- Attachment #2: ls_to_stat.diff --]
[-- Type: text/plain, Size: 1132 bytes --]
diff -rN -U 5 dracut-001.orig/modules.d/95resume/resume.sh dracut-001/modules.d/95resume/resume.sh
--- dracut-001.orig/modules.d/95resume/resume.sh 2009-09-02 09:55:35.000000000 -0400
+++ dracut-001/modules.d/95resume/resume.sh 2009-09-03 02:29:27.000000000 -0400
@@ -1,8 +1,5 @@
#!/bin/sh
[ -s /.resume -a -b "$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)
+ stat -c '%t:%T' "$resume" > /sys/power/resume
>/.resume
}
diff -rN -U 5 dracut-001.orig/modules.d/99base/install dracut-001/modules.d/99base/install
--- dracut-001.orig/modules.d/99base/install 2009-09-02 09:55:35.000000000 -0400
+++ dracut-001/modules.d/99base/install 2009-09-03 02:00:35.000000000 -0400
@@ -1,8 +1,8 @@
#!/bin/bash
dracut_install mount mknod mkdir modprobe pidof sleep chroot \
- sed ls flock cp mv dmesg rm ln
+ sed ls flock cp mv dmesg rm ln stat
if [ ! -e "${initdir}/bin/sh" ]; then
dracut_install bash
(ln -s bash "${initdir}/bin/sh" || :)
fi
# install our scripts and hooks
next reply other threads:[~2009-09-03 6:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-03 6:33 Joe Pelkey [this message]
[not found] ` <4A9F6345.4050003-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-09-03 15:14 ` ls to stat patch Victor Lowther
2009-11-23 14:44 ` Pawel Krzesniak
[not found] ` <loom.20091123T144413-833-eS7Uydv5nfjZ+VzJOa5vwg@public.gmane.org>
2009-11-26 18:15 ` Harald Hoyer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A9F6345.4050003@gmail.com \
--to=pelkeyj-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.