VOLUMEFILES=$( ls -1 ${VOLUMEDIR} )
while IFS= read -r VOLUMEFILE; do
FILE=$( basename "${VOLUMEFILE}" )
- if [ "${FILE}" != "${FILE#Jalview}" -a "${FILE}" != "${FILE%.app}" ]; then
- APP="${FILE}"
+ if [ "$FILE" != "${FILE#Jalview}" -a "$FILE" != "${FILE%.app}" ]; then
+ APP="$FILE"
break
fi
done <<< "$VOLUMEFILES"
-[ -z "${APP}" ] && echo "Could not find Jalview\*.app in the volume '${VOLUMEDIR}'" && exit 10
+[ -z "$APP" ] && echo "Could not find Jalview\*.app in the volume '${VOLUMEDIR}'" && exit 10
APPNAME=$( basename "$APP" )
# ensure no trailing slash on APPNAME or APPLICATIONFOLDER (important for rsync)
-while [ "${APPLICATIONFOLDER}" != "${APPLICATIONFOLDER%/}" -a "${APPLICATIONFOLDER}" != "/" ]; do
+while [ "${APPLICATIONFOLDER}" != "/" ]; do
APPLICATIONFOLDER=${APPLICATIONFOLDER%/}
done
while [ "${APPNAME}" != "${APPNAME%/}" ]; do
APPNAME=${APPNAME%/}
done
-[ -z "${APPNAME}" ] && echo "Could not find suitable Jalview\*.app in the volume '${VOLUMEDIR}'" && exit 11
-
-# rsync .app from mounted volume to application folder
-myecho "Rsyncing '${VOLUMEDIR}/${APPNAME}' to '${APPLICATIONFOLDER}/${APPNAME}'"
-rsync ${RSYNCOPT} -ah --delete "${VOLUMEDIR}/${APPNAME}" "${APPLICATIONFOLDER}/"
-[ $? != 0 ] && echo "Possible problem when rsyncing '${APP}' to '${APPLICATIONFOLDER}'" && exit 12
-myecho "Finished rsync"
+[ -z "$APPNAME" -o "${APPNAME%.app}" = "$APPNAME" ] && echo "Could not find suitable Jalview\*.app in the volume '${VOLUMEDIR}'" && exit 11
+
+## rsync .app from mounted volume to application folder
+#myecho "Rsyncing '${VOLUMEDIR}/${APPNAME}' to '${APPLICATIONFOLDER}/${APPNAME}'"
+#rsync ${RSYNCOPT} -ah --delete "${VOLUMEDIR}/${APPNAME}" "${APPLICATIONFOLDER}/"
+#[ $? != 0 ] && echo "Possible problem when rsyncing '${APP}' to '${APPLICATIONFOLDER}'" && exit 12
+#myecho "Finished rsync"
+
+# using ditto
+APPPATH="${APPLICATIONFOLDER}/${APPNAME}"
+OLDAPPPATH="${APPPATH}.old"
+myecho "Copying '${VOLUMEDIR}/${APPNAME}' to '${APPPATH}'"
+if [ -e "$APPPATH" ]; then
+ if [ -e "$OLDAPPPATH" ]; then
+ rm -Rf "$OLDAPPPATH"
+ fi
+ mv "$APPPATH" "$OLDAPPPATH"
+fi
+ditto "${VOLUMEDIR}/${APPNAME}" "$APPPATH" && [ -e "$OLDAPPPATH" ] && rm -Rf "$OLDAPPPATH"
+myecho "Finished copying '${APPNAME}'"
EXIT=0
declare -a WARNINGS=()
addwarning() {
- W=$1
- N=$2
+ local W=$1
+ local N=$2
myecho "${W}"
WARNINGS=( "${WARNINGS[@]}" "${W}" )
# exit with the first warning value