Mercurial > ec-dotfiles
diff moefetch.sh @ 191:a4ceb952b05a
more noclean support code
author | edhoprima@gmail.com <edhoprima@gmail.com> |
---|---|
date | Sun, 28 Jun 2009 17:18:41 +0000 |
parents | 1061a214a1f1 |
children | 47efb7a23425 |
line wrap: on
line diff
--- a/moefetch.sh Sun Jun 28 14:07:53 2009 +0000 +++ b/moefetch.sh Sun Jun 28 17:18:41 2009 +0000 @@ -152,7 +152,7 @@ # current dir: ${BASE_DIR}/${SITE_DIR}/${TARGET_DIR} echo "Cleaning up repository folder..." - TRASH_DIR="${SITE_DIR}-${TARGET_DIR}-`date -u +%Y%m%d-%H.%M`" + TRASH_DIR=$(date -u "+${SITE_DIR}-${TARGET_DIR}-%Y%m%d-%H.%M") mkdir -p "${BASE_DIR}/trash/${TRASH_DIR}" || Err_Fatal "Unable to create trash folder" for TRASH in "${BASE_DIR}/${SITE_DIR}/${TARGET_DIR}/"* do @@ -160,7 +160,11 @@ if [ -d "${TRASH}" ]; then ISTRASH=1 else - [ "`echo \"${FILE}\" | sed -e 's/.*\/\([\^\/]*\)/\1/g;s/\([0-9a-f]\{32\}.*\)//g' | grep -v ^$`" ] && ISTRASH=1 + if [ "$(echo "${FILE}" | sed -e 's/.*\/\([\^\/]*\)/\1/g;s/\([0-9a-f]\{32\}.*\)//g' | grep -v ^$)" ]; then + ISTRASH=1 + else + [ "$(cat "${BASE_DIR}/temp/${TARGET_DIR}-list" | sed -e 's/.*\/\([^\/]*\)/\1/g' | grep $(echo "${TRASH}" | sed -e 's/.*\/\([^\/]*\)/\1/g'))" ] || ISTRASH=1 + fi fi if [ "${ISTRASH}" ]; then mv -f "${TRASH}" "${BASE_DIR}/trash/${TRASH_DIR}" || Err_Fatal "Error deleting files" @@ -168,6 +172,7 @@ fi done rmdir "${BASE_DIR}/trash/${TRASH_DIR}" 2>/dev/null + } # check files correctness @@ -184,8 +189,8 @@ else if [ "`${MD5} "${FILE}" | cut -d ' ' -f1 -`" != "`echo "${FILE}" | cut -d '.' -f1`" ] then + echo "${FILE}" >> "${BASE_DIR}/temp/${SITE_DIR}-${TARGET_DIR}-error" echo - echo "${FILE}" >> "${BASE_DIR}/temp/${SITE_DIR}-${TARGET_DIR}-error" echo "Error: ${FILE}" fi printf "."