[__file] Give more precise error message when --state pre-exists
This commit is contained in:
parent
b2db864eaf
commit
46d2487f08
1 changed files with 18 additions and 6 deletions
|
@ -31,12 +31,24 @@ if [ "$state_should" = "pre-exists" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$type" = "file" ]; then
|
case $type in
|
||||||
exit 0 # nothing to do
|
file)
|
||||||
else
|
# nothing to do
|
||||||
echo "File \"$destination\" does not exist"
|
exit 0
|
||||||
exit 1
|
;;
|
||||||
fi
|
none)
|
||||||
|
printf 'File "%s" does not exist\n' "$destination" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
directory|symlink)
|
||||||
|
printf 'File "%s" exists and is a %s, but should be a regular file\n' "$destination" "$type" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
printf 'File or directory "%s" is in an unknown state\n' "$destination" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
upload_file=
|
upload_file=
|
||||||
|
|
Loading…
Reference in a new issue