-----Original Message-----
From: d.hatayama(a)fujitsu.com [mailto:d.hatayama@fujitsu.com]
Sent: Wednesday, November 13, 2019 6:40 PM
To: Onitsuka, Shinichi/鬼束 伸一 <onitsuka.shinic(a)fujitsu.com>
Cc: kexec(a)lists.fedoraproject.org; 'Kairui Song' <kasong(a)redhat.com>
Subject: RE: [PATCH 3/3] dracut-module-setup.sh: Install files under
/etc/kdump/{pre.d,post.d} into kdump initramfs
> -----Original Message-----
> From: Kairui Song [mailto:kasong@redhat.com]
> Sent: Tuesday, November 12, 2019 6:08 PM
> To: Onitsuka, Shinichi/鬼束 伸一 <onitsuka.shinic(a)fujitsu.com>
> Cc: kexec(a)lists.fedoraproject.org
> Subject: Re: [PATCH 3/3] dracut-module-setup.sh: Install files under
> /etc/kdump/{pre.d,post.d} into kdump initramfs
>
> On Wed, Nov 6, 2019 at 12:28 PM onitsuka.shinic(a)fujitsu.com
> <onitsuka.shinic(a)fujitsu.com> wrote:
> >
> > This patch installs the binary and script files under
> /etc/kdump/{pre.d,post.d} into
> > new initramfs of kdump.
> >
> > Signed-off-by: shin-onitsuka <onitsuka.shinic(a)fujitsu.com>
> >
> > ---
> > dracut-module-setup.sh | 20 ++++++++++++++++++++
> > 1 file changed, 20 insertions(+)
> >
> > diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
> > index b186b38..414a184 100755
> > --- a/dracut-module-setup.sh
> > +++ b/dracut-module-setup.sh
> > @@ -530,6 +530,8 @@ kdump_install_conf() {
> > esac
> > done <<< "$(read_strip_comments /etc/kdump.conf)"
> >
> > + kdump_install_preafter_conf
> > +
> > default_dump_target_install_conf
> >
> > kdump_configure_fence_kdump "${initdir}/tmp/$$-kdump.conf"
> > @@ -537,6 +539,24 @@ kdump_install_conf() {
> > rm -f ${initdir}/tmp/$$-kdump.conf
> > }
> >
> > +# install etc/kdump/pre.d and /etc/kdump/post.d
> > +kdump_install_preafter_conf() {
> > + if [ -d /etc/kdump/pre.d ]; then
> > + for file in `find /etc/kdump/pre.d`; do
>
> Same as in 2/3, I think it's better to find only script files with
> executable permission.
>
> > + dracut_install $file
> > + done
> > + fi
> > +
> > + if [ -d /etc/kdump/post.d ]; then
> > + for file in `find /etc/kdump/post.d`; do
> > + dracut_install $file
> > + done
> > + fi
> > +
> > + dracut_install /usr/bin/find
> > + dracut_install /usr/bin/sort
>
> If doable, I prefer to introduce as less binary as possible in the initramfs.
> This will make find and sort always included in the initramfs, even if
> there is no pre/post executable. Which may increase the initrmafs
> size unnecessarily.
Again, comment in similar direction with the Kairui's.
find command is unnecessary here.
Pattern matching in bash seems enough just like:
if [ -d /etc/kdump/post.d ]; then
for file in /etc/kdump/post.d/*; do
if [ -x "$file" ]; then
dracut_install $file
fi
done
fi
sort command is also unnecessary.
Bash's pattern matching expands files in the alphabetical order.
Quoted from man 1 bash:
Pathname Expansion
After word splitting, unless the -f option has been set,
bash scans each word for the characters *, ?, and [. If one
of these characters appears, then the word is regarded as a
pattern, and replaced with an alphabetically sorted list of
filenames matching the pattern (see Pattern Matching below).
/etc/rc.d/rc in initscripts package relies on this:
https://github.com/fedora-sysv/initscripts/blob/164d1ede7161233a2a2fe6e4c...
>
>
> > +}
> > +
> > # Default sysctl parameters should suffice for kdump kernel.
> > # Remove custom configurations sysctl.conf & sysctl.d/*
> > remove_sysctl_conf() {
> > --
> > 1.8.3.1
> > _______________________________________________
> > kexec mailing list -- kexec(a)lists.fedoraproject.org
> > To unsubscribe send an email to kexec-leave(a)lists.fedoraproject.org
> > Fedora Code of Conduct:
>
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
> > List Guidelines:
https://fedoraproject.org/wiki/Mailing_list_guidelines
> > List Archives:
>
https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.or
> g
>
> --
> Best Regards,
> Kairui Song
> _______________________________________________
> kexec mailing list -- kexec(a)lists.fedoraproject.org
> To unsubscribe send an email to kexec-leave(a)lists.fedoraproject.org
> Fedora Code of Conduct:
>
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
> List Guidelines:
https://fedoraproject.org/wiki/Mailing_list_guidelines
> List Archives:
>
https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.or
> g
_______________________________________________
kexec mailing list -- kexec(a)lists.fedoraproject.org
To unsubscribe send an email to kexec-leave(a)lists.fedoraproject.org
Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines:
https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives:
https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.or
g