Skip to content

Commit fb73ac7

Browse files
authored
Update install.sh: My contents of html/allsky/myFiles back if the prior directory exists
1 parent 975aae7 commit fb73ac7

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

install.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2770,8 +2770,18 @@ do_restore()
27702770

27712771
ITEM="${SPACE}${SPACE}${ALLSKY_MYFILES_NAME}"
27722772
if [[ -d ${ALLSKY_WEBSITE_MYFILES_DIR} ]]; then
2773-
display_msg --log progress "${ITEM} (moving back)"
2774-
mv "${ALLSKY_WEBSITE_MYFILES_DIR}" "${PRIOR_WEBSITE_DIR}"
2773+
# If the prior directory exists, move the FILES in the current directory there,
2774+
# but don't move the whole directory or else we'll get a "mv" error.
2775+
D="${PRIOR_WEBSITE_DIR}/${ALLSKY_MYFILES_NAME}"
2776+
if [[ -d ${D} ]]; then
2777+
display_msg --log progress "${ITEM} (moving contents back)"
2778+
(shopt -s dotglob
2779+
mv "${D}"/* "${ALLSKY_WEBSITE_MYFILES_DIR}" 2>/dev/null
2780+
)
2781+
else
2782+
display_msg --log progress "${ITEM} (moving directory back)"
2783+
mv "${ALLSKY_WEBSITE_MYFILES_DIR}" "${PRIOR_WEBSITE_DIR}"
2784+
fi
27752785
else
27762786
display_msg --logonly info "${ITEM}: ${NOT_RESTORED}"
27772787
fi

0 commit comments

Comments
 (0)