comparison Script_Explanation @ 193:ac6533a8fb51

- Documentation - Cleanup
author edhoprima@gmail.com <edhoprima@gmail.com>
date Mon, 29 Jun 2009 10:49:40 +0000
parents
children
comparison
equal deleted inserted replaced
192:47efb7a23425 193:ac6533a8fb51
1 Variables:
2
3 Outer:
4 - ADDITIONAL_PATH
5 - MD5
6 - DEFAULT_SITE
7 - BASE_DIR
8 - MOEFETCHVERSION
9
10 Functions:
11
12 - Msg_Welcome
13 - Welcome message (MOEFETCHVERSION)
14 - Err_Help
15 - Err_Fatal
16 - Generate_Link
17 - chdir to ${BASE_DIR}/temp
18 - fetch xml with wget
19 - xsltproc the xml
20 - Check_Tools
21 - Check if MD5 is empty - if empty: check os
22 - *BSD: md -r
23 - Linux/SunOS: md5sum
24 - Anything else: Err_Fatal
25 - Get md5 command (MD5_COMMAND)
26 - Check availability of needed tools
27 - cut
28 - sed
29 - wc
30 - wget
31 - xsltproc
32 - xargs
33 - rm
34 - mkdir
35 - chown
36 - comm
37 - grep
38 - date
39 - MD5_COMMAND
40 - Check for grep usability
41 - TODO: greplace grep -f with POSIX compatible
42 - Check_Folders
43 - Check BASE_DIR ownership
44 - Check: existance (create if not exist) and ownership (apply globally writable permission) of BASE_DIR/:
45 - temp
46 - trash
47 - deleted
48 - SITE_DIR/TARGET_DIR
49 - Check if "BASE_DIR/SITE_DIR/TARGET_DIR" is empty: if empty, ISNEW=1
50 - Create temporary files: BASE_DIR/temp/${SITE_DIR}-${TARGET_DIR}-:
51 - error
52 - ok
53 - list
54 - newlist
55 - Cleanup_Repository
56 - TRASH_DIR: ${BASE_DIR}/trash/${SITE_DIR}-${TARGET_DIR}-%Y%m%d-%H.%M
57 - create trash folder
58 - check if file in "${BASE_DIR}/${SITE_DIR}/${TARGET_DIR}/ fulfills [a-f0-9]{32}\..* or is a folder
59 - move to trash if is trash
60 - check if file is contained in ${BASE_DIR}/temp/${SITE_DIR}-${TARGET_DIR}-list
61 - if is not, move to trash
62 - Check_Files
63 - if not ISNEW (empty target folder):
64 - if not NOCLEAN (not skipping cleanup:
65 - Call Clean_Repository
66 - chdir to target folder
67 - TODO: chdir-free operation
68 - empty ${BASE_DIR}/temp/${SITE_DIR}-${TARGET_DIR}-err
69 - check file in current directory (${BASE_DIR}/${SITE_DIR}/${TARGET_DIR})
70 - skip if not correct file ([a-f0-9]{32}\..*)
71 - put into ${BASE_DIR}/temp/${SITE_DIR}-${TARGET_DIR}-error for every error files
72 - remove the files
73 - chdir to temp folder
74 - list ${BASE_DIR}/${SITE_DIR}/${TARGET_DIR}, compare with error, exclude the errors, put into ${SITE_DIR}-${TARGET_DIR}-ok
75 - get list of new files - compare with ${SITE_DIR}-${TARGET_DIR}-list
76 - TODO: remove ls, grep -f dependencies
77 - if ISQUICK: skip check
78 - if not ISQUICK: print 'empty repository'
79 - copy ${SITE_DIR}-${TARGET_DIR}-list to ${SITE_DIR}-${TARGET_DIR}-newlist
80 - Fetch_Images
81 - chdir to ${BASE_DIR}/temp
82 - check if ${SITE_DIR}-${TARGET_DIR}-newlist is empty -> stop
83 - chdir to ${BASE_DIR}/${SITE_DIR}/${TARGET_DIR}
84 - start wget: wget -e continue=on -bi "${BASE_DIR}/temp/${SITE_DIR}-${TARGET_DIR}-newlist" -o "${BASE_DIR}/temp/${SITE_DIR}-${TARGET_DIR}.log"
85 - Init
86 - Add path (PATH)
87 - Check command (fetch/check/quickfetch/* - JOB)
88 - Check site (-s <site> or default - SITE)
89 - Check if not clean folder (-nc/no clean - NOCLEAN)
90 - Get tags (TAGS)
91 - Check site - if SITE empty then set default (SITE=DEFAULT_SITE)
92 - TODO: Validate SITE
93 - Check tag - if TAGS empty then Err_Fatal
94 - Get BASE_DIR: default to PWD - fallback to HOME
95 - Validate BASE_DIR: must absolute path
96 - Get TARGET_DIR: escape TAGS (replace / with _)
97 - Get SITE_DIR: escape SITE (remove ending /, replace / with _)