From 14c261bc71f7adffb607d8762b185c4cef932393 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 18 Sep 2015 17:11:21 +0200 Subject: Update --- scripts/mount-store | 9 ++++++++- scripts/system-restore | 42 +++++++++++++++++++++++------------------- 2 files changed, 31 insertions(+), 20 deletions(-) (limited to 'scripts') diff --git a/scripts/mount-store b/scripts/mount-store index cd777a8..260b0c7 100755 --- a/scripts/mount-store +++ b/scripts/mount-store @@ -56,11 +56,17 @@ fi # Unmount and not requested to mount (local mode) if [[ "${SOURCE}" == "null" ]]; then rm -f "${FLAG}" + echo "Success. Now using internal storage." exit 0 fi touch "${FLAG}" +if [[ "${SOURCE}" == "unknown" ]]; then + echo "Storage type not configured, doing nothing." + exit 0 +fi + # Mount! if grep -E -q '^[^/].+:.+' <<<$SOURCE; then @@ -94,7 +100,8 @@ echo "----------------------------------" if [ "$RET" == "0" ]; then rm -f "${FLAG}" if [ -e "${FLAG}" ]; then - echo "Error: File '.notmounted' exists on remote storage. Delete first!" >&2 + echo "Error: File '.notmounted' exists on remote storage and could not be deleted." >&2 + echo "Error: Make sure the share is writable." >&2 umount -v "$DEST" exit 5 fi diff --git a/scripts/system-restore b/scripts/system-restore index 8a66558..7b0de12 100755 --- a/scripts/system-restore +++ b/scripts/system-restore @@ -1,29 +1,33 @@ #!/bin/bash -RES_OPENSLX=0 -RES_SAT=0 -case "$1" in - both) - RES_OPENSLX=1 - RES_SAT=1 - ;; - openslx) - RES_OPENSLX=1 - ;; - sat) - RES_SAT=1 - ;; - *) - echo "Error: Restore mode must be one of both, openslx, sat" - exit 1 - ;; -esac - BACKUP="$1" if [ -z "$BACKUP" ] || [ ! -f "$BACKUP" ]; then echo "Backup file not found: $BACKUP" exit 1 fi +shift + +RES_OPENSLX=0 +RES_SAT=0 +while [ $# -gt 0 ]; do + case "$1" in + openslx) + RES_OPENSLX=1 + echo "Restoring system config" + ;; + dozmod) + RES_SAT=1 + echo "Restoring VM and lecture db" + ;; + *) + echo "Error: Restore mode params must be one of openslx, dozmod (Got $1)" + exit 1 + ;; + esac + shift +done + +[ "$RES_OPENSLX$RES_SAT" = "00" ] && exit 1 if [ "$(whoami)" != "root" ]; then echo "Must be running as root!" -- cgit v1.2.3-55-g7522