#--[ Intro ]--------------------------------------------------------# # # # Tur-Archiver 2.x is a total rewrite from 1.x. It can copy, move # # or make symlinks from whatever you want, to wherever you want. # # # # It is NOT a spacemaker and shouldnt be used as such. # # # # Its more ment as a "sorter" of some kind. You specify WHERE it # # should look, WHAT it should look for and WHERE you want to put it.# # By putting it, I mean either copy, move or make a symlink to it. # # # #--[ Installation ]-------------------------------------------------# # # # Copy tur-archiver.sh to /glftpd/bin and chmod it to 700 or so. # # # # The included file_date binary is only needed if you wish to set a # # time, in minutes, before this script touches it. If so, either # # copy the binary to /glftpd/bin or compile the source: # # gcc -o /glftpd/bin/file_date file_date.c # # # #--[ Settings ]-----------------------------------------------------# # # # GLROOT = Simple the root of your glftpd dir. # # This is automatically added to the front of each # # source and destination dir you soon choose. # # # # SITEROOT = Path to 'site', from $GLROOT. /site is usually ok. # # # # today = Incase you wish to use this in dated dirs, this will # # automatically set $today to todays dated dir (MMDD). # # The we can use $today in MOVE below. # # # # MOVE = Ahh, the heart of it all. # # Format is: # # Where_To_Look:What_To_Look_For:Where_To_Put_It # # # # Where_To_Look is the source section, relative to # # $GLROOT$SITEROOT, which it will look for stuff in. # # If you must use a space here, use [space] instead. # # -# # If you are working with dated dirs (for example) it # # might be a bit tedious to add: # # /0DAY/0203 # # /0DAY/0204 etc. # # Instead, you can specify /0DAY~DEEP here. # # It will then go into every subdir, part from those # # in EXCLUDE= (below) and process each dir as if you # # had set them up the slow way. # # # # What_To_Look_For is a standard egrep query. That # # means you should know something about basic egrep to # # use it at best. For instance GROUPS means it will # # match the word GROUPS anywhere in the release. # # # # ^GROUPS means the dir must START with GROUPS. # # GROUPS$ means the dir must END with GROUPS. # # ^GROUPS$ means the dir must be named exactly GROUPS. # # # # Any odd chars must be escaped. For instance a . # # would mean "anything" whereas \. means a real dot. # # # # Do NOT use spaces in this one. If you must, use "\ " # # (ie, escape the space). # # # # If you want to search for - . OR _ do [\_-\.] # # For instance [\_-\.]internal[\_-\.] # # # # Seperate different querys with a | sign. # # # # Where_To_Put_It is where to put the resulting dir. # # If you must use a space here, use [space] instead. # # # # EXAMPLE: /0DAY~DEEP:^The\.|\-BP$:/Links # # Go into every subdir of /0DAY, looking for stuff # # that STARTS with "The." and stuff that ENDS with -BP # # and put the results in /Links (/glftpd/site/Links). # # # # CASE_SENSITIVE= TRUE/FALSE. Do you want the What_To_Look_For to # # be case sensitive or not? (egrep -i) # # # # WHAT_TO_DO = What would you like to do in the destination dir? # # S = Make a symlink. # # C = Copy the release here. # # M = Move the release here. # # # # EXCLUDE = This too is a default egrep line, case sensitive. # # Anything matched here will be totally ignored # # even if it matches a hit. # # # # MINUTES_OLD= How old, in minutes, must the release be before we # # do anything to it? Set to "" to move instantly. # # (setting it to 0 will also, but script will run # # faster if you set it to "" since it wont even check) # # # # CHECK_FOR = Anything that must be in the dir before we move it. # # # # By default, its "\ COMPLETE\ \)\ \-" # # which translates to " COMPLETE ) -" # # That happens to be the default line for a complete # # release with zipscript-c. # # # # If the release has multiple CD's, each CDx dir must # # contain this (We'll only check CD1 -> CD9) # # # # This is also an egrep search, case sensitive, so if # # you want to add other stuff that should also make # # the release ok to move just add it here, | seperated # # # # Set to "" to disable or put a # infront of it. # # # # TULS = This is only valid if WHAT_TO_DO is set to M for # # move. It will grab the date on the release before # # moving it and after the move, touch the dir to that # # date so it keeps the same time on it. # # Not everyone needs this as some mv binaries saves # # the time automatically. # # # # To use this function, you'll need a binary called # # tuls. Its available at www.grandis.nu/glftpd as well.# # Read the info in for compile instructions, etc. # # # # Your touch binary also needs to support -d for # # specifying which date to touch it with. # # # # Leave this empty to disable that function. # # # # NO_SFV_OK = TRUE/FALSE. With FALSE, it will just check CHECK_FOR # # and if it exists, its ok to move it (if its old # # enough), but some releases would never get moved. # # Specifically, DIRFIX etc, which has no .sfv and does # # not have a complete dir. # # # # With TRUE, it will check that there really is a sfv # # in the dir. If there is a sfv and CHECK_FOR is not # # found, its NOT ok to move yet (not completed). # # # # In short, if no sfv exists, its ok to move it anyway # # as long as its old enough in MINUTES_OLD. # # # # HOW_TO_SYMLINK = This is how it will run if WHAT_TO_DO is S. # # HOW_TO_MOVE = This is how it will run if WHAT_TO_DO is M. # # HOW_TO_COPY = This is how it will run if WHAT_TO_DO is C. # # # # SYMLINK_CLEAR = TRUE/FALSE. This is only valid if WHAT_TO_DO is # # set to S. # # If this is TRUE, it will delete every # # Where_To_Put_It dir before it starts and then # # recreate them with 755 permissions. # # Its to make sure there are no "dead" symlinks. # # Be careful with this, as it will rm -f any dir # # you set as destination for the symlinks. # # # # If you dont want 755 perms, search for -m755 # # below and change it to whatever you want. # # # # REVERSED_SYMLINK= TRUE/FALSE. # # This is ONLY if you want to move releases. In # # other words, if WHAT_TO_DO is M. # # Setting this to TRUE will move the release as # # usual but then make a symlink in its original # # location. # # # # The symlink will be created using # # HOW_TO_SYMLINK, set above. # # # # These symlinks will not be cleared and # # SYMLINK_CLEAR has no function here. # # # # FILE_DATE = Incase MINUTES_OLD is set, we use the included # # file_date binary to check its age. Here you specify # # it location. # # We could use tuls for this as well, but I'm too lazy # # # # DATE_BIN = Incase MINUTES_OLD is set, we need a GNU compliant # # date binary that supports the -d option. # # Most users can leave it at just "date". # # FBSD users will want to download sh-utils. It will # # install a binary called gdate which you must specify # # here. # # # # DEBUG = TRUE/FALSE. Just a precation. You must set this to # # FALSE for it to actually do anything. With it on # # TRUE, its the same as if you used the 'debug' arg. # # # #--[ Running it ]---------------------------------------------------# # # # Running it with the argument 'debug' (without the '') will not do # # anything except show you what it WOULD have done. I recomend you # # use this everytime you make a change in any part. # # # # Running it without args will make a live run. Shouldnt output # # anything then. If DEBUG=TRUE, it will still not do anything ! # # # #--[ Changelog ]----------------------------------------------------# # # # 2.5 : When checking how old a release is, it simply did not # work. Now, since nobody has complained about this and its # been a long time since 2.4, I'm not sure if this applies # to everyone. # In either case; # REL_DATE="`$DATE_BIN -d "$($FILE_DATE $releasename)" +%s`" # was changed to: # REL_DATE="`$DATE_BIN -d "$($FILE_DATE $FROM_DIR/$releasename)" +%s`" # so if the new version does not work for you when checking # the age of releases, change it back to what it was =) # # 2.4 : The path in MOVE now support ~DEEP to enter each subdir # # of the defined dir. # # # # 2.3 : Added TULS=. Read up on it above. # # # # Fixed a cosmetic "integer expression expected" if the # # release is 0 seconds old. # # # # 2.2 : Added REVERSED_SYMLINK function. This will make a symlink # # in the original location of the release if WHAT_TO_DO is # # set to move stuff. # # Idea by LPC. # # # # Changed ROOT=/glftpd/site to GLROOT=/glftpd # # Changed SYM_ROOT=/site to SITEROOT=/site # # Above changes was made to more easely create symlinks. # # # # 2.1 : Added NO_SFV_OK. Check explanation above. # # # # Fixed a problem if the release was less then 60 seconds # # old. It would get moved even if MINUTES_OLD was set. # # # # Big thanks to DaShizNit for ideas and testing the 2.+ # # versions. # # # # 2.0 : Total rewrite of the 1.x series. Can do a lot more now. #