aboutsummaryrefslogtreecommitdiff
path: root/utilities/ovs-pki.in
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2010-08-06 13:32:47 -0700
committerBen Pfaff <blp@nicira.com>2010-08-06 13:32:47 -0700
commitccc9fc5a70e2af642721fa9356d7fbcb9a697d06 (patch)
tree3b325502849f29ecefadcb857b35dc9764486e28 /utilities/ovs-pki.in
parent7cdc630f61b34dc4d54eb9fc0379dd18d0930a79 (diff)
ovs-pki: Create log directory if it does not exist.
Otherwise "ovs-pki init" can create the pkidir and then fail when it tries to create the log file, if it is in a directory that does not exist.
Diffstat (limited to 'utilities/ovs-pki.in')
-rwxr-xr-xutilities/ovs-pki.in9
1 files changed, 9 insertions, 0 deletions
diff --git a/utilities/ovs-pki.in b/utilities/ovs-pki.in
index b91d0614..cbdb43d0 100755
--- a/utilities/ovs-pki.in
+++ b/utilities/ovs-pki.in
@@ -176,6 +176,15 @@ case $log in
*) $log="$PWD/$log" ;;
esac
+logdir=$(dirname "$log")
+if test ! -d "$logdir"; then
+ mkdir -p -m755 "$logdir" 2>/dev/null || true
+ if test ! -d "$logdir"; then
+ echo "$0: log directory $logdir does not exist and cannot be created" >&2
+ exit 1
+ fi
+fi
+
if test "$command" = "init"; then
if test -e "$pkidir" && test "$force" != "yes"; then
echo "$0: $pkidir already exists and --force not specified" >&2