On 1/31/21 2:15 PM, Bruce Dubbs wrote:
On 1/31/21 12:44 PM, Scott Andrews wrote:
I have been going through the boot scripts and cleaning them up and I
came across this jewel...
BTW it would be helpful to use some kind of standard in all the boot
scripts, blfs included
mountfs ${failed} is undefined/not defined
case "${1}" in
start) log_info_msg "Remounting root file system in
read-write mode..."
mount --options remount,rw / >/dev/null
evaluate_retval
# Remove fsck-related file system watermarks.
rm -f /fastboot /forcefsck
# Make sure /dev/pts exists
mkdir -p /dev/pts
# This will mount all filesystems that do not have _netdev in
# their option list. _netdev denotes a network filesystem.
log_info_msg "Mounting remaining file systems..."
mount --all --test-opts no_netdev >/dev/null
evaluate_retval
exit ${failed}
^^^^^^^^^^^^^^^^^^^^
This statement is not needed as failed is not set anywhere.
You are right, what should be there is:
mount --all --test-opts no_netdev >/dev/null || failed=1
If 'failed' is unset, then it is ignored so in the case where
everything is OK, it really does not matter, but we could initialize
it to zero.
-- Bruce
Or you could just remove exit ${failed} as the status without the exit
is the same whether it is there or the script normally exits,
Now if you really want to exit the script with and error code then you
need to set it as you posted.
--
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page
Do not top post on this list.
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
http://en.wikipedia.org/wiki/Posting_style