diff options
author | Simon Rettberg | 2017-12-06 16:03:07 +0100 |
---|---|---|
committer | Simon Rettberg | 2017-12-06 16:03:07 +0100 |
commit | cd57e005800c313c0a5b679a5928eadda6162e26 (patch) | |
tree | 6bfcee45edf37428154c0fc0fed43abbd45c8c44 /scripts | |
parent | [ad/mountscript] Additionally try 'vers=2.0' as protocol version (diff) | |
download | tmlite-bwlp-cd57e005800c313c0a5b679a5928eadda6162e26.tar.gz tmlite-bwlp-cd57e005800c313c0a5b679a5928eadda6162e26.tar.xz tmlite-bwlp-cd57e005800c313c0a5b679a5928eadda6162e26.zip |
mount-script: Support dnbd3
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/mount-store | 13 |
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 |