From ebfdb219c63d9139ee9fc249b65e2e761c89586a Mon Sep 17 00:00:00 2001 From: Victor Lowther Date: Sat, 14 Aug 2010 14:23:24 -0500 Subject: [PATCH] Shorten permission checking to ensure we can actually write our initramfs. 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 file changed, 4 insertions(+), 8 deletions(-) diff --git a/dracut b/dracut index 33d802a0e..184b0c1c0 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 -- 2.47.3