# HG changeset patch # User edhoprima@gmail.com # Date 1246296213 0 # Node ID fbb93733098e9b35fdc30ea94ebcca2dff01f692 # Parent 3983d230467d42ee957f910366006a0794962da0 update to 0.2 diff -r 3983d230467d -r fbb93733098e Script_Explanation --- a/Script_Explanation Mon Jun 29 17:17:43 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ -Variables: - -Outer: -- ADDITIONAL_PATH -- MD5 -- DEFAULT_SITE -- BASE_DIR -- MOEFETCHVERSION - -Functions: - -- Msg_Welcome - - Welcome message (MOEFETCHVERSION) -- Err_Help -- Err_Fatal -- Generate_Link - - chdir to ${BASE_DIR}/temp - - fetch xml with wget - - xsltproc the xml -- Check_Tools - - Check if MD5 is empty - if empty: check os - - *BSD: md -r - - Linux/SunOS: md5sum - - Anything else: Err_Fatal - - Get md5 command (MD5_COMMAND) - - Check availability of needed tools - - cut - - sed - - wc - - wget - - xsltproc - - xargs - - rm - - mkdir - - chown - - comm - - grep - - date - - MD5_COMMAND - - Check for grep usability - - TODO: greplace grep -f with POSIX compatible -- Check_Folders - - Check BASE_DIR ownership - - Check: existance (create if not exist) and ownership (apply globally writable permission) of BASE_DIR/: - - temp - - trash - - deleted - - SITE_DIR/TARGET_DIR - - Check if "BASE_DIR/SITE_DIR/TARGET_DIR" is empty: if empty, ISNEW=1 - - Create temporary files: BASE_DIR/temp/${SITE_DIR}-${TARGET_DIR}-: - - error - - ok - - list - - newlist -- Cleanup_Repository - - TRASH_DIR: ${BASE_DIR}/trash/${SITE_DIR}-${TARGET_DIR}-%Y%m%d-%H.%M - - create trash folder - - check if file in "${BASE_DIR}/${SITE_DIR}/${TARGET_DIR}/ fulfills [a-f0-9]{32}\..* or is a folder - - move to trash if is trash - - check if file is contained in ${BASE_DIR}/temp/${SITE_DIR}-${TARGET_DIR}-list - - if is not, move to trash -- Check_Files - - if not ISNEW (empty target folder): - - if not NOCLEAN (not skipping cleanup: - - Call Clean_Repository - - chdir to target folder - - TODO: chdir-free operation - - empty ${BASE_DIR}/temp/${SITE_DIR}-${TARGET_DIR}-err - - check file in current directory (${BASE_DIR}/${SITE_DIR}/${TARGET_DIR}) - - skip if not correct file ([a-f0-9]{32}\..*) - - put into ${BASE_DIR}/temp/${SITE_DIR}-${TARGET_DIR}-error for every error files - - remove the files - - chdir to temp folder - - list ${BASE_DIR}/${SITE_DIR}/${TARGET_DIR}, compare with error, exclude the errors, put into ${SITE_DIR}-${TARGET_DIR}-ok - - get list of new files - compare with ${SITE_DIR}-${TARGET_DIR}-list - - TODO: remove ls, grep -f dependencies - - if ISQUICK: skip check - - if not ISQUICK: print 'empty repository' - - copy ${SITE_DIR}-${TARGET_DIR}-list to ${SITE_DIR}-${TARGET_DIR}-newlist -- Fetch_Images - - chdir to ${BASE_DIR}/temp - - check if ${SITE_DIR}-${TARGET_DIR}-newlist is empty -> stop - - chdir to ${BASE_DIR}/${SITE_DIR}/${TARGET_DIR} - - start wget: wget -e continue=on -bi "${BASE_DIR}/temp/${SITE_DIR}-${TARGET_DIR}-newlist" -o "${BASE_DIR}/temp/${SITE_DIR}-${TARGET_DIR}.log" -- Init - - Add path (PATH) - - Check command (fetch/check/quickfetch/* - JOB) - - Check site (-s or default - SITE) - - Check if not clean folder (-nc/no clean - NOCLEAN) - - Get tags (TAGS) - - Check site - if SITE empty then set default (SITE=DEFAULT_SITE) - - TODO: Validate SITE - - Check tag - if TAGS empty then Err_Fatal - - Get BASE_DIR: default to PWD - fallback to HOME - - Validate BASE_DIR: must absolute path - - Get TARGET_DIR: escape TAGS (replace / with _) - - Get SITE_DIR: escape SITE (remove ending /, replace / with _) diff -r 3983d230467d -r fbb93733098e moefetch.sh --- a/moefetch.sh Mon Jun 29 17:17:43 2009 +0000 +++ b/moefetch.sh Mon Jun 29 17:23:33 2009 +0000 @@ -42,8 +42,7 @@ SED_IS_MD5_FILE="s/\([0-9a-f]\{32\}\..*\)//g" ### TODO: -### - replace `...` with $(..) (DONE) -### - sanity validator +### - sanity validator(?) ### - unified repository to save bandwidth ### - bug stomping ### - sanity checking @@ -51,7 +50,7 @@ # useless welcome message. Also version Msg_Welcome() { - MOEFETCHVERSION="0.2-beta2" + MOEFETCHVERSION="0.2" cat <