From 4f1c7815af9a2705504fa008894c7c14c35481a6 Mon Sep 17 00:00:00 2001 From: Willem Jan Withagen Date: Thu, 29 Aug 2019 15:20:46 +0200 Subject: [PATCH] vstart.sh: Make sure mkdir succeeds Even in the case the full path was not created, make sure mkdir does create the full path. And while there replaced some `test ....` with `[ ... ]` like in the remainder of the file. Signed-off-by: Willem Jan Withagen --- src/vstart.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/vstart.sh b/src/vstart.sh index ffe43fda146..40267bd6853 100755 --- a/src/vstart.sh +++ b/src/vstart.sh @@ -1027,17 +1027,17 @@ fi [ -z "$INIT_CEPH" ] && INIT_CEPH=$CEPH_BIN/init-ceph # sudo if btrfs -test -d $CEPH_DEV_DIR/osd0/. && test -e $CEPH_DEV_DIR/sudo && SUDO="sudo" +[ -d $CEPH_DEV_DIR/osd0/. ] && [ -e $CEPH_DEV_DIR/sudo ] && SUDO="sudo" prun $SUDO rm -f core* -test -d $CEPH_ASOK_DIR || mkdir $CEPH_ASOK_DIR -test -d $CEPH_OUT_DIR || mkdir $CEPH_OUT_DIR -test -d $CEPH_DEV_DIR || mkdir $CEPH_DEV_DIR +[ -d $CEPH_ASOK_DIR ] || mkdir -p $CEPH_ASOK_DIR +[ -d $CEPH_OUT_DIR ] || mkdir -p $CEPH_OUT_DIR +[ -d $CEPH_DEV_DIR ] || mkdir -p $CEPH_DEV_DIR $SUDO rm -rf $CEPH_OUT_DIR/* -test -d gmon && $SUDO rm -rf gmon/* +[ -d gmon ] && $SUDO rm -rf gmon/* -[ "$cephx" -eq 1 ] && [ "$new" -eq 1 ] && test -e $keyring_fn && rm $keyring_fn +[ "$cephx" -eq 1 ] && [ "$new" -eq 1 ] && [ -e $keyring_fn ] && rm $keyring_fn # figure machine's ip