Date: Sat, 23 Oct 2010 20:26:41 -0700 From: Garrett Cooper <gcooper@FreeBSD.org> To: rc@freebsd.org Subject: Re: [PATCH] /etc/rc.d/mdconfig improvements Message-ID: <AANLkTikozJqrZtcZZ3Eop7AJ2QdsOxA0hYs4_XxpFjbv@mail.gmail.com> In-Reply-To: <AANLkTikEmEJ1fGAQWC_nFk0-DU6kY0hWSqq39YvBAeHN@mail.gmail.com> References: <AANLkTikEmEJ1fGAQWC_nFk0-DU6kY0hWSqq39YvBAeHN@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
On Sun, Oct 10, 2010 at 8:48 PM, Garrett Cooper <gcooper@freebsd.org> wrote:
> Hi RC folks,
> I was looking at /etc/rc.d/mdconfig* recently, and I thought of
> two improvements that could be done to the scripts:
> 1. It's not overly intuitive from the rc.conf manpage that the
> memory disks need to be defined in /etc/fstab, so I added an error to
> coach people on what to do
> 2. There was also a missing guard for around a ${_file} reference
> where if I did...
>
> /dev/md0 /scratch cd9660 rw
> 0 0
> /dev/md1 /scratch2 ufs rw 0 0
>
> mdconfig_md0="-f /scratch/disk.img -t vnode"
> mdconfig_md1="-t swap -s 1M"
>
> ... it would check test for ${_file} twice and fail the second
> time. The check is benign in most cases, but for completeness it
> should be fixed as shown above.
> Could someone please commit the attached patch for me, if no one
> objects to the change proposed?
(Resending with a .patch extension just in case)
Does anyone have any comments about the attached patch?
Thanks!
-Garrett
[-- Attachment #2 --]
Index: etc/rc.d/mdconfig
===================================================================
--- etc/rc.d/mdconfig (revision 213680)
+++ etc/rc.d/mdconfig (working copy)
@@ -146,6 +146,8 @@
if mount -d ${_dev} 2>&1 >/dev/null; then
echo "Mounting ${_dev}."
mount ${_dev}
+ else
+ err 1 "Mountpoint for ${_dev} not defined in /etc/fstab"
fi
fi
done
Index: etc/rc.d/mdconfig2
===================================================================
--- etc/rc.d/mdconfig2 (revision 213680)
+++ etc/rc.d/mdconfig2 (working copy)
@@ -113,9 +113,11 @@
for _md in ${_mdconfig2_list}; do
init_variables ${_md}
- if [ ! -r ${_file} ]; then
- err 3 "${_file} doesn't exist"
- continue
+ if [ "${type}" = "vnode" ]; then
+ if [ ! -r "${_file}" ]; then
+ err 3 "${_file} doesn't exist"
+ continue
+ fi
fi
# First pass: create md(4) vnode devices from files stored on
# non-root partition. Swap and malloc md(4) devices have already
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTikozJqrZtcZZ3Eop7AJ2QdsOxA0hYs4_XxpFjbv>
