diff --git a/site-update.sh b/site-update.sh index c1315bf..f80bad9 100755 --- a/site-update.sh +++ b/site-update.sh @@ -42,7 +42,7 @@ checkout_branch() { } copy_to_dest () { - cp -r "${SRCDIR/*}" "${OUTDIR}" + cp -r "${SRCDIR}/." "${OUTDIR}" } update_publish() { @@ -57,14 +57,18 @@ update_publish() { if [[ "$PUBONLY" == false ]]; then get_changes fi - diff "${SRCDIR} ${OUTDIR}" - local rc=$? - if [[ $rc -eq 1 ]]; then + if diff "${SRCDIR}" "${OUTDIR}" >/dev/null; then + echo "No changes detected." + else copy_to_dest fi } main() { + srcdirlen=${#SRCDIR} + if [[ ${SRCDIR:(-1)} == '/' ]]; then + SRCDIR=${SRCDIR:0:-1} + fi if [[ -f "$FILE" ]]; then while read -r src out rem; do # use rem as dummy variable to guarantee out countains one word