don't exit upgrade-script with 'exit 1'
authorMaximilian Wilhelm <max@rfc2324.org>
Sat, 10 Sep 2005 19:39:40 +0000 (19:39 +0000)
committerMaximilian Wilhelm <max@rfc2324.org>
Sat, 10 Sep 2005 19:39:40 +0000 (19:39 +0000)
files/server/upgrade_sshkeysync

index c294168..a62a0f6 100755 (executable)
@@ -94,6 +94,9 @@ EOF
 ##
 # Upgrade the filesystem structure
 function upgrade_dirs() {
+       echo "=========="
+       echo "Upgrade file system structure:"
+
        # Check for old style config
        if ! grep -q '\[general\]' "${CONFIGFILE}"; then
 
@@ -114,19 +117,22 @@ function upgrade_dirs() {
        # Check values
        if [ -z "${BASE_DIR}" ]; then
                export BASE_DIR="/var/cache/ssh-keync"
-               echo "Warning: BASE_DIR is undefined, defaulting to ${BASE_DIR}">&2
+               echo " Warning: BASE_DIR is undefined, defaulting to ${BASE_DIR}">&2
+       fi
+
+       if [ ! -d "${BASE_DIR}/keys" ]; then
+               echo " Old style key dir does not exists. No update neccassary." >&2
+               exit 0
        fi
 
        [ "${DOMAIN_LIST}" ] && DOMAIN=`echo ${DOMAIN_LIST} | cut -d, -f1`
        if [ -z "${DOMAIN}" ]; then
-               echo "Error: No domain specified in configuration, cannot continue automagic update." >&2
-               exit 1
+               echo " Error: No domain specified in configuration, cannot continue automagic update." >&2
+               exit 0
        fi
 
 
        # Go for it
-       echo "=========="
-       echo "Upgrade file system structure:"
        if [ -d "${BASE_DIR}/keys" ]; then
                echo -n " * Creating domain directory: ${BASE_DIR}/${DOMAIN} ... "
                mkdir -p "${BASE_DIR}/${DOMAIN}" && echo "done." || echo "Failed!"