/* ** ** wlmback.c Willus.com backup program ** ** Originally written 9-23-99 ** ** Version history ** ** v2.00 2-26-08, Major Rev ** *Added restore capability! See -rx and -rj options. ** Only tested w/zip archives so far. ** *Went to a "fullinc" system where instead of doing ** a full backup every week or every designated number of ** days, an new single incremental is done to the full ** backup (the "fullinc" file). This goes on until the ** fullinc file gets big enough that it doesn't make sense ** any more. This should greatly reduce disk i/o and network ** traffic involved with the backup files. This new method ** can be disabled with the -nfi flag. ** *Instead of incrementals having an "old" and "new" dir, ** they only have a ".wlmback_old_files" dir. New files ** are not put into a special folder. ** *Compiled w/new wlm library that fixes daylight savings ** time date issue with FAT volumes. ** *Zip listings and extractions are case insensitive on Win32. ** *unzip extracts w/-X flag for restore. ** ** v1.35 2-14-08 ** *Includes directories in the archive so that they will ** extract themselves with correct time stamp and owner. ** (zip and linux GNU-tar only for now.) ** *Make compatible with zip 3.0g (Win32 change) which now ** doesn't treat [ as a wildcard character. ** ** v1.34 11-14-07 ** *Include empty directories in the mix so that they don't ** always get put in incremental backups. ** ** v1.33 11-12-07 ** *Added call to filelist_convert_simlink_sizes() so that ** incremental zip backups don't always include all symbolic ** links. ** ** v1.32 10-15-07 ** *Correctly archive file names with '[' in them on Linux(!). ** ** v1.31 10-12-07 ** *Added support for zip 3.0/unzip 6.0 (large files support) ** *-max without args reports max archive size. ** *Bumped ZIP64 limit to 8 EiB. ** *Replaced GB and EB with GiB and EiB (per NIST). ** (see http://physics.nist.gov/cuu/Units/binary.html) ** *Correctly archives file names with '[' in them in zip archives. ** ** v1.30 2-6-07 ** *Uses revamped FILELIST structure from WLM library which ** pools the file name string space to conserve memory. ** *Uses some new ..._in_situ() functions to conserve memory ** for large file lists. ** ** v1.29 11-7-06 ** *Added -mfs option for single file size limit. ** ** v1.28 7-5-06 ** *Increased max file name len from 256 to 512 (re-compiled ** w/new wlm lib). ** ** v1.27 4-3-06 ** *Hopefully fixed more daylight savings time weirdness with ** 7-zip. ** *Slightly changed some of the help text. ** ** v1.26 2-21-06 ** *Option to use lock file to prevent multiple instances from ** running at the same time. ** *For .tgz backups, writes the archive list to a separate ** "cache" file since large .tgz files take a long time to ** list. ** ** v1.25 1-23-06 ** *Avoid repeat calls to list the full backup archive. ** See current_backup_get_list() function. ** *Compiled with modified wfile_reslash() function so that ** Linux file names with a backslash in them (\) are treated ** correctly. ** *Added -nkt flag. ** ** v1.24 1-12-06 ** *Added support for .tgz file archiving. Haven't gotten ** it to work under Windows. ** *Added a windows icon to the build. ** ** v1.23 9-21-05 ** *Discovered bug on a PC where directories that ** contained only excluded files were getting backed up. ** This led to the "dirstoo=3" option for ** filelist_fill_from_disk(). ** *Turned back on linux recursive delete after extensive ** testing. ** ** v1.22 8-9-05 ** *All backups always use an explicit file list now, rather ** than using -x or -i flags with the zip or 7za commands. ** This makes sure that backups are consistent across ** different archiving programs and that wlmback controls ** exactly which files are backed up. This was prompted ** by a problem where zip was recursing through symobolically ** linked directories and ending up in an infinite loop. ** *Added -y to zip option so that symbolic links are stored ** as a link rather than the referenced file (Linux only). ** *Stores symbolic links to dirs (but still doesn't recurse) ** and empty dirs. ** ** v1.21 7-26-05 ** *Increased the zip max size to 256 TB on 64-bit Linux. ** *Auto-detect 64-bit zip/unzip exes. ** *rmdir recursive in Linux doesn't follow symbolic links ** (disastrous!) ** ** v1.20 7-14-05 ** *Make compatible with 7za to surpass the 2 GiB barrier ** and eliminate the need for multipart archives. ** *Made the text output a little more colorful. ** *Increased max includes/excludes from 64 to 1024. ** ** v1.16 6-11-04 ** *Trivial change--changed some of the diagnostic output ** from net_copy(). ** ** v1.15 6-9-04 ** *I added a "remove_old_files()" function which would ** remove files older than the backup cycle, but I'm ** very nervous about implementing it with no error ** checking since a disk write problem could end up ** potentially leaving the user with no backup files. ** I have not implemented it yet, so there is no ** version change. ** ** v1.15 12-3-03 ** *Added -xf and -if options. ** ** v1.14 10-28-03 ** *Added more details about how to use wlmback to the ** wlmback -h usage, including some examples. ** ** v1.13 8-26-03 ** *Fixed a significant bug in Win32 version that prevented ** full backups from being done (see wlmlib v2.69). ** ** v1.12 7-17-03 ** *Smarter about not searching excluded directories. ** *Doesn't follow symbolically linked dirs in unix. ** *Only archives unix files where S_ISREG returns TRUE. ** ** v1.11 1-15-03 ** *Added FTP capability to send backup files to another ** server via FTP (Win32 only). ** ** v1.10 1-6-03 ** *Breaks 2 GiB barrier by creating multiple zip files if ** more than 2 GiB of content. See -max command line option. ** *In Win32, searches path for zip.exe and unzip.exe. ** ** v1.03 2-3-00 ** Made compatible with new wlmlib. Now works only with ** Zip v2.3 in WIN32. Zip v2.2 stores dates differently. ** ** v1.02 11-3-99 ** Recompiled with wlm library v1.59 which now reports ** WIN32 file dates the same whether in daylight savings ** or not. ** ** v1.01 9-29-99 ** Change how "old" files are put in incremental backups. ** ** v1.00 9-23-99 ** wlmback is born. ** ** */