These tests can be combined into an if... elif... elif... statement, and
that makes it clear they are all part of the same test.
---
dracut | 12 ++++--------
1 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/dracut b/dracut
index 33d802a..184b0c1 100755
--- a/dracut
+++ b/dracut
@@ -210,18 +210,14 @@ if [[ -f $outfile && ! $force ]]; then
exit 1
fi
-outdir=$(dirname "$outfile")
-if ! [[ -d "$outdir" ]]; then
+outdir=${outfile%/*}
+if [[ ! -d "$outdir" ]]; then
echo "Can't write $outfile: Directory $outdir does not exist."
exit 1
-fi
-
-if ! [[ -w "$outdir" ]]; then
+elif [[ ! -w "$outdir" ]]; then
echo "No permission to write $outdir."
exit 1
-fi
-
-if [[ -f "$outfile" ]] && ! [[ -w "$outfile" ]]; then
+elif [[ ! -w "$outfile" ]]; then
echo "No permission to write $outfile."
exit 1
fi
--
1.7.2.1
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html