summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/mount-store13
1 files changed, 9 insertions, 4 deletions
diff --git a/scripts/mount-store b/scripts/mount-store
index 715a8a4..81fe438 100755
--- a/scripts/mount-store
+++ b/scripts/mount-store
@@ -2,7 +2,8 @@
if [ $# -lt 2 ]; then
echo "Bad call to $0." >&2
- echo "Expected: $0 images <source> [username] [password]" >&2
+ echo "Expected: $0 images <source>" >&2
+ echo "USERNAME and PASSWORD are expected environment variables for CIFS" >&2
exit 1
fi
@@ -11,8 +12,8 @@ declare -rg NFS_OPTS="/opt/openslx/nfs.opts"
WHAT="$1"
SOURCE="$2"
-USERNAME="$3"
-PASSWORD="$4"
+[ -n "$3" ] && USERNAME="$3"
+[ -n "$4" ] && PASSWORD="$4"
# Currently WHAT can only be images (the central store for all images),
# but maybe there will be other storage types in the future.
@@ -60,9 +61,11 @@ storage_test () {
return $RET
}
+systemctl stop dnbd3-server.service
+
# Already mounted?
TRIES=0
-while awk '{print $2}' "/proc/mounts" | grep -q "^${DEST}\$"; do
+while awk '{print $2}' "/proc/mounts" | grep -Fxq "${DEST}"; do
echo "Trying to unmount '$DEST'..."
if [ "$TRIES" -gt 5 ]; then
echo "Error: Cannot unmount '$DEST', giving up." >&2
@@ -104,6 +107,7 @@ fi
if [[ "${SOURCE}" == "null" ]]; then
rm -f -- "${FLAG}"
echo "Success. Now using internal storage."
+ systemctl --no-block start dnbd3-server.service
exit 0
fi
@@ -183,6 +187,7 @@ if [ "$RET" = "0" ]; then
echo "----------------------------------"
echo "-- Share mounted successfully! --"
echo "----------------------------------"
+ systemctl --no-block start dnbd3-server.service
fi
exit $RET