hdup-2.0.14/0002700000175000000270000000000010346355761011014 5ustar frankiehdup-2.0.14/doc/0002700000175000000270000000000010346355756011565 5ustar frankiehdup-2.0.14/doc/hdup.conf.50000600000175000000270000003216310312632705013525 0ustar frankie.\" @(#)hdup.conf.1 1.6.7 18-Mar-2003 OF; .TH hdup.conf 5 "18 Mar 2003" .SH NAME hdup.conf \- the hdup configuration file .SH DESCRIPTION The configuration file syntax of \fBhdup\fR is borrowed from SaMBa (which is more commonly known as an ini-style config file). A '#' as the first character on a line is the start of a comment. Blank lines are skipped. Multiple entries on a line must separated by commas: ",". Some options can be turned on and off. These are binary options. All binary option default to 'off'. They are turned on by 'yes','on' or 'true' and are turned off with 'no', 'off' or 'false'. The [global] section is required to be the first section in the configuration files. Options specified under [global] are also used in [host] sections. They can overridden when they are also specified under that [host] statement. This works for \fIall\fR options. Further to this, one [host] statement can inherit from another [host] statement. Config entries may be given multiple times, in that case the latest one is taken as the final choice. It is further best described by an example: .TS tab (@); l l. # # backup config for hdup # [global] archive dir = /tmp/storage/ compression = gzip user = operator proto = /usr/bin/ssh proto option = -q -oProtocol=2 overwrite = yes [host-name-a-conf] dir = /var/www, /etc/cron.d [host-name-a-root] dir = /root/.cpan/Bundle [host-name-a] inherit = host-name-a-conf, host-name-a-root allow remote = yes .TE .PP .SS [global] The [global] section is required. The keywords specified under it are used for each host (globally). All keywords specified under [global] are inherited by the other hosts. Ie. if you specify 'compression = gzip' under global, all hosts who do not redefine 'compression' will use 'gzip'. .SS [host-name] This is a host statement. For every host you want to back up there should be a host statement. This is also true when you are restoring an archive. Host statements can inherit from other host statements. Any keywords initialised for the original host, will append to, or overwrite, the current keywords. There is a maximum of 255 different hosts in 1 hdup configuration file. Be aware that \fIarchive dir\fR \fBmust\fR be specified in the configuration file, \fIdir\fR is only needed when performing backups. When restoring it is not needed. .SS Keywords The following keywords are supported: \fIalgorithm\fR, \fIallow remote\fR, \fIalways backup\fR, \fIarchive dir\fR, \fIchunk size\fR, \fIcompression\fR,\fIcompression level\fI, \fIdate spec\fR \fIdir\fR, \fIexclude\fR, \fIforce\fR, \fIfree\fR, \fIgroup\fR, \fIgpg\fR, \fIinclude\fR, \fIinherit\fR, \fIkey\fR, \fIlog\fR, \fImcrypt\fR, \fIno history\fR, ,\fInobackup\fR, \fIone filesystem\fR, \fIoverwrite\fR, \fIpostrun\fR, \fIprerun\fR, \fIproto\fR, \fIproto option\fR, \fIremote hdup\fR, \fIremote hdup option\fR, \fIskip\fR, \fIsparse\fR, \fItar\fR, \fItar option\fR and \fIuser\fR, The only mandatory options are \fBarchive dir\fR and \fBdir\fR. They must be present for every host. .TP \fBalgorithm\fR Optional. What algorithm should \fBhdup\fR use when encrypting an archive. If this is not specified the archive will not be encrypted. Both 'algorithm' and 'key' must be present. For \fBgpg\fR encryption use \fBgpg\fR here. .TP \fBallow remote\fR Optional, binary option. If 'on' remote archives are allowed to be uploaded from this host, otherwise they are denied. .TP \fBalways backup\fR Optional, binary option. When 'on' hdup will always perform a backup. Normally when an incfile is not found the backup is aborted. What this option does is that if the backup scheme is daily and no weekly incfile is found, hdup performs a weekly backup. If \fBhdup\fR discovers no monthly incfile when doing a weekly it performs a monthly dump. .TP \fBarchive dir\fR Mandatory. Specify what directory \fBhdup\fR should use to store the archives and the (incremental) dump information. .TP \fBchunk size\fR Optional. Give the size of the chunks hdup should create when splitting up an archive. Size can be given with the suffix 'k', 'K' or 'm', 'M'. Chunks of the archive get the suffix '__split__XX', where XX is a two letter sequence starting by 'aa' and ending at 'zz'. To split up archive in CD sized chunks, \fBchunk size = 640m\fR could be used. .TP \fBcompression\fR Optional. Specify the compression \fBhdup\fR should use. This can be \fIbzip\fR, \fIgzip\fR, \fIlzop\fR or \fInone\fI. Defaults to \fIgzip\fR. Some explanation on the difference might be appropiate here. \fIbzip\fR (which uses bzip2) is slow but compresses the best, \fIgzip\fR is faster but offers less compression. \fIlzop\fR is the fastest of them all while offering very good compression. \fInone\fR is of course the fastest. .TP \fBcompression level\fR Optional. Specify the compression level, it's an integer between 1 and 9 (inclusive), where 1 equals, fast operation, lousy compression and 9 means best compression, but slow. When omitted it defaults to 6. Defaults to 6, which for all compression algorithms is the standard default. .TP \fBdate spec\fR Optional. The following formats are supported: .br \fIdefault\fR format will be 'DD-MM-YYYY' .br \fIiso\fR format will be 'YYYY-MM-DD' .br \fIamerican\fR format will be 'MM-DD-YYYYY' .TP \fBdir\fR Mandatory. Specify which directories or files should be backed up. You can also specify a single file, like \fI/usr/src/linux/.config\fR. There can be up to 20 different directories specified. There can only be 1 dir statement per host. .TP \fBexclude\fR Optional. Specify a list with a \fIregular\fR expressions that should be used to determine which files should \fBnot\fR be backed up. See \fIregex(7)\fR for more information about regular expressions. Also see the section \fBPATTERNS\fR. .TP \fBforce\fR Optional, binary option. When 'on' a restore to / will be allowed. .TP \fBfree\fR Optional. With \fBfree\fR you can specify how much free space \fImust\fR be available on a partition. If this free space requirement is not met, \fBhdup\fR will not perform the backup. Takes an optional size modifier: 'k', 'm' or 'G'. .TP \fBgpg\fR Optional. The path to \fBgpg\fR. Defaults to the value of the configure script. .TP \fBgroup\fR Optional. Specify the group under which the archives must be stored. Defaults to whatever group 'user' belongs to. .TP \fBinclude\fR Optional. Specify a list with a \fIregular\fR expressions that should be used to determine which files should be backed up. See \fIregex(7)\fR for more information about regular expressions. Also see the section \fBPATTERNS\fR. Included files take precedence on exclude files. .TP \fBinherit\fR Optional. Specify a list of \fIhosts\fR to inherit from. All keywords specified will either overwrite (for single items) or append (for lists) keywords for the current host. This allows creating specific host configurations out of common parts. .TP \fBkey\fR Optional. Which file should be used as the encryption key. Both 'algorithm' and 'key' must be present. In the case where \fBalgorithm\fR is \fBgpg\fR the user ID of the key must be specified here. .TP \fBlog\fR Optional, binary option. When 'on' \fBhdup\fR will also log to syslog. All message will be logged under LOG_DAEMON with priority LOG_NOTICE. All errors are logged in the following format: .br FAILURE, , Succes is reported as: .br SUCCESS, , , If the backup is send to a remote system, equals "remote". If the operation is restore, then equals "restore". .TP \fBmcrypt\fR Optional. The path to \fBmcrypt\fR. Defaults to the value of the configure script. .TP \fBno history\fR Optional, binary option. When 'on' \fBhdup\fR will store each archive in a directory called 'static' thereby not keeping any history of the archives. WARNING: this option is dangerous to use. When a backup fails and you did not copy the archives to some safe place you are left with no backups at all! A postrun script is provided in the examples directory of the hdup source, which copies the archives to a safe place. It is best to \fINOT\fR use this option unless you know what you are doing. Restoring such an archive can be accomplished by using the word 'static' as the restore date. .TP \fBnobackup\fR Optional. The argument is a filename. When specified \fBhdup\fR looks for this file in the directories it backs up. If this file is found the current directory and \fIall\fR sub-directories are \fIexcluded\fR from the backup. .TP \fBone filesystem\fR Optional, binary option. When 'on' \fBhdup\fR will stay in the local file system for each directory specified (with 'dir') when creating a backup. .TP \fBoverwrite\fR Optional, binary option. When 'on' old archives are overwritten. .TP \fBpostrun\fR Optional. Specify a command or script that be should run \fIafter\fR \fBhdup\fR is finished with the backup. The following variables can be used as arguments: .br \fI%h\fR expands to the current host. .br \fI%a\fR expands to the full path of the archivename of the current backup. .br \fI%s\fR expands to the current scheme. .br \fI%u\fR expands to the username under which the archives are stored. .br \fI%e\fR expands to 'yes' when encryption is used, 'no' otherwise. .br \fI%c\fR expands to 'yes' when chunksize is used, 'no' otherwise. .br \fI%g\fR expands to the groupname under which the archives are stored. Note: If the postrun script executes with errors the backup is \fInot\fR aborted. Note2: Any arguments not defined will be expanded to '-empty', without the quotes. .TP \fBprerun\fR Optional. Specify a command or script that should run \fIbefore\fR \fBhdup\fR begins with the actual backup. The following variables can be used as arguments: .br \fI%h\fR expands to the current host. .br \fI%a\fR expands to the full path of the archivename of the current backup. .br \fI%s\fR expands to the current scheme. .br \fI%u\fR expands to the username under which the archives are stored. .br \fI%e\fR expands to 'yes' when encryption is used, 'no' otherwise. .br \fI%c\fR expands to 'yes' when chunksize is used, 'no' otherwise. .br \fI%g\fR expands to the groupname under which the archives are stored. Note: If the prerun script executes with errors the backup IS aborted. Note2: Any arguments not defined will be expanded to '-empty', without the quotes. .TP \fBproto\fR Optional. Specify the path of the program to use when transferring an archive to a remote host. Known to work is \fBssh\fR. Defaults to the value of the configure script. These programs must be able to be used as a filter and support the user@remotehost syntax. Note: Be aware that this value must also be defined in the remote \fBhdup\fR which is receiving the backup, although it is not used there. If you don't want to set it to 'ssh' you can use '/dev/null' or any other path. .TP \fBproto option\fR Optional. Specify options that are given to the \fBproto\fR command in \fBhdup\fR. E.g. \fIproto option = -i /home/user/.ssh/identity -oProtocol=2\fR. .TP \fBremote hdup\fR Optional. If the @user@remotehost syntax is used this keyword specifies the location of the remote \fBhdup\fR. .TP \fBremote hdup option\fR Optional. If the @user@remotehost syntax is used this keyword specifies the options (like the location of the config file) that should be used by the remote \fBhdup\fR. .TP \fBskip\fR Optional, binary option. Depricated, it is always 'on'. When 'on' the backup directory is automaticly put in the exclude list and thus not backed up. .TP \fBsparse\fR Optional, binary option. Depricated, it is always 'on'. When 'on' hdup will use \fBtar\fR's --sparse feature when backing up files. .TP \fBtar\fR Optional. The path to \fBtar\fR. Defaults to the value of the configure script. This \fBtar\fR must support the command line syntax of GNU tar. .TP \fBtar option\fR Optional. Specify some extra options to the \fBtar\fR executed by \fBhdup\fR. These options are given the tar and untar commands. No extra checking is done by \fBhdup\fR on these options. .TP \fBuser\fR Optional. Specify the user under which the archives must be stored. Defaults to \fIoperator\fR. .SH PATTERNS The include and exclude keywords take regular expression as there input. There is one extra rule. If an expression ends with a slash '/' it is only applied to directories. A '/' in a different place is not handled special. The whole pathname of a file or directory is used in the pattern matching. The pattern matching is \fIcase sensitive\fR. .SS Examples To match all files ending with .txt use the pattern \fI.*\.txt\fR. To match everything file under opt, use \fI^/opt\fR. To match a specific directory in /opt, use \fI^/opt/bla/\fR, note that this excludes all directories which start with this string. If you want to match a single directory you must supply the full pathname and a leading, and closing '/'. WHAT COMES FIRST include or exclude .SH AUTHOR Written by Miek Gieben. Wouter van Gils helped a lot with testing pre-release versions. User feedback is appreciated. .SH REPORTING BUGS Report bugs to or via the bugzilla at the homepage. .SH COPYRIGHT Copyright (C) 2001-2005 Miek Gieben. This is free software. There is NO warrenty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. .SH SEE ALSO \fBhdup\fR(1), \fBregex\fR(7). hdup-2.0.14/doc/hdup.10000600000175000000270000002141710315743750012603 0ustar frankie.\" @(#)hdup.1 1.7.0 20-Mar-2003 OF; .TH hdup 1 "18 Mar 2003" .SH NAME hdup \- harddisk duplicator/harddisk backupper - backup to harddisk .SH SYNOPSIS .B hdup [ .IR OPTION ] .IR SCHEME .IR HOST [ .IR @USER@REMOTEHOST ] \fI(1st format)\fR .br .B hdup [ .IR OPTION ] .IR restore .IR HOST .IR DATE .IR DIRECTORY [ .IR @USER@REMOTEHOST ] \fI(2nd format)\fR .SH DESCRIPTION \fBHdup\fR is used to backup a filesystem. Features include: .PD 1 .TP .B o incremental backups: monthly, weekly and daily dumps, .TP .B o encryption of the archive (via \fBmcrypt\fR or \fBGPG\fR), .TP .B o compression of the archive (bzip/gzip/lzop/none), .TP .B o possibility to transfer the archive to a remote host, .TP .B o possibility to restore the archive from a remote host, .TP .B o ability to split up archives, .TP .B o no obscure archive format (it is a normal compressed tar file), and .TP .B o simple to use. .PP The behaviour of \fBhdup\fR is controlled by its configuration file (see \fBhdup.conf(5)\fR). Internally \fBhdup\fR uses \fBGNU tar\fR to actually create the backups. .SS First format When using the 1st format \fBhdup\fR performs a backup. Remember: \fBhdup\fR pushes a backup \fIfrom\fR the localhost \fIto\fR the remote host. The sort of backup is specified by \fISCHEME\fR: .TP \fBmonthly\fR Make a full (null) dump of the filesystem. .TP \fBweekly\fR Make an incremental dump of the filesystem relative to the latest monthly dump. If \fBhdup\fR cannot find a monthly dump it will complain, unless \fIalways backup\fR is on. Then a monthly dump will be performed. .TP \fBdaily\fR Make an incremental dump of the filesystem relative to the latest weekly dump. If \fBhdup\fR cannot find a weekly dump it will complain, unless \fIalways backup\fR is on. Then a weekly dump will be performed. .PP \fIHOST\fR is the host of which \fBhdup\fR should perform the backup. This should match a '[HOST]' statement in the configuration file. The directories of that host (specified with 'dir = \fIdir1\fR, \fIdir2\fR', ...) will be backed up to the directory specified with 'archive dir = \fIdir\fR'. If \fIHOST\fR is not found no backup will be made. .PP \fI@USER@REMOTEHOST\fR is the host to which the archive should be transfered. This must include the user name. E.g \fI@miekg@elektron.atoom.net. It is illegal to specify the colon ':'. \fBhdup\fR must be present on the remote host. The location of this remote \fBhdup\fR is specified using \fIremote hdup\fR. Any program capable of transferring files can used for this purpose. Currently tested is \fBssh\fR. Other programs like \fBrsync\fR (not tested) may also work. Any program with the following characteristics will do: .TP .B o must be usable as a filter (read from stdin, write to stdout), .TP .B o must support \fIuser@remotehost\fR syntax. .SS Second format When using the 2nd format a previous backed up filesystem is restored. Remember: \fBhdup\fR pushes a restore \fIfrom\fR the remote \fIto\fR the local host. This is opposite from the backup operation! .PP \fIHOST\fR is the host who's archives should be restored. .PP \fIDATE\fR everything up to this date will be restored. \fBhdup\fR will look for the most recent monthly archive, then the most recent weekly and finally for the daily to pad up to date given. The \fIDATE\fR can either be specified as DD-MM-YYYY (date spec = default), as YYYY-MM-DD (date spec = iso) or as MM-DD-YYYY (date spec = american). This is controlled from the configuration file. A special date is 'static' which instructs \fBhdup\fR to look in the 'static' directory. This is used when 'no history = yes'. This is dangerous to use because \fBhdup\fR will overwrite the old backup file with the new one. When your system crashes during the overwrite you have no backup at all! Only use this when you \fIreally\fR don't have room for two monthly backups. Another special date is 'today' which instructs \fBhdup\fR to use the current date. .PP \fIDIRECTORY\fR tells \fBhdup\fR to which directory the archive should be untarred to. Be very careful when running \fBhdup\fR as root and specifying '/' as the directory. Version 1.4 and above refuses to restore to '/'. This can be overridden by specifying 'force = on/yes' in the configuration. .PP \fI@USER@REMOTEHOST\fR is the host to which the archive should be restored. This must include the user name. E.g \fI@miekg@elektron.atoom.net. As as version 1.6.6 it is illegal to specify the colon ':'. On the remosthost and in \fIDIRECTORY\fR the archive is restored. \fBhdup\fR must be present on the remote host. .SS Status message When \fBhdup\fR is finished with its current operation it will print an overview message: .TS tab ($); l l. Hdup version.: 1.6.6 Host.........: elektron Date.........: 2003-02-02 Scheme.......: monthly Archive......: elektron.2003-02-02.monthly.tar.gz Encryption...: no Archive size.: 257k Elapsed......: 0:01:27 Status.......: successfully performed backup .TE .PP Which can be mailed to you via cron. .SH OPTIONS .TP \fB\-c, --config=\fIconfig\fR Location of the configuration file. The default location of \fBhdup\fR's configuration file is \fI/etc/hdup/hdup.conf\fR. .TP \fB\-s, --specific=\fIfile\fR Restore a specific file from an archive. \fIfile\fR must be the \fBfull\fI path to the file, relative paths will not work. .TP \fB\-i, --ignore-tar Ignore tar errors when restoring. .TP \fB\-I, --ignore-conf Ignore errors in the configuration file. .TP \fB\-P, --patched_tar Tar is patched so that it can handle \fI--no-recursion\fR, \fI--listed-incremental\fR and \fI--files-from\fR together. This options enables two things in hdup; 1) directory info is written to 'filelist' and 2) \fI--no-recursion\fR is given to \fBtar\fR. This solves the bug whereby \fBhdup\fR wouldn't include directory information in the archives. .TP \fB\-d, --dryrun Do a dryrun - don't do anything with the filesystem .TP \fB\-q, --quiet Suppress the output of the subprocesses (like 'tar' and 'ssh'). .TP \fB\-q \-q, --quiet --quiet Suppress the logging output from \fBhdup\fR. .TP \fB\-q \-q \-q, --quiet --quiet --quiet No logging at all. Even no overview message. .TP \fB\-V Be more verbose. .TP \fB\-V \-V Be even more verbose. This will show which files are backed up by \fBhdup\fR IF you also supply the -D option. .TP \fB\-h, --help A help message. .TP \fB\-v, --version Show the version of hdup. .TP \fB\-D, --debug Show a lot of information which can aid debugging. .PP The -V and -q options do \fInot\fR effect each other. A '-qqq -VV' option list will mean that \fBhdup\fR will show what is run, but nothing else (no overview message and no warning nor errors). .SH ENCRYPTION \fBhdup\fR can encrypt the archives, \fBmcrypt\fR is used for the actual encryption. As of version 1.6.25 \fBGPG\fR can also be used to encrypt the archive. Note that currently remotely restoring a GPG encrypted archives is not working. .SS mcrypt With \fBmcrypt --list\fR you get a list of the algorithms mcrypt supports: .TS tab (@); l l. \.\.\. \fIserpent\fR (32): cbc cfb ctr ecb ncfb ofb nofb \fIwake\fR (32): stream \fIloki97\fR (32): cbc cfb ctr ecb ncfb ofb nofb \fIrijndael-128\fR (32): cbc cfb ctr ecb ncfb ofb nofb \fIrijndael-192\fR (32): cbc cfb ctr ecb ncfb ofb nofb \.\.\. .TE .PP If you want to use \fIloki97\fR you specify \fBalgorithm = loki97\fR in hdup.conf. The same goes for all the other algorithms. .SS GPG To use \fBGPG\fR the following is needed. Set \fBalgorithm = gpg\fR and \fBkey = user ID of key\fR. In my case I've created a GPG key with user ID of 'miekg' so I use: .br \fBalgorithm = gpg\fR .br \fBkey = miekg\fR .br The \fBkey\fR is supplied to \fBgpg\fR with the \fI-r\fR argument. See the manpage of \fBgpg\fR for more details. .PP When restoring a GPG encrypted archive you will be prompted to unlock your private key. .SH AUTHOR Written by Miek Gieben. Wouter van Gils helped a lot with testing pre-release versions. User feedback is appreciated. .SH REPORTING BUGS Report bugs to . .SH BUGS The %a expansion is not always the same in the prerun and postrun scripts (when using encryption). .SH LIMITATIONS Under Linux kernel version 2.2 the archive size cannot exceed two (2) Gigabyte. If you need larger archives sizes you should upgrade your kernel. You can however solve this by using \fIchunk size\fR. Just define your maximum allowed size, something like \fIchunk size = 1800M\fR and you're set. .PP If you encrypt archives and want to restore them, you are forced to use one encryption scheme for all the backups. \fBhdup\fR does not store the key and algorithm with the archive, thus it is impossible to restore archives that use different keys and algorithms. .SH COPYRIGHT Copyright (C) 2001-2005 Miek Gieben. This is free software. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. .SH SEE ALSO \fBhdup.conf(5)\fR for information about \fBhdup\fR's configuration file. hdup-2.0.14/doc/FAQ.html0000600000175000000270000000033010312631463013037 0ustar frankie Goto http://miek.nl/projects/hdup2/faq/index.html
for an updated version of this file.

Or do a
wget http://miek.nl/projects/hdup2/faq/index.html
to get the file locally. hdup-2.0.14/src/0002700000175000000270000000000010346355756011607 5ustar frankiehdup-2.0.14/src/prototype.h0000600000175000000270000000644310341656454014026 0ustar frankie/* $Id: prototype.h,v 1.36 2004/09/29 09:11:28 miekg Exp $ */ /* function prototypes */ #include #include "walker.h" void backup_local(phost_t host[], int which, struct argument_t *); void backup_restore(phost_t host[], int which, struct argument_t *); void backup_remote(phost_t hdhost[], int which); void hdup_cleanup (int , phost_t ); void hdup_print(void); void hdup_sigpipe(int); void hdup_sigint(int); void hdup_sigalrm(int); void hdup_archive(phost_t , int); int config(char *, phost_t host[]); int setlist(char *, char *hostpath[], int); int addlist(char *org[], char *cur[]); int setvar(char *, char **, int); int addvar(char *, char **); int whatkey(char *); int findhost (char *, phost_t host[]); int yesno(char *, char *, int); int addyesno(int, int *); int inherit(char *, phost_t, phost_t host[], int); int hdup_mkfake(phost_t); int hdup_checkalg (char *, struct tab *); int hdup_globfilecheck (char *, char **); int hdup_chown (char *, char *, char *); int hdup_chmod (char *); int hdup_chown_dir (char *, int, char *, char *); int hdup_chmod_dir (char *, int); int hdup_unlink (char *); int hdup_hash (phost_t ); int hdup_getdate(char * , int, int ); int hdup_parsedate(char * , int , int *, int *, int *); int hdup_inclist (phost_t , int ); int hdup_mkdir(char *, mode_t , char *, char *); int hdup_cp (char *,char *); int hdup_setup ( phost_t host[], int ); int hdup_tarlist (phost_t ); int hdup_lock(phost_t , int ); int hdup_overview(char *, char *); int hdup_compression(char *); int hdup_compression_crypt(char *); int hdup_chunk(char *); int hdup_split(char *); int hdup_grep(char *, char ); int hdup_system(char *); int version(void); int readline (char *, FILE *, int, int *); int usage (void); int find_restore (struct argument_t *, phost_t , char **, int); int hdup_runpre (phost_t , char *scheme[], int); int hdup_runpost (phost_t , char *scheme[], int); char * hdup_time(time_t); int hdup_putheader(pheader_t, FILE * ); int hdup_fillheader(pheader_t, phost_t, int, char *); int hdup_getheader(pheader_t, FILE *); int hdup_checkheader(pheader_t); int hdup_readword(char *, FILE *, int ); int hdup_scheme(char *); int hdup_dotar(phost_t, int); int hdup_dountar(phost_t, struct argument_t *, char *); int hdup_ok_char(char *); int pure_whitespace(char *); long long int hdup_free(char *); long long int hdup_convert(char *); int pipe2file(char *, char *, unsigned long long int *); int pipe2pipe(char *, char *, pheader_t, unsigned long long int *); int stream2file(FILE *, char *, unsigned long long int *); int stream2pipe(FILE *, char *, pheader_t, unsigned long long int *); char * hdup_subst(char *, char *, char *); char * hdup_humansize(long long); char * hdup_lastname(char * ); /* ala basename */ char * day(char *, int , int ); char * setup_tarcmd(phost_t); char * setup_untarcmd(phost_t, char *, char *, int); char * setup_unsplitcmd(char *); char * setup_transportcmd(phost_t); char * setup_cryptcmd(phost_t); char * setup_decryptcmd(phost_t); char * setup_splitcmd(phost_t); char * hdup_makedate(int , int , int , int ); time_t hdup_file_time(char *); /* * walker.c */ gboolean hash_slash(char *); int do_dir_walk(phost_t); int walk_dir(char *, FILE *, phost_t, reg_exp *dexclude, reg_exp *fexclude, reg_exp *dinclude, reg_exp *finclude); gboolean reg_do_match(reg_exp *reg, char *); hdup-2.0.14/src/hdupconf.c0000600000175000000270000004006110315743422013545 0ustar frankie/* hdupconf.c * parses a hdup config file * * $Id: hdupconf.c,v 1.57 2004/10/03 13:00:07 miekg Exp $ * * Copyright: * * This package is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 dated June, 1991. * * This package is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this package; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. * */ #include"config.h" #include"hdup.h" #include"prototype.h" extern unsigned int ignore_conf_err; char *keyword[] = { "dir","exclude", "proto option", "user", "compression","prerun","postrun","proto","include", "date spec", "algorithm", "key", "overwrite", "skip", "force", "sparse", "tar", "find", "always backup", "allow remote", "remote hdup", "remote hdup option", "archive dir", "mcrypt", "no history", "one filesystem", "chunk size", "free", "log", "inherit","compression level", "gpg", "group", "tar option", "nobackup" }; /* This doesn't do quoting, escaping, etc. I don't need that actually */ int readline(char *line, FILE *from, int lim, int *linecnt) { char *l = line; int c; unsigned int escape_seen = 0; while ((c = getc (from)) != EOF) { /* make possible to escape \n in config */ /* escaped , is handled in set_list. Ugly * but I don't want to bring yacc/lex to the table */ if (escape_seen == 1) { if (c == '\n') { LOGDEBUG("%s", "Escaped \\n seen"); *linecnt++; escape_seen = 0; continue; } else { /* re-add the \ we chopped off */ *l++ = '\\'; lim--; escape_seen = 0; } } if (c == '\\') { escape_seen = 1; continue; } if (c != '\n') { *l++ = c; lim--; } else { *l = '\0'; return 0; } if (lim < 0) { WARN("Config: line %d: %s", *linecnt, "Maximum line length exceeded."); return 1; } } return 1; } /* todo: check for equal host names in the same config file */ int config(char *path, phost_t host[]) { /* eats a list of host, and fills them up * parse a hdup.conf2 file: * put the config file in a HOST struct */ FILE *conf; char *line = (char *)g_malloc(MAXPATHLEN); char *left = (char *)g_malloc(MAXPATHLEN); char *right = (char *)g_malloc(MAXPATHLEN); char *h = (char *)NULL; int i, len; int linecnt; int slash; len = 0; i = -1; linecnt = 0; if ((conf = fopen(path,"r"))) { while (readline(line, conf, MAXPATHLEN, &linecnt) == 0) { len = strlen(line); linecnt++; /* comment lines */ if ( *line == '#' || *line == '\n' || *line == '\0' ) continue; /* next line */ /* check to see if there is still a '#' in there * somewhere/ Added 3 Oct 2004 MG */ if (strchr(line, '#') != NULL) *strchr(line, '#') = '\0'; if ( *line == '[' ) { /* new host found */ if ( ++i > MAXHOST ) { FATAL("Config: line %d: %s", linecnt, "Too many hosts defined in the configuration file"); } host[i] = (phost_t) g_malloc (sizeof(host_t)); /* Solaris complains */ h = (char*)rindex(line,']'); if (h == NULL) { FATAL("Config: line %d: %s", linecnt, "Could not find closing \']\'"); } /* not the first '[' */ line++; host[i]->name = g_strdup(line); /* and not the last */ *(host[i]->name + ( h - line) ) = '\0'; /* sanitize */ hdup_ok_char(host[i]->name); /* the first entry MUST be [global], hdup depends on this */ if ( i == 0 && (!g_str_equal(host[0]->name, "global"))) { /* SYSLOG is not opened defined here (yet) */ FATAL("Config: line %d: %s", linecnt, "First host in config file must be named [global]"); } /* fill her up */ host[i]->date = NULL; /* current date */ host[i]->tar = NULL; /* what tar to use */ host[i]->archive = NULL; /* where to store the archives */ host[i]->datespec = NULL; host[i]->compression = NULL; host[i]->user = NULL; /* default user */ host[i]->group = NULL; /* default user */ host[i]->basename = NULL; host[i]->dirname_date = NULL; host[i]->dirname_etc = NULL; host[i]->filelist = NULL; host[i]->excludelist = NULL; host[i]->inclist = NULL; host[i]->archivename = NULL; host[i]->keypath = NULL; host[i]->alg = NULL; host[i]->mcrypt = NULL; host[i]->gpg = NULL; host[i]->chunksize = NULL; host[i]->free = NULL; host[i]->complevel = NULL; host[i]->nobackup = NULL; host[i]->tar_conf_opt = NULL; /* protocol stuff */ host[i]->proto_opt = NULL; host[i]->proto = NULL; host[i]->remote_hdup = NULL; host[i]->remote_hdup_opt = NULL; /* it's not in the config file anymore */ host[i]->remote = NULL; host[i]->prerun = NULL; host[i]->postrun = NULL; /* options that are now in the config files */ host[i]->skip = -1; host[i]->force = -1; host[i]->overwrite = -1; host[i]->sparse = -1; host[i]->always = -1; host[i]->allow_remote = -1; host[i]->history = -1; host[i]->onefile = -1; host[i]->log = -1; /* Thanks to Wouter, bug fixes */ host[i]->path[0] = NULL; host[i]->exclude[0] = NULL; /* always have this default include * if we don't do this - the include * program code will include nothing - AND * NO BACKUPS WILL BE MADE */ host[i]->include[0] = g_strdup(".*"); continue; /* next line */ } if ( *line != '[' ) { /* should be config line: blah = blih * left part is keyword, right part is data */ /* char* Solaris fix */ if (i == -1) FATAL("Config: line %d: %s", linecnt, "No [host] statement seen"); h = (char*)index(line,'='); if ( h == NULL ) { VERBOSE("Config: line %d: %s", linecnt, "Crap seen in config file - skipping"); continue; } else { /* actual line lenght is thus * 256+1536 + some spaces */ sscanf(line, "%256[^=]=%1536[^\n]", left, right); /* get ride of spaces */ g_strstrip(left); g_strstrip(right); switch (whatkey(left)) { case KEY_INHERIT: inherit(right, host[i], host, linecnt); break; case KEY_BACKUP: setlist(right, host[i]->path, linecnt); break; case KEY_EXCLUDE: setlist(right, host[i]->exclude, linecnt); break; case KEY_INCLUDE: setlist(right, host[i]->include, linecnt); break; case KEY_ARCHIVE: setvar(right, &host[i]->archive, linecnt); slash = strlen(host[i]->archive); if ((host[i]->archive)[slash - 1 ] != '/') { host[i]->archive = g_realloc(host[i]->archive, slash + 2); /* add a closing / if not already there */ VVERBOSE("Config: line %d: %s", linecnt, "Adding closing \'/\' to archive dir"); (host[i]->archive)[slash] = '/'; (host[i]->archive)[slash + 1] = '\0'; } break; case KEY_PROTO_OPT: setvar(right, &host[i]->proto_opt, linecnt); break; case KEY_USER: setvar(right, &host[i]->user, linecnt); break; case KEY_GROUP: setvar(right, &host[i]->group, linecnt); break; case KEY_COMP: setvar(right, &host[i]->compression, linecnt); break; case KEY_PRE: setvar(right, &host[i]->prerun, linecnt); break; case KEY_POST: setvar(right, &host[i]->postrun, linecnt); break; case KEY_PROTO: setvar(right, &host[i]->proto, linecnt); break; case KEY_REMOTE_HDUP: setvar(right, &host[i]->remote_hdup, linecnt); break; case KEY_REMOTE_HDUP_OPT: setvar(right, &host[i]->remote_hdup_opt, linecnt); break; case KEY_DATESPEC: setvar(right, &host[i]->datespec, linecnt); break; case KEY_ALG: setvar(right, &host[i]->alg, linecnt); break; case KEY_KEYFILE: setvar(right, &host[i]->keypath, linecnt); break; case KEY_OVERWRITE: host[i]->overwrite = yesno(right, keyword[KEY_OVERWRITE],linecnt); break; case KEY_SKIP: host[i]->skip = yesno(right, keyword[KEY_SKIP], linecnt); LOG("Config: line %d: %s", linecnt, "Skip is always enabled"); break; case KEY_FORCE: host[i]->force = yesno(right, keyword[KEY_FORCE], linecnt); break; case KEY_ONEFILE: host[i]->onefile = yesno(right, keyword[KEY_ONEFILE], linecnt); break; case KEY_SPARSE: host[i]->sparse = yesno(right, keyword[KEY_SPARSE], linecnt); LOG("Config: line %d: %s", linecnt, "Sparse is always enabled"); break; case KEY_ALWAYS: host[i]->always = yesno(right, keyword[KEY_ALWAYS], linecnt); break; case KEY_TAR: setvar(right, &host[i]->tar, linecnt); break; case KEY_FIND: LOG("Config: line %d: %s", linecnt, "Find is depreciated"); break; case KEY_ALLOW: host[i]->allow_remote = yesno(right, keyword[KEY_ALLOW], linecnt); break; case KEY_HISTORY: host[i]->history = yesno(right, keyword[KEY_HISTORY], linecnt); break; case KEY_LOG: host[i]->log = yesno(right, keyword[KEY_LOG], linecnt); break; case KEY_MCRYPT: setvar(right, &host[i]->mcrypt, linecnt); break; case KEY_CHUNKSIZE: /* need lowercase m of k */ setvar(right, &host[i]->chunksize, linecnt); break; case KEY_FREE: /* need lowercase m of k */ setvar(right, &host[i]->free, linecnt); break; case KEY_COMPLEVEL: setvar(right, &host[i]->complevel, linecnt); break; case KEY_GPG: setvar(right, &host[i]->gpg, linecnt); break; case KEY_TAR_OPT: setvar(right, &host[i]->tar_conf_opt, linecnt); break; case KEY_NOBACKUP: setvar(right, &host[i]->nobackup, linecnt); break; default: /* not a keyword */ LOG("Config: line %d: %s %s",linecnt, left," : is not a keyword"); if (!ignore_conf_err) { g_free(left); g_free(right); return 1; } break; } } } } /* end while */ g_free(left); g_free(right); host[i+1] = (phost_t) g_malloc (sizeof(host_t)); host[i+1]->name = NULL; /* possible error: i+1 */ } else { perror(NULL); /* not good */ return 1; } return 0; } int findhost(char *hostname, phost_t host[]) { /* return -1 if none found, otherwise index from host */ int i = 0; while (host[i]->name != NULL) { if (g_str_equal(host[i]->name, hostname)) { /* found! */ return i; } i++; } return -1; } int inherit(char *hostnames, phost_t curr, phost_t host[], int linecnt) { /* inherit all from hostname into host */ char* hostlist[MAXDIR]; int i = 0; i = setlist(hostnames, hostlist, linecnt); if (i < 0) { LOG("Config: line %d: Not able to parse inherit list [%s] so ignoring", linecnt, hostnames); return -1; } for (i = 0; hostlist[i] != NULL && hostlist[i][0] != '\0' && i < MAXDIR; i++) { int h = findhost(hostlist[i], host); if (h < 0) FATAL("Config: line %d: Cannot find hostname to inherit from [%s]", linecnt, hostlist[i]); /* inherit from host[h] -> curr */ addlist(host[h]->path, curr->path); addlist(host[h]->exclude, curr->exclude); addlist(host[h]->include, curr->include); addvar(host[h]->archive, & curr->archive); addvar(host[h]->proto_opt, & curr->proto_opt); addvar(host[h]->tar_conf_opt , & curr->tar_conf_opt); addvar(host[h]->user, & curr->user); addvar(host[h]->compression, & curr->compression); addvar(host[h]->prerun, & curr->prerun); addvar(host[h]->postrun, & curr->postrun); addvar(host[h]->proto, & curr->proto); addvar(host[h]->remote_hdup, & curr->remote_hdup); addvar(host[h]->remote_hdup_opt, & curr->remote_hdup_opt); addvar(host[h]->datespec, & curr->datespec); addvar(host[h]->alg, & curr->alg); addvar(host[h]->keypath, & curr->keypath); addyesno(host[h]->overwrite, & curr->overwrite); addyesno(host[h]->skip, & curr->skip); addyesno(host[h]->force, & curr->force); addyesno(host[h]->onefile, & curr->onefile); addyesno(host[h]->sparse, & curr->sparse); addyesno(host[h]->always, & curr->always); addvar(host[h]->tar, & curr->tar); addyesno(host[h]->allow_remote, & curr->allow_remote); addyesno(host[h]->history, & curr->history); addyesno(host[h]->log, & curr->log); addvar(host[h]->mcrypt, & curr->mcrypt); addvar(host[h]->gpg, & curr->gpg); addvar(host[h]->chunksize, & curr->chunksize); addvar(host[h]->free, & curr->free); addvar(host[h]->complevel, & curr->complevel); addvar(host[h]->nobackup, & curr->nobackup); } return 0; } int setvar (char *dir, char **var, int linecnt) { if (!dir) { return 0; } /* set var to dir */ if (strlen(dir) > MAXPATHLEN) return -1; if (pure_whitespace(dir) != -1) { *var = NULL; WARN("Config: line %d: Resetting keywords like this, will not work", linecnt); return 0; } *var = g_strdup(dir); hdup_ok_char(*var); g_strstrip(*var); return 0; } int addvar (char* org, char **cur) { /* add org over cur - already stripped + okayed */ if (org != NULL) { if (*cur != NULL) { free(*cur); *cur = NULL; } *cur = g_strdup(org); } return 0; } int yesno (char *what, char *which, int linecnt) { /* there are four possible answer in such a config option * no/off -> 0, or yes/on -> 1 */ if ( strncmp(what, "no", 2) == 0 ) { return 0; } if ( strncmp(what, "false", 5) == 0 ) { return 0; } if ( strncmp(what, "off", 3) == 0 ) { return 0; } if ( strncmp(what, "yes", 3) == 0 ) { return 1; } if ( strncmp(what, "true", 4) == 0 ) { return 1; } if ( strncmp(what, "on", 2) == 0 ) { return 1; } LOG("Config: line %d: No \'on/yes\' or \'off/no\' specified, going with \'off/no\' for %s", linecnt, which); return 0; /* default is off/no */ } int addyesno (int org, int *cur) { /* add org over cur */ if (org != -1) { *cur = org; } return 0; } int setlist (char *dirpath, char *hostpath[], int linecnt) { /* parse a comma seperate list of directories * allow escaping of , by using \, */ int l; int t = 0; if (pure_whitespace(dirpath) != -1) { hostpath[0] = NULL; WARN("Config: line %d: Resetting keywords like this, will not work", linecnt); return 0; } for(l = strlen(dirpath); l >= 0 ; l--) { if (*(l + dirpath) == ',' ) { if (*(l + dirpath - 1) == '\\') { LOGDEBUG("%s", "Escaped \\, seen"); /* skip this one and even more ugly turn * the \ into a space */ *(l + dirpath - 1) = ' '; continue; } /* not the ',' */ hostpath[t] = g_strdup(dirpath + l + 1); g_strstrip(hostpath[t]); *(l+dirpath) = '\0'; t++; continue; } if (l == 0) { hostpath[t] = g_strdup(dirpath); /* may be optional */ g_strstrip(hostpath[t]); t++; } if (t > MAXDIR) return -1; } hostpath[t] = (char*)NULL; return 0; } int addlist (char *org[], char *cur[]) { /* append each of org onto cur */ if (org != NULL && org[0] != NULL) { int t = 0, i = 0; while ( t < MAXDIR && cur[t] != NULL && cur[t][0] != '\0' ) t++; while ( t < MAXDIR && org[i] != NULL && org[i][0] != '\0') { cur[t] = g_strdup(org[i]); t++; i++; } if (i > 0) { cur[t] = (char*)NULL; } } return 0; } int whatkey(char *key) { /* found out what keyword is found */ int i; for (i = 0; i < KEYWORDS; i++) { if (g_str_equal(key, keyword[i])) { return i; } } return -1; /* no keyword found */ } /** * check if a string is only whitespace * if so - return 0 * otherwise return -1 */ int pure_whitespace(char *str) { char *s; if (!str) { return 0; } for(s = str; *s; s++) { /* avoid isblank because it's a gnu-ism. bug 22 */ if (*s != '\t' || *s != ' ') { return -1; } } return 0; } hdup-2.0.14/src/hduptarlib.c0000600000175000000270000004300510341325442014073 0ustar frankie/* hduptarlib.c, do all the tar things here * * $Id: hduptarlib.c,v 1.55 2004/09/25 19:39:16 miekg Exp $ * * Copyright: * * This package is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 dated June, 1991. * * This package is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this package; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. */ #include"hdup.h" #include"prototype.h" extern unsigned int ignore_tar_err; extern unsigned int dryrun; int hdup_dountar(phost_t host, struct argument_t * arg, char *restore) { /* handle all the untarring */ char *out = NULL; char *tar = NULL; char *ssh = NULL; char *cat = NULL; char *decrypt = NULL; FILE *in = NULL; unsigned long long int bytes; int ret; pheader_t header = NULL; ret = 0; if (host->remote == NULL) { /* stay local */ if (hdup_compression(restore) == CRYPT) { /* is something is encrpypted I must have * the decryption key */ if (host->alg == NULL ) { VERBOSE("%s", "Archive appears to be encrypted - skipping"); return 1 ; } decrypt = setup_decryptcmd(host); tar = setup_untarcmd(host,arg->extractdir, arg->extractfile, hdup_compression_crypt(restore)); out = g_strdup_printf("%s | %s", decrypt, tar); } else { tar = setup_untarcmd(host, arg->extractdir, arg->extractfile, hdup_compression(restore)); out = tar; } } else { /* untar from remote sideside */ /* allocate space, here and only here */ header = (pheader_t) g_malloc (sizeof(header_t)); hdup_fillheader(header, host, RESTORE, arg->extractdir); ssh = setup_transportcmd(host); if (hdup_compression(restore) == CRYPT ) { /* there is no special access function... ugly.. */ VERBOSE("%s", "Archive is encrypted - adding to header"); header->encryption = "y"; } out = ssh; } /* out contains the OTHER side of the pipe, in is the archive we're dealing * with everything is setup, now check for compression stuff */ if (hdup_chunk(restore) == SPLIT) { /* oh no, split up archive */ /* remote or local doesn't matter */ cat = setup_unsplitcmd(restore); LOGDEBUG("%s",cat); if (dryrun) { VVERBOSE("Faking %s", cat); return 0; } if (!ignore_tar_err) { ret = pipe2pipe(cat, out, header, &bytes); host->bytes = bytes; return ret; } else { /* discard any errors */ pipe2pipe(cat, out, header, &bytes); host->bytes = bytes; return 0; } } else { /* ok, normal people still exist */ in = fopen(restore, "r"); if (in == NULL ){ VERBOSE("%s", "Could not open the archive for reading"); perror(NULL); return 1; } else if (dryrun) { VVERBOSE("Faking %s", restore); return 0; } if (!ignore_tar_err) { ret = stream2pipe(in, out, header, &bytes); host->bytes = bytes; return ret; } else { stream2pipe(in, out, header, &bytes); host->bytes = bytes; return 0; } } /* should not reached this */ VERBOSE("%s", "restore: nothing to do?!"); host->bytes = 0; return 1; } int hdup_dotar(phost_t host, int s) { /* this handles all the tars we should ever have to run. Everything is * done with pipes */ /* we are tarring to stdout, catch it with a pipe and putting it * somewhere different*/ char *out = NULL; char *in = NULL; char *tar = NULL; /* hold entire tar command */ char *ssh = NULL; /* hold entire ssh command */ char *crypt = NULL; /* hold entire mcrypt command */ char *split = NULL; /* hold entire split command */ pheader_t header = NULL; unsigned int t = 0; unsigned long long int bytes; /* get tar ready */ tar = setup_tarcmd(host); LOGDEBUG("tar: %s",tar); if (host->remote != NULL) { /* allocate space here, keeps header NULL otherwise */ header = (pheader_t) g_malloc (sizeof(header_t)); ssh = setup_transportcmd(host); } if (host->alg != NULL) crypt = setup_cryptcmd(host); if (host->chunksize != NULL) split = setup_splitcmd(host); /* normal case: backup locally */ if (host->alg == NULL) { /* no crypto */ if (host->remote == NULL) { /* tar cvfz - > archive */ if (host->chunksize == NULL) { out = host->archivename; if (dryrun) { VVERBOSE("Faking %s", tar); return 0; } if (pipe2file(tar, out, &bytes) != 0) return 1; host->bytes = bytes; (void)hdup_chown (out, host->user, host->group); (void)hdup_chmod (out); return 0; } else { /* split */ out = split; LOGDEBUG("split: %s",split); if (dryrun) { VVERBOSE("Faking %s", tar); return 0; } if (pipe2pipe(tar, out, header, &bytes) != 0) return 1; host->bytes = bytes; t = hdup_chown_dir(host->dirname_date, s, host->user, host->group); hdup_overview("Chunks", g_strdup_printf("%d", t)); hdup_chmod_dir(host->dirname_date, s); return 0; } /* remote: tar cvf - | ssh hdup ... */ /* no splitting up - happens at the remote side */ } else { if (dryrun) { VVERBOSE("Faking %s", tar); return 0; } hdup_fillheader(header, host, s, NULL); out = ssh; if (pipe2pipe(tar, out, header, &bytes) != 0) return 1; host->bytes = bytes; return 0; } } else { /* crypto */ if ( host->remote == NULL ) { if ( host->chunksize == NULL ) { /* tar cvfz - | crypto - > archive */ /* add .nc extension */ host->archivename = g_strconcat(host->archivename, MCRYPT_EXT, NULL); /* Flawfinder: ignore */ out = g_strdup_printf("%s > %s", crypt, host->archivename); if (dryrun) { VVERBOSE("Faking %s", tar); return 0; } if (pipe2pipe(tar,out, header, &bytes) != 0) return 1; host->bytes = bytes; (void)hdup_chown (host->archivename, host->user, host->group); (void)hdup_chmod (host->archivename); return 0; } else { /* also do splitting */ host->archivename = g_strconcat(host->archivename, MCRYPT_EXT, NULL); /* refill spit -- archivename has changed */ g_free(split); split = setup_splitcmd(host); if ( split == NULL ) return 1; /* Flawfinder: ignore */ out = g_strdup_printf("%s | %s", crypt, split); LOGDEBUG("out: %s",out); if (dryrun) { VVERBOSE("Faking %s", out); return 0; } if (pipe2pipe(tar, out, header, &bytes) != 0 ) return 1; host->bytes = bytes; /* it could be that the whole dir is too much */ t = hdup_chown_dir(host->dirname_date, s, host->user, host->group); hdup_overview("Chunks", g_strdup_printf("%d", t)); hdup_chmod_dir(host->dirname_date, s); } } else { /* tar cvfz - | crypto | ssh */ /* no splitting up - happens at the remote side */ hdup_fillheader(header, host, s, NULL); /* Flawfinder: ignore */ in = g_strdup_printf("%s | %s", tar, crypt); if (dryrun) { VVERBOSE("Faking %s", tar); return 0; } if (pipe2pipe(in,ssh, header, &bytes) != 0) return 1; host->bytes = bytes; return 0; } } host->bytes = 0; return 0; } int pipe2file(char *tar, char *out, unsigned long long int *b) { /* write the tar to a file */ FILE *pin; FILE *archivefile; unsigned int c; int stat; char buf[BUFSIZE + 1]; *b = 0; archivefile = fopen(out,"w"); pin = popen(tar,"r"); LOGDEBUG("full tar: %s",tar); LOGDEBUG("out file: %s",out); VVERBOSE("Running: %s > %s",tar, out); if (archivefile == NULL) { VERBOSE("%s","Could not open archive for writing"); perror(NULL); return 1; } if (pin == NULL) { VERBOSE("%s","Could not setup tar for archiving"); perror(NULL); return 1; } /* Processing loop */ while(!feof(pin)) { c = fread(buf, sizeof(char), BUFSIZE, pin); if (fwrite(buf, sizeof(char), c, archivefile) != c) { WARN("%s", "Writing of the archive failed"); perror(NULL); return 1; } *b += c; } fclose(archivefile); stat = pclose(pin); LOGDEBUG("%s: %d", "tar exit status",stat); /* 512; /bin/tar: Error is not recoverable: exiting now */ /* 512 seems to mean that a zero size archived has been * created */ if (stat == -1) return 1; LOGDEBUG("%s: %d", "tar WIFEXITED exit status",WIFEXITED(stat)); LOGDEBUG("%s: %d", "tar WEXITSTATUS exit status",WEXITSTATUS(stat)); if (WIFEXITED(stat) == 0) if (WEXITSTATUS(stat) > 0) return 1; return 0; } /* cat a stream to a file * return 0 on error */ int stream2file(FILE *in, char *file, unsigned long long int *b) { /* read from the stream and write to file */ FILE *handle; unsigned int c; char buf[BUFSIZE + 1]; *b = 0; handle = fopen(file,"w"); if (handle == NULL) { VERBOSE("%s","Could not open archive for writing"); perror(NULL); return 0; } if (in == NULL) { VERBOSE("%s", "Could not read from stream"); perror(NULL); return 0; } /* Processing loop */ while(!feof(in)) { c = fread(buf, sizeof(char), BUFSIZE, in); if (fwrite(buf, sizeof(char), c, handle) != c) { WARN("%s", "Writing of the archive failed"); perror(NULL); return 1; } *b += c; } fclose(handle); return 0; } int stream2pipe(FILE *in, char *out, pheader_t head, unsigned long long int *b) { /* write from the stream and to the pipe */ FILE *pout; unsigned int c; int stat; char buf[BUFSIZE + 1]; *b = 0; fflush(stdin); fflush(stdout); pout = popen(out,"w"); if (pout == NULL) { VERBOSE("%s","Could not open pipe for writing"); perror(NULL); return 1; } if (in == NULL) { VERBOSE("%s", "Could not setup stream for reading"); perror(NULL); return 1; } /* is sigalrm helpfull here */ if (head != NULL) { /* print the header first */ hdup_putheader(head, pout); } /* Processing loop */ /* if nothing is waiting on the other side, a SIGPIPE is thrown */ while(!feof(in)) { if (hdup_pipe == 1) return 1; c = fread(buf, sizeof(char), BUFSIZE, in); if (fwrite(buf, sizeof(char), c, pout) != c) { WARN("%s", "Writing to the pipe failed"); perror(NULL); return 1; } *b += c; } stat = pclose(pout); if ( stat == -1 ) return 1; if ( WIFEXITED(stat) == 0 ) return 1; if ( WEXITSTATUS(stat) > 0 ) return 1; return 0; } int pipe2pipe(char *tar, char *out, pheader_t head, unsigned long long int *b) { /* write the tar to a pipe */ FILE *pin; FILE *pout; unsigned int c; int stat; char buf[BUFSIZE + 1]; pout = popen(out,"w"); pin = popen(tar,"r"); *b = 0; VVERBOSE("Running: %s | %s", tar, out); if ( pout == NULL ) { VERBOSE("%s", "Could not open pipe for writing"); perror(NULL); return 1; } if ( pin == NULL ) { VERBOSE("%s", "Could not setup tar for archiving"); perror(NULL); return 1; } if ( head != NULL ) /* print the header first */ hdup_putheader(head, pout); /* Processing loop */ while(!feof(pin)) { if (hdup_pipe == 1) return 1; c = fread(buf, sizeof(char), BUFSIZE, pin); if (fwrite(buf, sizeof(char), c, pout) != c) { WARN("%s", "Writing to the pipe failed"); perror(NULL); return 1; } *b += c; } /* out pipe */ stat = pclose(pout); if (stat == -1 ) return 1; /* with ssh 255 is returned when something fails */ /* otherwise hdup's error is returned, both are more than 0 */ if ( WIFEXITED(stat) == 0 ) return 1; if ( WEXITSTATUS(stat) > 0 ) return 1; /* in pipe */ stat = pclose(pin); if ( stat == -1 ) return 1; if ( WIFEXITED(stat) == 0 ) return 1; return 0; } char * setup_transportcmd(phost_t host) { /* create a string with the ssh command */ /* ssh ssh_options user@host hdup remote */ char *ssh; ssh = g_strdup_printf("%s %s %s %s %s remote %s", host->proto, host->proto_opt, host->remote, host->remote_hdup, host->remote_hdup_opt, host->name); return ssh; } char * setup_cryptcmd(phost_t host) { /* create a string with the mcrypt command */ /* mcrypt -a alg -f keypath or * gpg -e blabla */ /* Flawfinder: ignore */ char *crypt; if ( strcasecmp(host->alg, GPG_ALG) == 0 ) { /* yep GPG */ /* Flawfinder: ignore */ crypt = g_strdup_printf("%s " GPG_CRYPT , host->gpg, host->keypath); /* Flawfinder: ignore */ LOGDEBUG("%s\n",crypt); } else { /* Flawfinder: ignore */ crypt = g_strdup_printf("%s -u -q -a %s -f %s", host->mcrypt, host->alg, host->keypath); } /* f*cking mute still works, even in a pipe :) */ if ( quiet > 0 ) { /* Flawfinder: ignore */ crypt = g_strconcat(crypt, MUTE, NULL); } /* Flawfinder: ignore */ return crypt; } char * setup_decryptcmd(phost_t host) { /* create a string with the mcrypt command */ /* mcrypt -a alg -f keypath */ /* Flawfinder: ignore */ char *crypt; if ( strcasecmp(host->alg, GPG_ALG) == 0 ) { /* yep GPG */ /* Flawfinder: ignore */ crypt = g_strdup_printf("%s " GPG_DECRYPT , host->gpg, host->keypath); } else { /* Flawfinder: ignore */ crypt = g_strdup_printf("%s -d -q -a %s -f %s", host->mcrypt, host->alg, host->keypath); } /* Flawfinder: ignore */ LOGDEBUG("%s\n",crypt); /* mute still works, even in a pipe */ if ( quiet > 0 ) { /* Flawfinder: ignore */ crypt = g_strconcat(crypt, MUTE, NULL); } /* Flawfinder: ignore */ return crypt; } char * setup_tarcmd(phost_t host) { /* create a string with the tar command */ char *tar; char *comp; /* tar will always look like this * MG 28-7-2005 use --null as we delimit are list with \0's */ if (patched_tar == 1) { tar = g_strdup_printf("%s %s - %s --no-recursion --null --files-from %s --listed-incremental %s --ignore-failed-read %s", host->tar, TAR_NONE, SPARSE, host->filelist, host->inclist, host->tar_conf_opt); } else { tar = g_strdup_printf("%s %s - %s --files-from %s --null --listed-incremental %s --ignore-failed-read %s", host->tar, TAR_NONE, SPARSE, host->filelist, host->inclist, host->tar_conf_opt); } if (strncmp(host->compression, TAR_GZIP, strlen(TAR_GZIP)) == 0) { comp = g_strdup_printf(" |%s -%s",GZIP_PROG, host->complevel); /* add the onefile option */ if (host->onefile == 1) tar = g_strconcat(tar, ONEFILE, NULL); if (quiet > 0) tar = g_strconcat(tar, MUTE, NULL); tar = g_strconcat(tar, comp, NULL); LOGDEBUG("tar prog: [%s]", tar); return tar; } if ( strncmp(host->compression, TAR_BZIP, strlen(TAR_BZIP)) == 0 ) { comp = g_strdup_printf(" |%s -%s",BZIP_PROG, host->complevel); if (host->onefile == 1) tar = g_strconcat(tar, ONEFILE, NULL); if (quiet > 0) tar = g_strconcat(tar, MUTE, NULL); tar = g_strconcat(tar, comp, NULL); LOGDEBUG("tar prog: [%s]", tar); return tar; } if ( strncmp(host->compression, TAR_LZOP, strlen(TAR_LZOP)) == 0 ) { comp = g_strdup_printf(" |%s -%s",LZOP_PROG, host->complevel); if (host->onefile == 1) tar = g_strconcat(tar, ONEFILE, NULL); if (quiet > 0) tar = g_strconcat(tar, MUTE, NULL); /* add the rest of the string */ tar = g_strconcat(tar, comp, NULL); LOGDEBUG("tar prog: [%s]", tar); return tar; } /* no compression */ if (host->onefile == 1) tar = g_strconcat(tar, ONEFILE, NULL); if (quiet > 0) tar = g_strconcat(tar, MUTE, NULL); LOGDEBUG("tar prog: [%s]", tar); VVERBOSE("Setup: %s", tar); return tar; } char * setup_untarcmd(phost_t host, char * extractdir, char *extractfile, int compression) { /* create a string with the untar command */ char *tar; char *tar_opt = NULL; /* figure out what options to use */ switch (compression) { case NONE: tar_opt = UNTAR_NONE; break; case GZIP: tar_opt = UNTAR_GZIP; break; case BZIP: tar_opt = UNTAR_BZIP; break; case LZOP: tar_opt = UNTAR_LZOP; break; default: tar_opt = UNTAR_GZIP; break; } if (extractfile == NULL) { /* completely untar it */ tar = g_strdup_printf("%s %s - %s %s %s --ignore-failed-read %s --incremental", host->tar, UNTAR_OPT, extractdir, SPARSE, tar_opt, host->tar_conf_opt); } else { /* extract a single file */ tar = g_strdup_printf("%s %s - %s %s --ignore-failed-read --incremental %s %s %s", host->tar, UNTAR_OPT, extractdir, SPARSE, tar_opt, host->tar_conf_opt, extractfile); } if (quiet > 0) tar = g_strconcat(tar, MUTE, NULL); LOGDEBUG("Untar %s\n",tar); VVERBOSE("Setup: %s", tar); return tar; } char * setup_splitcmd(phost_t host) { /* hold the split cmd */ char *split; split = g_strdup_printf("%s -b %s - %s/%s%s", SPLIT_PROG, host->chunksize, host->dirname_date, hdup_lastname(host->archivename), SPLIT_EXT); return split; } char * setup_unsplitcmd (char * archive) { /* create a string with cat */ /* lappie.2003-04-24.monthly.tar__split__aa * must be transformed in * lappie.2003-04-24.monthly.tar*__split__?? */ char *pos; pos = strstr(archive, SPLIT_EXT); if ( pos != NULL ) *pos='\0'; /* cut string short */ else return NULL; /* put new stuff behind it */ archive = g_strconcat(archive, "*", SPLIT_EXT, NULL); return(g_strdup_printf("%s %s??", UNSPLIT_PROG, archive)); } hdup-2.0.14/src/hdupremote.c0000600000175000000270000001375110341656454014130 0ustar frankie/* hdupremote .c, a remotely receive the backup * * $Id: hdupremote.c,v 1.22 2004/09/25 20:41:24 miekg Exp $ * * Copyright: * * This package is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 dated June, 1991. * * This package is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this package; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. * */ #include"hdup.h" #include"prototype.h" void backup_remote(phost_t host[], int which) { /* receive a header from stdin, after that comes the tarfile. * From the header we can deduce what to do with the archive. * for daily, weekly and monthly we just put the archive in the * correct place, and possibly add encryption * remote is illegal * restore is also special */ pheader_t header = NULL; char *out = NULL; char *decrypt = NULL; char *tar = NULL; char *split = NULL; unsigned int t = 0; unsigned long long int bytes; /* make the dirs */ hdup_setup(host, which); /* do the allocation your self here */ header = (pheader_t) g_malloc (sizeof(header_t)); /* make some room */ header->prot_ver = (char*) g_malloc( strlen(PROT_VER) + 1); header->prot_name = (char*) g_malloc( strlen(PROT_NAME) + 1 ); header->hostname = (char *)g_malloc(MAXPATHLEN); header->scheme = (char *)g_malloc(8); header->date = (char *)g_malloc(11); header->compression = (char *)g_malloc(5); header->encryption = (char *)g_malloc(1); header->extractdir = (char *)g_malloc(MAXPATHLEN); hdup_getheader(header, stdin); if ( hdup_checkheader(header) != 0 ) { /* header is bogus */ LOG("%s","Protocol: bogus header"); hdup_cleanup(-1,host[which]); } if(!g_str_equal(header->hostname, host[which]->name)) { /* header->hostname MUST match host[which]->name */ LOG("%s","Protocol: local hostname does not match remote hostname"); hdup_cleanup(-1,host[which]); } host[which]->date = header->date; /* copy from stdin */ /* forget the put something in hdup->compression [miek 26-06-2003] */ host[which]->compression = header->compression; /* scheme is already checked */ hdup_archive(host[which], hdup_scheme(header->scheme)); hdup_overview("Scheme rcvd",header->scheme); if (g_ascii_strncasecmp(header->scheme,scheme[RESTORE], strlen(scheme[RESTORE])) == 0) { /* remote restore operation */ /* tell this here, MG 18 May 2004 */ LOG("%s: STARTING REMOTE RESTORE", host[which]->name); /* should check if the file is split */ /* check the extract dir */ if ( hdup_globfilecheck(header->extractdir,NULL) == 0 ) FATAL("%s %s %s", "Extract dir: ", header->extractdir, " does not exist"); /* select the right compression, from the header... */ /* extractfile is NULL here - so it does not work remotely */ if (g_ascii_strncasecmp(header->compression, TAR_BZIP, strlen(TAR_BZIP)) == 0) tar = setup_untarcmd(host[which],header->extractdir,NULL, BZIP); if (g_ascii_strncasecmp(header->compression, TAR_GZIP, strlen(TAR_BZIP)) == 0) tar = setup_untarcmd(host[which],header->extractdir,NULL, GZIP); if (g_ascii_strncasecmp(header->compression, TAR_NONE, strlen(TAR_BZIP)) == 0) tar = setup_untarcmd(host[which],header->extractdir,NULL, NONE); if (host[which]->alg != NULL) { if (g_ascii_strncasecmp(header->encryption, "y",1) == 0 ) { VERBOSE("%s", "Encryption found - trying to decrypt"); decrypt = setup_decryptcmd(host[which]); VVERBOSE("%s %s", "Decryption command: ", decrypt); out = g_strdup_printf("%s | %s", decrypt, tar); } else { VERBOSE("%s","Encryption specified in config - not using"); out = tar; } } else out = tar; /* our output command has been specified */ /* dont lock for restore hdup_lock(host[which], LOCK); */ if (stream2pipe(stdin, out, NULL, &bytes) != 0) { LOG("%s", "Could not remotely restore the archive"); hdup_cleanup(-1,host[which]); } } else if (g_ascii_strncasecmp(header->scheme,scheme[REMOTE], strlen(scheme[REMOTE])) == 0) { LOG("%s","Protocol: Illegal scheme: \'remote\'"); hdup_cleanup(-1,host[which]); } else { /* place it on disk - check the chunksize in the config */ LOG("%s: STARTING REMOTE BACKUP", host[which]->name); /* first check the encryption flag in the header */ if (g_ascii_strncasecmp(header->encryption,"y",1) == 0) host[which]->archivename = g_strconcat(host[which]->archivename, MCRYPT_EXT, NULL); if ( host[which]->chunksize != NULL ) split = setup_splitcmd(host[which]); /* Skip crypto stuff in the config file. This also allows the * configfiles at both ends to be identical */ if ( host[which]->alg != NULL ) VERBOSE("%s","Will not encrypt archives from remote hosts - encrypt them locally"); /* set the lock */ (void)hdup_lock(host[which], LOCK); if ( host[which]->chunksize == NULL ) { if (stream2file(stdin, host[which]->archivename, &bytes) == 0) { (void)hdup_chown (host[which]->archivename, host[which]->user, host[which]->group); (void)hdup_chmod (host[which]->archivename); VERBOSE("wrote %s", hdup_humansize((long long)bytes)); } else { LOG("%s", "Could not create archive"); hdup_cleanup(-1,host[which]); } } else { /* splitting */ if (stream2pipe(stdin, split, NULL, &bytes) == 0) { t = hdup_chown_dir(host[which]->dirname_date, hdup_scheme(header->scheme) , host[which]->user, host[which]->group); VERBOSE("Chunks created: %d", t); VERBOSE("Chunk size: %s",host[which]->chunksize); hdup_chmod_dir(host[which]->dirname_date,hdup_scheme(header->scheme)); } else { LOG("%s", "Could not create archive"); hdup_cleanup(-1,host[which]); } } } } hdup-2.0.14/src/walker.c0000600000175000000270000002066410345050711013226 0ustar frankie/* * Walk directories and apply the include/exclude patterns * The result list of files(!) is then given to tar to * actually perform the backup. * */ #include "hdup.h" #include "prototype.h" #include "walker.h" /** * does the string contain a slash as the last character */ gboolean hash_slash(char *str) { if (str[strlen(str) - 1] == '/') return TRUE; else return FALSE; } /** * per path described to a walk_dir and build a list of * files to be backupped up */ int do_dir_walk(phost_t host) { int i; unsigned int err; unsigned files = 0; char *filelist; FILE *fp; struct stat s; int de, fe, di, fi; /* these hold the patters */ reg_exp dexclude = {0,}; reg_exp dinclude = {0,}; reg_exp fexclude = {0,}; reg_exp finclude = {0,}; /* reset the counters */ de = fe = di = fi = 0; /* prepare the regular expression and give the list * walk_dir. Also split up the files and dirs */ i = 0; err = 0; while (host->exclude[i] != '\0') { if (hash_slash(host->exclude[i])) { /* directory, kill the last slash */ host->exclude[i][(strlen(host->exclude[i]) - 1)] = '\0'; LOGDEBUG("dir exclude: [%s]", host->exclude[i]); err = regcomp(&dexclude.expr[de++], host->exclude[i], REG_EXTENDED | REG_NOSUB); dexclude.max++; } else { /* file */ LOGDEBUG("file exclude: [%s]", host->exclude[i]); err = regcomp(&fexclude.expr[fe++], host->exclude[i], REG_EXTENDED | REG_NOSUB); fexclude.max++; } if (err > 0) FATAL_HOST(host, "%s: %s", "Regular expression did not compile", host->exclude[i]); if (i++ > MAXDIR) { WARN("%s", "Maximum amount regular expression seen. Bailing out"); break; } } i = 0; err = 0; while (host->include[i] != '\0') { if (hash_slash(host->include[i])) { /* directory, kill the slash */ LOGDEBUG("dir include pattern: [%s]", host->include[i]); host->include[i][(strlen(host->include[i]) - 1)] = '\0'; err = regcomp(&dinclude.expr[di++], host->include[i], REG_EXTENDED | REG_NOSUB); dinclude.max++; } else { /* file */ LOGDEBUG("file include pattern: [%s]", host->include[i]); err = regcomp(&finclude.expr[fi++], host->include[i], REG_EXTENDED | REG_NOSUB); finclude.max++; } if (err > 0) FATAL_HOST(host, "%s: %s", "Regular expression did not compile", host->include[i]); if (i++ > MAXDIR) { WARN("%s", "Maximum amount regular expression seen. Bailing out"); break; } } /* what do we have processed */ LOGDEBUG("DE %d FE %d DI %d FI %d\n", de, fe, di ,fi); filelist = g_strconcat(host->dirname_etc, FILELIST, NULL); host->filelist = filelist; /* c'est tres important. It still is? MG 3-11-2004 */ fp = fopen(host->filelist, "w"); if (!fp) FATAL_HOST(host, "Could not open %s for writing", host->filelist); /* walk all the directories */ i = 0; while (host->path[i] != '\0') { LOGDEBUG("%s: %s", "Walking", host->path[i]); /* path[i] can also be a file - test that first */ if(lstat(host->path[i], &s) != 0) { WARN("%s: %s", "Cannot stat", host->path[i]); i++; /* BUG #6 */ continue; } if (S_ISDIR(s.st_mode)) { /* files arg is not used yet */ files = files + walk_dir(host->path[i], fp, host, &dexclude, &fexclude, &dinclude, &finclude); VVERBOSE("%s %d", "Files found:", files); } else { /* it's a file, write directly to the inclist */ fprintf(fp, "%s", host->path[i]); /* use \0 as delimeter, we give --null to tar BUG #3 */ putc(0, fp); VVERBOSE("Adding %s directly", host->path[i]); } i++; } /* valgrind, free these */ for(i = 0; i < dexclude.max; i++) { regfree(&dexclude.expr[i]); } for(i = 0; i < dinclude.max; i++) { regfree(&dinclude.expr[i]); } for(i = 0; i < fexclude.max; i++) { regfree(&fexclude.expr[i]); } for(i = 0; i < finclude.max; i++) { regfree(&finclude.expr[i]); } fclose(fp); return files; } /** * Read a directory. Process the files first and put all subdirs * onto a stack. After all the files are processed, pop the stack * and start on the first subdirectory. * If a .nobackup is found the directory and its decendents are * discarded. */ int walk_dir(char *path, FILE *fp, phost_t host, reg_exp *dexclude, reg_exp *fexclude, reg_exp *dinclude, reg_exp *finclude) { DIR *dir; char *pop; char *newpath; struct dirent *d; struct stat s; dev_t current_dev; unsigned int dsize = 50; unsigned int dirs = 1; unsigned int files = 1; unsigned int fsize = 250; unsigned int total_find = 0; /* keep track of how many files we find */ /* dir stack */ char **dirstack = g_malloc(dirs * dsize * sizeof(char*)); unsigned int di = 0; /* file stack */ char **filestack = g_malloc(files * fsize * sizeof(char *)); unsigned int fi = 0; if(!(dir = opendir(path))) { WARN("%s: %s", "Cannot enter the directory", path); return 0; } /* get device */ if (stat(path, &s) != 0) { WARN("%s: %s","Cannot determine holding device of the directory:", path); return 0; } current_dev = s.st_dev; while((d = readdir(dir))) { if (hdup_sig) hdup_cleanup(-1, host); if(!g_ascii_strcasecmp(d->d_name, ".") || !g_ascii_strcasecmp(d->d_name, "..")) continue; /* if path is / this will lead to //, making regexp fail. * From; Boris */ if (!g_ascii_strcasecmp(path, "/")) newpath = g_strdup_printf("/%s", d->d_name); else newpath = g_strdup_printf("%s/%s", path, d->d_name); if(strlen(newpath) + 2 > MAXPATHLEN) { WARN("%s", "Directory path too long"); g_free(dirstack); g_free(filestack); return 0; } /* we're statting the file */ if(lstat(newpath, &s) != 0) { WARN("%s %s", "Could not stat path:", newpath); continue; } /* catch everything, except dirs */ if (!S_ISDIR(s.st_mode)) { /* if we see a .nobackup, the entire file and dir * stacks we have build up can be discarded and we * can return from our recursion */ if (host->nobackup != NULL && !g_ascii_strcasecmp(d->d_name, host->nobackup)) { /* if include match -> descend * if exclude match -> don't decend */ /* otherwise add */ g_free(dirstack); g_free(filestack); return 0; } /* file excludes */ if (reg_do_match(fexclude, newpath)) { /* a match don't add this file */ continue; } /* file includes */ if (reg_do_match(finclude, newpath)) { filestack[fi++] = g_strdup(newpath); /* hack to show this */ if (verbose < 1 && debug == 1) { fprintf(stderr, "[WALKER] %s\n", newpath); } if (fi % fsize == 0) filestack = g_realloc(filestack, ++files * fsize * sizeof(char *)); continue; } } else if(S_ISDIR(s.st_mode)) { /* one filesystem */ if (host->onefile && (s.st_dev != current_dev)) { WARN("%s", "Walking onto different filesystem"); continue; } /* dir excludes */ if (reg_do_match(dexclude, newpath)) { /* a match don't add this dir - but * continue with the rest */ continue; #if 0 g_free(dirstack); g_free(filestack); return 0; #endif } /* dir includes */ if (reg_do_match(dinclude, newpath)) { dirstack[di++] = g_strdup(newpath); if (di % fsize == 0) dirstack = g_realloc(dirstack, ++dirs * dsize * sizeof(char *)); continue; } dirstack[di++] = g_strdup(newpath); if (di % dsize == 0) dirstack = g_realloc(dirstack, ++dirs * dsize * sizeof(char *)); } else { WARN("%s %s", "Neither file nor directory:", newpath); } } closedir(dir); /* we have walked the dir - and seen no .nobackup files * Dump what we have */ /* total_find = fi + di; also include directories here */ total_find = fi; /* don't as hdup cannot see if nothing is found */ while (fi > 0) { pop = filestack[--fi]; fprintf(fp, "%s", pop); /* use \0 as delimeter, we give --null to tar */ putc(0, fp); g_free(pop); } /* do it! do it! do it! */ while (di > 0) { pop = dirstack[--di]; /* GT fix - use tar --no-recursion to make the backup */ if (patched_tar == 1) { fprintf(fp, "%s", pop); /* use \0 as delimeter, we give --null to tar */ putc(0, fp); } total_find += walk_dir(pop, fp, host, dexclude, fexclude, dinclude, finclude); g_free(pop); } g_free(dirstack); g_free(filestack); return total_find; } /* walk the array and report back * any matches (TRUE) or FALSE when there * are none */ gboolean reg_do_match(reg_exp *reg, char *path) { int i; int res; for(i = 0; i < reg->max ; i++) { if ((res = regexec(®->expr[i], path, 0, NULL, 0)) == 0) { /* a match */ return TRUE; } } return FALSE; } hdup-2.0.14/src/walker.h0000600000175000000270000000052410316563067013237 0ustar frankie/* on mac OS (and prob. others) we don't have regex_t->buffer, * so wrap the whole thing in a struct */ #ifndef _WALKER_H_ #define _WALKER_H_ struct struct_regext { int max; /* how many do we have */ regex_t expr[MAXDIR]; /* the regular expression */ }; typedef struct struct_regext reg_exp; #endif /* _WALKER_H_ */ hdup-2.0.14/src/hdup.c0000600000175000000270000006555110341656454012721 0ustar frankie/* hdup.c, a backup program * * Copyright (c) 2000-2005, Miek Gieben. All right reserverd. * * See GPL-2 for the license * */ #include"hdup.h" #include"prototype.h" unsigned int quiet = 0; int verbose = 2; unsigned int debug = 0; unsigned int hdup_log = 0; unsigned int ignore_tar_err = 0; unsigned int ignore_conf_err = 0; unsigned int dryrun = 0; unsigned int patched_tar = 0; sig_atomic_t hdup_pipe = 0; sig_atomic_t hdup_sig = 0; sig_atomic_t hdup_alrm = 0; /* order of scheme's is important */ char *scheme[] = {"daily","weekly","monthly","remote","restore"}; char *subvar[] = {"%h","%a","%s","%e","%u","%c","%g"}; char *progname = NULL; /* added % for subvar */ /* added & | for shells use */ const char ok_chars[] = ":1234567890@-_=+./\\ %\\&|\ abcdefghijklmnopqrstuvwxyz\ ABCDEFGHIJKLMNOPQRSTUVWXYZ"; void backup_local(phost_t host[], int which, struct argument_t *arg) { char *what, *checkfile; size_t l; unsigned int newscheme; int transfer = 0; /* setup the directory */ if ( host[which]->remote == NULL ) hdup_setup(host, which); else { /* if host[which]->remote is entered we must transfer the archive */ transfer = 1; hdup_setup(host, which); /* hdup date dir is not needed when moving it to a * remote location */ rmdir (host[which]->dirname_date); } /* this also works with encryption */ checkfile = g_strdup_printf("%s/%s.%s.%s.*",host[which]->dirname_date, host[which]->name,host[which]->date, scheme[arg->scheme]); if ( hdup_globfilecheck( checkfile, NULL) != 0 && transfer == 0 ) { /* there already is something??!? */ if ( host[which]->overwrite == 0 ) { SYSLOG_HW("%s","There already is an archive identical to the one created right now"); FATAL("%s: %s",host[which]->name, "There already is an archive identical to the one created right now"); } else VERBOSE("%s","Overwriting old archive"); } g_free(checkfile); /* set a lock, also when we're piping the tar to ssh */ /* 15-09-2003: do the locking here, before any copying, MG * at least before hdup_inclist() */ (void)hdup_lock(host[which], LOCK); /* sort out the incremental files, hdup_inclist will return the scheme * that is actually used. If there is no previous backup list, hdup * try to create a "higher" backup: from daily to weekly to monthly. * This means there will be always be made a backup! This can be toggled * on and off with "always backup" in the config file */ newscheme = hdup_inclist(host[which], arg->scheme); if ( arg->scheme != newscheme ) arg->scheme = newscheme; else hdup_overview("Scheme", scheme[arg->scheme]); /* setup the archivename */ hdup_archive(host[which], arg->scheme); hdup_overview("Archive",(char*)hdup_lastname(host[which]->archivename)); if ( host[which]->alg != NULL ) { /* 10 mar 2003: enable local encryption again */ if ( transfer == 1 ) VERBOSE("%s","Decryption key may not be present when restoring the archive"); l = strlen(host[which]->alg) + strlen(host[which]->keypath); what = g_strdup_printf("yes (%s, %s)", host[which]->alg, host[which]->keypath); hdup_overview("Encryption", what); g_free(what); } else { hdup_overview("Encryption", "no"); } /* generate a list of files and/or directories we should backup */ if(do_dir_walk(host[which]) == 0) { /* nothing was found - if tar get's a empty files-from * it will backup the working directory */ WARN("%s", "No files were found - I'm faking an empty tar archive"); if (hdup_mkfake(host[which]) != 0) hdup_cleanup(1, host[which]); } else { /* do your thing */ if (hdup_dotar(host[which], arg->scheme) != 0) hdup_cleanup(1, host[which]); } } int main(int argc, char *argv[]) { phost_t host[MAXHOST + 1]; struct argument_t arg; int c = 0; int which; char *cp; char *logstring; struct group *grp; struct sigaction sa; struct tab algs[] = ALGORITHMS; #ifdef HAVE_GETOPT_H static struct option long_options[] = { {"config", required_argument, 0, 'c'}, {"specific", required_argument, 0, 's'}, {"help", no_argument, 0, 'h'}, {"quiet", no_argument, 0, 'q'}, {"verbose", no_argument, 0, 'V'}, {"version", no_argument, 0, 'v'}, {"ignore-tar", no_argument, 0, 'i'}, {"ignore-conf", no_argument, 0, 'I'}, {"patched-tar", no_argument, 0, 'P'}, {"dryrun", no_argument, 0, 'd'}, {"debug", no_argument, 0, 'D'}, {0,0,0,0} }; #endif /*HAVE_GETOPT_H*/ progname = g_strdup(argv[0]); /* reset options */ arg.configpath = NULL; arg.scheme = SCHEME_ILL; arg.host = NULL; arg.date = NULL; arg.extractdir = NULL; arg.extractfile = NULL; /* catch SIGPIPE */ sa.sa_handler = hdup_sigpipe; sa.sa_flags = 0; sigfillset(&sa.sa_mask); sigaction(SIGPIPE, &sa, (struct sigaction *)NULL); /* catch SIGINT */ sa.sa_handler = hdup_sigint; sigaction(SIGINT, &sa, (struct sigaction *)NULL); /* setup SIGALRM. Used transfering with ssh */ sa.sa_handler = hdup_sigalrm; sigaction(SIGALRM, &sa, (struct sigaction *)NULL); /* check if we are suid of sgid, if so QUIT! hdup isn't * designed to do this kind of stuff */ if (((getuid() != geteuid()) || (getgid() != getegid()))) { FATAL("%s %s", progname, "is not designed to be ran suid/sgid"); } /* This is stupid to have - but somewhere I do something * stupid - this at least prevents core dumps.... :-( */ /* check argument lengths */ for(c = 0; c < argc; c++) { if (strlen(argv[c]) > MAXPATHLEN) { FATAL("%s", "Command line argument too long"); } } /* in host[0] I put the global options, these can be overriden in the config file */ #ifdef HAVE_GETOPT_H while ((c = getopt_long(argc, argv, "c:s:hqvViIdDP", long_options, 0)) != -1) { #else while ((c = getopt(argc, argv, "c:s:hqvViIdDP")) != -1) { #endif /*HAVE_GETOPT_H*/ switch (c) { case 'c': arg.configpath = strdup(optarg); hdup_ok_char(arg.configpath); break; case 'h': usage(); hdup_cleanup(0,NULL); break; case 'v': version(); hdup_cleanup(0,NULL); break; case 'q': quiet += 1; /* quiet option */ if (quiet > 3) FATAL("%s","You can specify up to three -q's"); break; case 'V': verbose--; if (verbose < 0) verbose = 0; break; case 's': arg.extractfile = strdup(optarg); /* if the first char eq '/' we chop it off * as tar does the same */ if (arg.extractfile[0] == '/') arg.extractfile++; hdup_ok_char(arg.extractfile); break; case 'i': ignore_tar_err = 1; break; case 'I': ignore_conf_err = 1; break; case 'P': patched_tar = 1; break; case 'd': dryrun = 1; break; case 'D': debug = 1; break; case '?': default: usage(); hdup_cleanup(-1,NULL); } } argc -= optind; argv += optind; /* need at least two arguments: scheme and a hostname */ if (argc < 2 ) { usage(); hdup_cleanup(-1,NULL); } /* MIEK; not sure I want to keep this for 2.0.11 */ /* sanitize the command line */ for (c = 0; c < argc; c++ ) hdup_ok_char(argv[c]); /* check the scheme */ arg.scheme = hdup_scheme(argv[0]); if (arg.scheme == REMOTE) progname = g_strconcat(progname, " (remote) ", NULL); if (arg.scheme != REMOTE && arg.scheme != RESTORE) { /* useless when receiving a bunch of files */ if (patched_tar == 0) { LOG("%s", "Running without -P and probably a non patched tar"); LOG("%s", "This will lead to incomplete backups"); } else { LOG("%s", "Running with -P, all is well"); } } /* first the config file to set things up, -c option */ if ( arg.configpath == NULL ) { VERBOSE("%s %s", "No -c switch using default configfile:", ETCFILE); arg.configpath = ETCFILE; } if (g_file_test(arg.configpath, G_FILE_TEST_IS_REGULAR)) { /* access test purely here for better error output */ if (access(arg.configpath, R_OK)) FATAL("%s %s","Cannot access the config file:", arg.configpath); if (config(arg.configpath, host) != 0) FATAL("%s","The configuration file had errors in it"); } else /* there is no config file */ FATAL("%s %s","Config file could not be opened:", arg.configpath); /* config checks */ if (findhost("global", host) == -1) FATAL("%s", "No [global] section in configuration file"); /* still ILL? */ if (arg.scheme == SCHEME_ILL) FATAL("%s", "Scheme must be: daily, weekly, monthly, remote or restore"); if (arg.scheme != RESTORE && arg.extractfile != NULL) VERBOSE("%s", "Scheme is not \'restore\', -s ignored"); /* process the commandline arguments to see what hdup should do */ /* LOCAL */ if ( arg.scheme <= REMOTE ) { /* second arg: host to backup */ arg.host = argv[1]; if ( argv[2] != NULL ) { /* must start with @ */ if ( ( strchr(argv[2], '@')) == argv[2] ) { /* do not copy the @ */ /* 29 jun 2002, store everything in ->remote */ host[0]->remote = g_strdup(++argv[2]); /* check if there is a ':' in ->remote * 10 mar 2003: colon is not allowed anymore */ if ( hdup_grep (host[0]->remote, ':') == 0 ) FATAL("%s","Colon found in @REMOTE_HOST"); } else FATAL("%s %s","No @ found at start of REMOTEHOST:", argv[2]); } } /* REMOTE */ if ( arg.scheme == REMOTE ) /* REMOTE */ arg.host = argv[1]; /* RESTORE */ if (arg.scheme == RESTORE) { /* restore a backup */ if (argv[1] != NULL) arg.host = argv[1]; else FATAL("%s","You must supply a hostname"); if (argv[2] != NULL) arg.date = argv[2]; else FATAL("%s","You must supply a date in the right format"); if (argv[4] != NULL) { /* must start with @ */ if ( ( strchr(argv[4], '@')) == argv[4] ) { /* do not copy the @ */ host[0]->remote = ++argv[4]; if ( hdup_grep (host[0]->remote, ':') == 0 ) FATAL("%s", "Colon found in @REMOTE_HOST"); } else FATAL("%s %s","No @ found at start of REMOTEHOST:", argv[4]); } /* do this after 4, we want to know if we going to restore remotely */ if (argv[3] != NULL) { arg.extractdir = argv[3]; if ( hdup_globfilecheck(arg.extractdir,NULL) == 0 && host[0]->remote == NULL ) { FATAL("%s %s %s", "Extract dir: ", arg.extractdir, " does not exist"); } } else FATAL("%s","You must supply a dir to extract to"); } if (arg.scheme == RESTORE && arg.extractfile != NULL && host[0]->remote != NULL) FATAL("%s", "Remote restore of a single file in a archive it not possible"); /* check host in config file */ which = findhost(arg.host, host); if (which == -1) FATAL("%s %s: %s","Host:", arg.host, "Not defined in configuration file"); /* we are now ready to start the backup. Log this, makes the gen. email * msgs more readable */ /* don't talk about anything when scheme == REMOTE, as the remote * header will tell us what we're doing, MG 18 May 2004 */ if ( arg.scheme <= MONTHLY) LOG("%s: STARTING BACKUP",host[which]->name); if ( arg.scheme == RESTORE ) LOG("%s: STARTING RESTORE",host[which]->name); /* do the date, default, iso or american */ if ( host[0]->datespec == (char *) NULL ) host[0]->datespec = "default"; /* default everything to 'off' */ if ( host[0]->skip == -1 ) host[0]->skip = 0; if ( host[0]->force == -1 ) host[0]->force = 0; if ( host[0]->overwrite == -1 ) host[0]->overwrite = 0; if ( host[0]->sparse == -1 ) host[0]->sparse = 0; if ( host[0]->always == -1 ) host[0]->always = 0; if ( host[0]->allow_remote == -1 ) host[0]->allow_remote = 0; if ( host[0]->history == -1 ) host[0]->history = 0; if ( host[0]->onefile == -1 ) host[0]->onefile = 0; if ( host[0]->log == -1 ) host[0]->log = 0; if ( host[0]->complevel == NULL ) host[0]->complevel = "6"; /* seems to be sane default */ /* Inherit important vars from host[0] (=global) if there are defined */ if ( host[which]->compression == NULL ) host[which]->compression = host[0]->compression; if ( host[which]->archive == NULL ) host[which]->archive = host[0]->archive; if ( host[which]->chunksize == NULL ) host[which]->chunksize = host[0]->chunksize; if ( host[which]->free == NULL ) host[which]->free = host[0]->free; if ( host[which]->complevel == NULL ) host[which]->complevel = host[0]->complevel; /* check compression, and reset for use in the rest of the program */ /* looks a bit difficult, but this wil select gzip by default * and if not, it will take the default from the hdup.conf */ /* also check if the exe is on the system MG 27 Sept 2004 */ if ( host[which]->compression != NULL ) { if (g_str_equal(host[which]->compression, "gzip")) { /* ok, found */ host[which]->compression = TAR_GZIP; if (!g_file_test(GZIP_PROG, G_FILE_TEST_IS_EXECUTABLE)) FATAL("%s: compression %s %s", host[which]->name, GZIP_PROG, "not found"); } else if (g_str_equal(host[which]->compression, "none")) { host[which]->compression = TAR_NONE; } else if (g_str_equal(host[which]->compression, "bzip")) { host[which]->compression = TAR_BZIP; if (!g_file_test(BZIP_PROG, G_FILE_TEST_IS_EXECUTABLE)) FATAL("%s: compression %s %s", host[which]->name, BZIP_PROG, "not found"); } else if (g_str_equal(host[which]->compression, "lzop")) { host[which]->compression = TAR_LZOP; if (!g_file_test(LZOP_PROG, G_FILE_TEST_IS_EXECUTABLE)) FATAL("%s: %s %s", host[which]->name, LZOP_PROG, "not found"); } else { /* unknown */ FATAL("%s: compression %s %s",host[which]->name, "Unknown compression: ",host[which]->compression ); } } else { VVERBOSE("%s","No compression given, defaulting to: gzip"); host[which]->compression = TAR_GZIP; /* default */ host[0]->compression = TAR_GZIP; /* default */ if (!g_file_test(GZIP_PROG, G_FILE_TEST_IS_EXECUTABLE)) FATAL("%s: compression %s %s", host[which]->name, GZIP_PROG, "not found"); } if ( host[which]->prerun == NULL ) host[which]->prerun = host[0]->prerun; if ( host[which]->postrun == NULL ) host[which]->postrun = host[0]->postrun; if ( host[which]->user == NULL ) { if ( host[0]->user == NULL ) { VVERBOSE("%s %s","No user given, defaulting to:", DEF_USER); host[which]->user = DEF_USER; } else host[which]->user = host[0]->user; } if ( host[which]->group == NULL ) host[which]->group = host[0]->group; if ( host[which]->datespec == NULL ) host[which]->datespec = host[0]->datespec; if ( host[which]->keypath == NULL ) host[which]->keypath = host[0]->keypath; if ( host[which]->alg == NULL ) host[which]->alg = host[0]->alg; /* although remote is not in the config file we should * still copy it to the right host */ if ( host[which]->remote == NULL ) host[which]->remote = host[0]->remote; /* ssh or whatever (rsync?) */ if (host[which]->proto == NULL) { if (host[0]->proto == NULL) { VVERBOSE("%s %s","No protocol path given, defaulting to:",DEFAULT_PROTO); host[which]->proto = DEFAULT_PROTO; } else host[which]->proto = host[0]->proto; } /* copy the nobackup argument. After this is can be still be NULL */ if (host[which]->nobackup == NULL) { host[which]->nobackup = host[0]->nobackup; } /* copy the dir paths if they are not defined */ /* if we do not redefine include take the one from global */ if(host[which]->path[0] == NULL) { for (c = 0; c < MAXDIR; c++ ) { if (host[0]->path[c] == NULL) break; host[which]->path[c] = host[0]->path[c]; } } /* if we do not redefine include take the one from global */ if(host[which]->include[0] == NULL) { for (c = 0; c < MAXDIR; c++ ) { if (host[0]->include[c] == NULL) break; host[which]->include[c] = host[0]->include[c]; } } /* tar */ if ( host[which]->tar == NULL ) { if ( host[0]->tar == NULL ) { VVERBOSE("%s %s", "No tar path given, defaulting to:",TAR); host[which]->tar = TAR; } else host[which]->tar = host[0]->tar; } /* tar options */ if ( host[which]->tar_conf_opt == NULL ) { if ( host[0]->tar_conf_opt == NULL ) { VVERBOSE("%s %s", "No tar option given, defaulting to:",TAR_CONF_OPT); host[which]->tar_conf_opt = TAR_CONF_OPT; } else host[which]->tar_conf_opt = host[0]->tar_conf_opt; } if ( host[which]->mcrypt == NULL ) { if ( host[0]->mcrypt == NULL ) { VVERBOSE("%s %s", "No mcrypt path given, defaulting to:",MCRYPT); host[which]->mcrypt = MCRYPT; } else host[which]->mcrypt = host[0]->mcrypt; } if ( host[which]->gpg == NULL ) { if ( host[0]->gpg == NULL ) { VVERBOSE("%s %s", "No gpg path given, defaulting to:",GPG); host[which]->gpg = GPG; } else host[which]->gpg = host[0]->gpg; } /* extra check proto, tar, find */ /* 11-11-2003 Don't check for this when we are receiving a backup */ if ( arg.scheme != REMOTE ) { if (!g_file_test(host[which]->tar, G_FILE_TEST_IS_EXECUTABLE)) { SYSLOG_HW("%s", "Tar command could not be found - check your \'tar\' option"); FATAL("%s: %s", host[which]->name, "Tar command could not be found - check your \'tar\' option"); } } /* only check for ->proto when doing a remote backup * [bug 4] in bugzilla. */ if ( arg.scheme == REMOTE ) { if (!g_file_test(host[which]->proto, G_FILE_TEST_IS_EXECUTABLE)) { SYSLOG_HW("%s", "Proto command could not be found - check your \'proto\' option"); FATAL("%s: %s", host[which]->name, "Proto command could not be found - check your \'proto\' option"); } } if ( host[0]->proto_opt == NULL ) host[0]->proto_opt = PROTO_OPT; if ( host[which]->proto_opt == NULL ) host[which]->proto_opt = host[0]->proto_opt; /* the remote hdup, default locations */ if ( host[0]->remote_hdup == NULL ) host[0]->remote_hdup = REMOTE_HDUP; if ( host[0]->remote_hdup_opt == NULL ) host[0]->remote_hdup_opt = REMOTE_HDUP_OPT; if ( host[which]->remote_hdup == NULL ) host[which]->remote_hdup = host[0]->remote_hdup; if ( host[which]->remote_hdup_opt == NULL ) host[which]->remote_hdup_opt = host[0]->remote_hdup_opt; /* always copy these */ if ( host[which]->skip == -1 ) host[which]->skip = host[0]->skip; if ( host[which]->force == -1 ) host[which]->force = host[0]->force; if ( host[which]->overwrite == -1 ) host[which]->overwrite = host[0]->overwrite; if ( host[which]->sparse == -1 ) host[which]->sparse = host[0]->sparse; if ( host[which]->always == -1 ) host[which]->always = host[0]->always; if ( host[which]->allow_remote == -1 ) host[which]->allow_remote = host[0]->allow_remote; if ( host[which]->history == -1 ) host[which]->history = host[0]->history; if ( host[which]->onefile == -1 ) host[which]->onefile = host[0]->onefile; if ( host[which]->log == -1 ) host[which]->log = host[0]->log; if ( host[which]->history == 1 ) WARN("%s","\'no history\' is set, using \'static\' directory. This is not smart, but your wish is my command"); if ( host[which]->log == 1 ) { openlog(basename(progname) , LOG_CONS || LOG_PID, LOG_DAEMON ); hdup_log = 1; } /* if we do not redefine exclude take the one from global */ if(host[which]->exclude[0] == NULL) { for (c = 0; c < MAXDIR; c++ ) { if (host[0]->exclude[c] == NULL) break; host[which]->exclude[c] = host[0]->exclude[c]; } } /* always put the archive dir in the exclude list * this is what skip used to do */ host[which]->exclude[c] = host[which]->archive; /* check algorithm and key path, both must be set, or none */ if ( ( host[which]->alg == NULL && host[which]->keypath != NULL ) || ( host[which]->alg != NULL && host[which]->keypath == NULL ) ) { SYSLOG_HW("%s","Both algorithm and key must be set"); FATAL("%s: %s",host[which]->name, "Both algorithm and key must be set"); } /* check group name */ if (host[which]->group != NULL) { grp = getgrnam(host[which]->group); if (!grp) FATAL("%s: %s %s",host[which]->name, host[which]->group, "is not a valid group"); } if (host[which]->alg != NULL) { /* is alg == gpg, we must check gpg instead */ if ( strcasecmp(host[which]->alg, GPG_ALG) == 0 ) { /* yes, gpg */ if (!g_file_test(host[which]->gpg, G_FILE_TEST_IS_EXECUTABLE)) { SYSLOG_HW("%s", "GPG command could not be found - check your \'gpg\' option"); FATAL("%s: %s", host[which]->name, "GPG command could not be found - check your \'gpg\' option"); } goto out; /* my God, a goto, this program sucks! */ } /* check mcrypt location */ if (!g_file_test(host[which]->mcrypt, G_FILE_TEST_IS_EXECUTABLE)) { SYSLOG_HW("%s", "Mcrypt command could not be found - check your \'mcrypt\' option"); FATAL("%s: %s", host[which]->name, "Mcrypt command could not be found - check your \'mcrypt\' option"); } /* check for valid algorithms */ if (hdup_checkalg(host[which]->alg, algs) == 0) { SYSLOG_HW("Invalid algorithm: %s", host[which]->alg); FATAL("%s: Invalid algorithm: %s", host[which]->name, host[which]->alg); } out: /* is key availible, disable check for GPG */ if ( strcasecmp(host[which]->alg, GPG_ALG) != 0 ) { if (!g_file_test(host[which]->keypath, G_FILE_TEST_IS_REGULAR)) { SYSLOG_HW("%s %s %s", "Encryption key", host[which]->keypath," not found"); FATAL("%s: %s %s %s", host[which]->name, "Encryption key", host[which]->keypath," not found"); } } } /* if history = no, hdup does not keep a history. Everything is stored * in a static dir, I'm tweaking getdate for this, which is a bit of a hack, * but it will then work everywere */ if ( arg.scheme == RESTORE ) { /* arg.date must be filled or we exited above */ if (g_str_equal(arg.date, STATIC)) { /* equals 'static', we must set the history to one */ host[which]->history = 1; WARN("%s","\'no history\' is set, using \'static\' directory, see hdup.conf(5)"); } } /* check the compression level, it should be a single integer [0..9] */ if ( atoi(host[which]->complevel) < 1 || atoi(host[which]->complevel) > 9 ) { /* somebody is trying to do something stupid */ WARN("%s %s",host[which]->complevel," should be an integer between 1 and 9 (will use 6)"); host[which]->complevel = "-6"; } host[which]->date = (char*) g_malloc(11); if (g_str_equal(host[which]->datespec, "default")) { /* look for today */ if ( arg.date != NULL ) if (g_str_equal(arg.date, "today") == 0) { /* get new space for arg.date */ arg.date = (char*)g_malloc(11); hdup_getdate(arg.date, DATE_DEF, 0 ); } hdup_getdate(host[which]->date, DATE_DEF, host[which]->history); } else if (g_str_equal(host[which]->datespec, "iso")) { /* look for today */ if (arg.date != NULL) if (g_str_equal(arg.date, "today")) { arg.date = (char*)g_malloc(11); hdup_getdate(arg.date, DATE_ISO, 0 ); } hdup_getdate(host[which]->date, DATE_ISO, host[which]->history); } else if (g_str_equal(host[which]->datespec, "american")) { /* look for today */ if ( arg.date != NULL ) if (g_str_equal(arg.date, "today")) { arg.date = (char*) g_malloc(11); hdup_getdate(arg.date, DATE_US, 0 ); } hdup_getdate(host[which]->date, DATE_US, host[which]->history); } else { FATAL("%s: %s", host[which]->name, "Date spec should be \'default\',\'iso\' or \'american\'"); } if ( host[which]->archive == NULL ) { SYSLOG_HW("%s", "No directories specified to store the archives, use \'archive dir\'"); FATAL("%s: %s", host[which]->name, "No directories specified to store the archives, use \'archive dir\'"); } if ( host[which]->path[0] == NULL && arg.scheme < REMOTE ) { SYSLOG_HW("%s", "No directories to backup specified, use \'dir\'"); FATAL("%s: %s",host[which]->name, "No directories to backup specified, use \'dir\'"); } /* if a chunksize is specified the optional size letter (m or k) must be * lowercase */ /* FIXME: ok, i'm totally not sure about this, but it seems to work */ if ( host[which]->chunksize != NULL ) { LOGDEBUG("chunk %s", host[which]->chunksize); for (cp = host[which]->chunksize; *cp != 0; cp++) { *cp = tolower( (int) *cp ); } LOGDEBUG("chunk %s", host[which]->chunksize); } /* run the prerun script - do this way early. People like to mount their * backup filesystem before doing anything */ if ( host[which]->prerun != NULL ) { if ( hdup_runpre(host[which], scheme, arg.scheme) != 0 ) { SYSLOG_HW("%s","Prescript executed with errors"); FATAL("%s: %s",host[which]->name, "Prescript executed with errors"); } } /* setup the overview status message */ hdup_overview(NULL, NULL); hdup_overview("Hdup version", VERSION); hdup_overview(NULL,NULL); /* time keeping */ (void)time( &(host[which]->elapsed)); if ( arg.scheme == DAILY || arg.scheme == WEEKLY || arg.scheme == MONTHLY) { hdup_overview("Host", host[which]->name); hdup_overview("Date", host[which]->date); /* okay all the options are parsed we can do some REAL work */ backup_local(host, which, &arg); } else if (arg.scheme == REMOTE) { /* remote always reads from stdin */ /* fix hostname argument for REMOTE */ host[which]->name = arg.host; /* FIXME: still necessary? */ hdup_overview("Host", host[which]->name); hdup_overview("Date", host[which]->date); hdup_overview("Scheme", scheme[arg.scheme]); /* only complain when not receiving this via stdin */ if ( host[which]->allow_remote == 0) { /* host not allowed to put stuff here */ LOG("%s","Remote is \'off\'. This host is not allowed to upload archives"); hdup_cleanup(-1, host[which]); } /* prerun scripts are run! 11-09-2003 */ backup_remote(host, which); } else if (arg.scheme == RESTORE) { char *arch; arch = g_strdup_printf("%s/%s",host[which]->archive,arg.host); if ( hdup_globfilecheck(arch, NULL) == 0 ) FATAL("%s","Cannot find any archives for this host"); g_free(arch); hdup_overview("Host", host[which]->name); hdup_overview("Date", host[which]->date); if ( arg.extractfile == NULL ) hdup_overview("Scheme", scheme[arg.scheme]); else hdup_overview("Scheme", "restore (specific)"); /* no prerun scripts are run */ backup_restore(host, which, &arg); } /* init the log string at this point */ logstring = NULL; if (arg.scheme != RESTORE) { hdup_overview("Bytes written", (char*)hdup_humansize(host[which]->bytes)); } if (host[which]->chunksize != NULL) { logstring = g_strdup_printf("%s (chunked)", (char*)hdup_humansize(host[which]->bytes)); } else { logstring = g_strdup_printf("%s", (char*)hdup_humansize(host[which]->bytes)); } /* first unlock THEN perform the postrun script, always lock, remote, * restore or normal operations */ if (arg.scheme != RESTORE) { (void)hdup_lock(host[which], UNLOCK); } if (hdup_sig) hdup_cleanup(-1, NULL); /* post run script */ /* some people use the LOCK file on a mounted medium which gets * unmounted by a postrun script, so we must unlock before the * postrun script runs. */ if (host[which]->postrun != NULL) { /* we must do some postrun stuff */ if ( hdup_runpost(host[which], scheme, arg.scheme) != 0 ) { /* something went wrong, non fatal error */ WARN("%s","Postscript executed with errors"); /*SYSLOG_HW("%s","Postscript executed with errors");*/ } } /* time keeping */ host[which]->elapsed = time(NULL) - host[which]->elapsed; hdup_overview("Elapsed", hdup_time(host[which]->elapsed)); SYSLOG("SUCCESS, %s (%s): %s, %s", host[which]->name, scheme[arg.scheme], logstring, hdup_time(host[which]->elapsed)); if (arg.scheme < REMOTE ) hdup_overview("Status", "successfully performed backup"); if (arg.scheme != REMOTE) hdup_cleanup(0,NULL); else /* no overview, normal exit */ hdup_cleanup(-2,NULL); return 0; } hdup-2.0.14/src/Makefile.in0000600000175000000270000000373510341325442013644 0ustar frankie# Configuration. OBJ=hdup.o hdupconf.o hduplib.o hduprun.o hdupremote.o hduprestore.o hduptarlib.o walker.o HDR=hdup.h prototype.h # DEBUGGING STRIP=strip hdup prefix = @prefix@ exec_prefix = @exec_prefix@ sbindir = @sbindir@ mandir = @mandir@ sysconfdir = @sysconfdir@ hdup_config = $(sysconfdir)/hdup/hdup.conf GCC = @CC@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ CFLAGS =-Wall @CFLAGS@ @DEFS@ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -Wpointer-arith -Wstrict-prototypes -DETCFILE=\"$(hdup_config)\" INSTALL = ../install-sh -c INSTALL_PROG = $(INSTALL) INSTALL_DATA = $(INSTALL) -m 644 ###################################### ###################################### .PHONY: clean install all uninstall %.o: %.c ${HDR} ${GCC} ${CFLAGS} ${GLIB_CFLAGS} -c $< all: hdup Makefile.in hdup: ${OBJ} ${HDR} Makefile.in ${GCC} ${GLIB_LIBS} ${OBJ} -o hdup ${STRIP} hdup.h: hdup.h.in Makefile.in @(cd .. ; ./configure) clean: @echo -n "Removing object files..." @rm -f *.o @rm -f hdup @rm -f core @rm -f hdup.h @rm -f config.h @echo "done" uninstall: @echo -n "Uninstalling hdup..." @rm -f ${DESTDIR}${sbindir}/hdup @rmdir --ignore-fail-on-non-empty ${DESTDIR}${sysconfdir}/hdup @rm -f ${DESTDIR}${mandir}/man1/hdup.1 @rm -f ${DESTDIR}${mandir}/man5/hdup.conf.5 @echo "done" install: hdup ../hdup.conf.distr ../doc/hdup.1 ../doc/hdup.conf.5 @echo "Installing in hdup in ${DESTDIR}${sbindir}..." @mkdir -p ${DESTDIR}${sysconfdir}/hdup @mkdir -p ${DESTDIR}${mandir}/man1 @mkdir -p ${DESTDIR}${mandir}/man5 @[ -f ${DESTDIR}${sysconfdir}/hdup/hdup.conf ] || ${INSTALL} -m 600 ../hdup.conf.distr ${DESTDIR}${sysconfdir}/hdup/hdup.conf @[ -f ${DESTDIR}${sysconfdir}/hdup/postrun-warn-user ] || ${INSTALL} -m 750 ../postrun-warn-user ${DESTDIR}${sysconfdir}/hdup/postrun-warn-user @${INSTALL} hdup ${DESTDIR}${sbindir}/hdup @${INSTALL_DATA} ../doc/hdup.1 ${DESTDIR}${mandir}/man1/hdup.1 @${INSTALL_DATA} ../doc/hdup.conf.5 ${DESTDIR}${mandir}/man5/hdup.conf.5 @echo "done" hdup-2.0.14/src/config.h.in0000600000175000000270000000174310312614216013615 0ustar frankie/* hdup config file * create for autoconfig, 16 apr 2003 */ #undef HAVE_GETOPT_H #undef HAVE_SYS_VFS_H #undef HAVE_SYS_PARAM_H #undef HAVE_SYS_STATVFS_H #include #include #include #include #include #include /* included to fix Solaris compile warning */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* gnu long options */ #ifdef HAVE_GETOPT_H #include #endif /*HAVE_GETOPT_H*/ #ifdef HAVE_SYS_VFS_H #include #endif /*HAVE_SYS_VFS_H*/ #ifdef HAVE_SYS_PARAM_H #include #include #endif /*HAVE_SYS_PARAM_H*/ #ifdef HAVE_SYS_STATVFS_H #include #endif /*HAVE_SYS_STATVFS_H*/ hdup-2.0.14/src/hdup.h.in0000600000175000000270000002004210341657022013305 0ustar frankie/* hdup header file * * $Id: hdup.h.in,v 1.41 2004/09/25 22:47:41 miekg Exp $ * Author: Miek Gieben * Creation date: Wed, 27 feb 2002 * Gone with autoconf: 16 apr 2003 */ #define VERSION "@PACKAGE_VERSION@" #define PROGNAME "@PACKAGE_NAME@" #include "config.h" #define TAR "@tar@" #define MCRYPT "@mcrypt@" #define GPG "@gpg@" #define DEFAULT_PROTO "@ssh@" #define PROTO_OPT "" /* empty */ #define BZIP_PROG "@bzip@" #define GZIP_PROG "@gzip@" #define LZOP_PROG "@lzop@" #define SPLIT_PROG "@split@" #define UNSPLIT_PROG "@cat@" #define REMOTE_HDUP "@prefix@/sbin/hdup" #define REMOTE_HDUP_OPT "" /* default is empty */ #define FILELIST "/filelist" #define MUTE " 2>/dev/null" #define SPARSE " --sparse " #define ONEFILE " --one-file-system " #define TAR_CONF_OPT "" #define DATE_DEF 0 #define DATE_ISO 1 #define DATE_US 2 #define DEF_USER "operator" #define STATIC "static" /* no history = yes */ /* this is the special GPG string used as algorithm */ #define GPG_ALG "gpg" /* make gpg act like a filter */ #define GPG_CRYPT "--trust-model always -e -r %s --batch -o -" #define GPG_DECRYPT "--trust-model always -d -r %s -o -" /* hdup's protocol header for talking to another hdup program*/ #define PROT_VER "v2" /* advanced enough to have versioning, yeah! */ #define PROT_NAME "HDUP" #define PROT_SEP "\n" #define LOGDEBUG(FORMAT, EXP...) \ debug == 1 ? \ fprintf(stderr, "[DEBUG] " FORMAT "\n", EXP) \ : 1 /* simplifies logging inside hdup */ #define LOG(FORMAT, EXP...) \ quiet > 1 ? \ 1 \ : fprintf(stderr, "%s: " FORMAT ".\n", progname, EXP) #define SYSLOG(FORMAT, EXP...) \ hdup_log == 1 ? \ syslog(LOG_WARNING, FORMAT, EXP) \ : 1 /* one for host (_H) and one for host[which] (_HW) */ #define SYSLOG_H(FORMAT, EXP...) \ SYSLOG("FAILURE, %s, " FORMAT , host->name, EXP) #define SYSLOG_HW(FORMAT, EXP...) \ SYSLOG("FAILURE, %s, " FORMAT , host[which]->name, EXP) #define FATAL(FORMAT, EXP...) \ do { \ fprintf(stderr, "%s: FATAL: " FORMAT ".\n", progname, EXP); \ hdup_cleanup(-1,NULL); \ } while (0) #define FATAL_HOST(HOST, FORMAT, EXP...) \ do { \ fprintf(stderr, "%s: FATAL: " FORMAT ".\n", progname, EXP); \ hdup_cleanup(-1,HOST); \ } while (0) #define VERBOSE(FORMAT, EXP...) \ verbose < 2 ? \ fprintf(stderr,"%s: " FORMAT ".\n", progname, EXP) \ : 1 #define VVERBOSE(FORMAT, EXP...) \ verbose < 1 ? \ fprintf(stderr,"%s: " FORMAT ".\n", progname, EXP) \ : 1 /* print a warning no matter what */ #define WARN(FORMAT, EXP...) \ fprintf(stderr,"%s: WARNING: " FORMAT "!\n", progname, EXP); /* fix warning on Cygwin */ #ifndef MAXPATHLEN #define MAXPATHLEN 2048 #endif /* not MAXPATHLEN*/ #define OVERVIEW 50 #define MAXDIR 255 #define MAXHOST 255 #define DOTEND 13 /* this is ugly and old. When tar did it's own compression * this was usefull. Nowadays hdup does the compression. These * values are used to determine what compression is used for * tar. Better was if this was named, none, gzip, bzip etc */ #define TAR_NONE "cpf" #define TAR_GZIP "cpfz" #define TAR_BZIP "cpfj" #define TAR_LZOP "cpfl" /* fake tar commandline */ /* DEcompression is still handled insde tar - this has no influence * on the incremental stuff */ /* general unpack option */ #define UNTAR_OPT "xpfC" #define UNTAR_NONE "" #define UNTAR_GZIP "--use-compress-program @gzip@" #define UNTAR_BZIP "--use-compress-program @bzip@" #define UNTAR_LZOP "--use-compress-program @lzop@" #define DAILY 0 #define WEEKLY 1 #define MONTHLY 2 #define REMOTE 3 #define RESTORE 4 #define SCHEME_ILL 5 #define LOCK 0 #define UNLOCK 1 #define GIGABYTE 1073741824 #define MEGABYTE 1048576 #define KILOBYTE 1024 #define SECDAY 86400 #define SECHOUR 3600 #define SECMIN 60 #define PREV -1 #define NEXT 1 #define MAXRESTORE 100 #define NONE 0 #define NONE_EXT ".tar" #define GZIP 1 #define GZIP_EXT ".tar.gz" #define BZIP 2 #define BZIP_EXT ".tar.bz2" #define CRYPT 4 #define MCRYPT_EXT ".nc" #define SPLIT 5 #define SPLIT_EXT "__split__" #define LZOP 6 #define LZOP_EXT ".tar.lzo" #define SPLIT_WILDCARD_EXT "*__split__" /* these defines are used in hdup_comression_crypt */ #define MCRYPT_GZIP_EXT ".tar.gz.nc" #define MCRYPT_BZIP_EXT ".tar.bz2.nc" #define MCRYPT_LZOP_EXT ".tar.lzo.nc" #define MCRYPT_NONE_EXT ".tar.nc" #define BUFSIZE 2048 /* the number of keywords */ #define KEYWORDS 35 /* the keywords are defined in hdupconf.c */ #define KEY_BACKUP 0 #define KEY_EXCLUDE 1 #define KEY_PROTO_OPT 2 #define KEY_USER 3 #define KEY_COMP 4 #define KEY_PRE 5 #define KEY_POST 6 #define KEY_PROTO 7 #define KEY_INCLUDE 8 #define KEY_DATESPEC 9 #define KEY_ALG 10 #define KEY_KEYFILE 11 #define KEY_OVERWRITE 12 #define KEY_SKIP 13 #define KEY_FORCE 14 #define KEY_SPARSE 15 #define KEY_TAR 16 #define KEY_FIND 17 #define KEY_ALWAYS 18 #define KEY_ALLOW 19 #define KEY_REMOTE_HDUP 20 #define KEY_REMOTE_HDUP_OPT 21 #define KEY_ARCHIVE 22 #define KEY_MCRYPT 23 #define KEY_HISTORY 24 #define KEY_ONEFILE 25 #define KEY_CHUNKSIZE 26 #define KEY_FREE 27 #define KEY_LOG 28 #define KEY_INHERIT 29 #define KEY_COMPLEVEL 30 #define KEY_GPG 31 #define KEY_GROUP 32 #define KEY_TAR_OPT 33 #define KEY_NOBACKUP 34 /* holds the %-vars (%h,%a,%s,%e,%u,%c,%g) */ #define SUBS 7 #define ALGORITHMS { \ {1, "cast-128"}, \ {2, "gost"}, \ {3, "rijndael-128" }, \ {4, "twofish" }, \ {5, "arcfour" }, \ {6, "cast-256" }, \ {7, "loki97" }, \ {8, "rijndael-192" }, \ {9, "saferplus" }, \ {10, "wake" }, \ {11, "blowfish-compat" }, \ {12, "des" }, \ {13, "rijndael-256" }, \ {14, "serpent" }, \ {15, "xtea" }, \ {16, "blowfish" }, \ {17, "enigma" }, \ {18, "rc2" }, \ {19, "tripledes"}, \ {0, NULL} \ } struct tab { int sym; const char *name; }; struct argument_t { char *configpath; unsigned int scheme; char *host; char *date; char *extractdir; char *extractfile; }; /* hold all the info about a specific host */ struct host { char *name; char *tar; char *archive; char *path[MAXDIR]; char *exclude[MAXDIR]; /* holds the exclude globbing patterns */ char *include[MAXDIR]; /* holds the include globbing patterns */ char *user; char *group; char *mcrypt; char *gpg; char *keypath; char *alg; char *remote; char *compression; char *date; char *datespec; char *basename; char *dirname_date; char *dirname_etc; char *filelist; char *excludelist; char *inclist; char *archivename; char *prerun; char *postrun; char *chunksize; char *free; char *complevel; /* compression level */ /* keep an eye on time */ time_t elapsed; /* how many bytes are written */ unsigned long long int bytes; /* define own options for each proto */ char *proto; char *proto_opt; char *remote_hdup; char *remote_hdup_opt; char *tar_conf_opt; /* Patch from Haskins */ char *nobackup; /* look for .nobackup files */ /* folded in the options from hdup-1.5 */ int overwrite; int skip; int force; int sparse; int always; int onefile; int allow_remote; /* host allowed to write archive */ int history; /* store everything in one dir or not */ int log; /* do syslogging */ }; struct header { char *prot_name; char *prot_ver; char *hostname; char *scheme; char *date; char *compression; char *encryption; char *extractdir; }; extern unsigned int quiet; extern unsigned int debug; extern unsigned int patched_tar; extern int verbose; extern unsigned int hdup_log; extern sig_atomic_t hdup_pipe; extern sig_atomic_t hdup_sig; extern sig_atomic_t hdup_alrm; extern char *progname; extern char *scheme[]; extern char *keyword[]; extern char *subvar[]; extern char *dots; extern char *spaces; extern const char ok_chars[]; typedef struct host host_t; typedef struct host * phost_t; typedef struct header header_t; typedef struct header * pheader_t; hdup-2.0.14/src/hduplib.c0000600000175000000270000010405510341413554013371 0ustar frankie/* hduplib.c * lib with some general function handy for hdup * * $Id: hduplib.c,v 1.95 2004/09/27 07:42:38 miekg Exp $ * * Copyright: * * This package is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 dated June, 1991. * * This package is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this package; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. * */ #include"hdup.h" #include"prototype.h" extern unsigned int dryrun; char *dots = "......................................"; char *spaces = " "; char *overview[OVERVIEW]; int hdup_getdate(char * d, int format, int history) { /* return the date in d * in format. With 0-padding */ time_t currenttime; struct tm *ltime; if (history == 1) { g_strlcpy(d, STATIC, strlen(STATIC) + 1); return FALSE; } (void)time(¤ttime); ltime = localtime(¤ttime); switch (format) { default: case DATE_DEF: /* DD-MM-YYYY */ g_snprintf(d,11, "%.2d-%.2d-%4d",ltime->tm_mday, (ltime->tm_mon+1), (ltime->tm_year+1900)); break; case DATE_ISO: /* YYYY-MM-DD */ g_snprintf(d,11, "%4d-%.2d-%.2d",(ltime->tm_year+1900), (ltime->tm_mon+1), ltime->tm_mday); break; case DATE_US: /* MM-DD-YYYYY */ g_snprintf(d,11, "%.2d-%.2d-%4d",(ltime->tm_mon+1), ltime->tm_mday, (ltime->tm_year+1900)); break; } return TRUE; } int hdup_parsedate(char *d, int format, int *day, int *mon, int *year) { /* parse a date according to format */ switch (format) { default: case DATE_DEF: return sscanf(d,"%2d-%2d-%4d",day,mon,year); case DATE_ISO: return sscanf(d,"%4d-%2d-%2d",year,mon,day); case DATE_US: return sscanf(d,"%2d-%2d-%4d",mon,day,year); } } char * hdup_makedate(int format, int day, int mon, int year) { /* return the date in d */ char *d = g_malloc(11); switch (format) { default: case DATE_DEF: /* DD-MM-YYYY */ g_snprintf(d,11, "%.2d-%.2d-%4d",day,mon,year); break; case DATE_ISO: /* YYYY-MM-DD */ g_snprintf(d,11, "%4d-%.2d-%.2d",year, mon, day); break; case DATE_US: /* MM-DD-YYYYY */ g_snprintf(d,11, "%.2d-%.2d-%4d",mon, day, year); break; } return d; } /* 5 Oct 2005, Glib, miekg */ int hdup_setup(phost_t host[], int which) { /* create /vol/backup/ * /vol/backup//etc * /vol/backup// */ char *basename; char *d_etc; char *d_date; /* create the path of the directory */ basename = g_strconcat(host[which]->archive, host[which]->name, NULL); host[which]->basename = basename; /* create dir_date */ d_date = g_strconcat(basename, "/", host[which]->date, NULL); host[which]->dirname_date = d_date; d_etc = g_strconcat(basename, "/etc", NULL); host[which]->dirname_etc = d_etc; (void)hdup_mkdir ( host[which]->basename , 0750, host[which]->user, host[which]->group); (void)hdup_mkdir ( host[which]->dirname_etc, 0750, host[which]->user, host[which]->group); (void)hdup_mkdir ( host[which]->dirname_date, 0750, host[which]->user, host[which]->group); return TRUE; } void hdup_archive(phost_t host, int s) { /* fill host entry with the archive name */ if (g_str_equal(host->compression, TAR_BZIP)) { host->archivename = g_strdup_printf("%s/%s.%s.%s%s", host->dirname_date, host->name,host->date, scheme[s],BZIP_EXT); return; } if (g_str_equal(host->compression, TAR_LZOP)) { host->archivename = g_strdup_printf("%s/%s.%s.%s%s",host->dirname_date, host->name,host->date,scheme[s],LZOP_EXT); return; } if (g_str_equal(host->compression, TAR_NONE)) { host->archivename = g_strdup_printf("%s/%s.%s.%s%s",host->dirname_date, host->name,host->date,scheme[s],NONE_EXT); return; } host->archivename = g_strdup_printf("%s/%s.%s.%s%s",host->dirname_date, host->name,host->date,scheme[s],GZIP_EXT); } int hdup_inclist(phost_t host, int s) { /* * month -> delete month/week/day -> use month * weekly -> if no weekly -> cp month to weekly * | then use weekly + rm daily * daily -> if no daily -> cp weekly to daily * | then use daily */ char *inc_day, *inc_week, *inc_month = NULL; if (s == REMOTE) { LOG("%s","Internal error: wrong function call..."); hdup_cleanup(1, host); } inc_month = g_strdup_printf("%s/inclist.%s", host->dirname_etc,scheme[MONTHLY]); inc_week = g_strdup_printf("%s/inclist.%s", host->dirname_etc,scheme[WEEKLY]); inc_day = g_strdup_printf("%s/inclist.%s", host->dirname_etc, scheme[DAILY]); switch (s) { case MONTHLY: host->inclist = inc_month; /* remove it */ hdup_unlink(host->inclist); hdup_unlink(inc_week); hdup_unlink(inc_day); g_free (inc_week); g_free(inc_day); break; case WEEKLY: host->inclist = inc_week; if (g_file_test(inc_month, G_FILE_TEST_IS_REGULAR)) { /* does exist cp monthly to weekly */ if (hdup_cp(inc_month,inc_week) != 0 ) WARN("%s", "Failed to copy, performing full dump"); hdup_unlink(inc_day); } else { if ( host->always == 0 ) { /* complain and do not go a level up */ WARN("%s", "Could not find previous backup list"); WARN("%s", "Backups must be made in order: monthly, weekly and then a daily"); (void)rmdir(host->dirname_date); hdup_cleanup(-1,host); } else { /* We're forcing a monthly */ VERBOSE("%s", "Scheme override weekly -> monthly"); hdup_overview("Scheme","override weekly -> monthly"); return hdup_inclist(host, MONTHLY); } } g_free(inc_month); g_free(inc_day); break; case DAILY: host->inclist = inc_day; if (g_file_test(inc_week, G_FILE_TEST_IS_REGULAR)) { VERBOSE("Copying %s over to daily", inc_week); /* does exist, cp weekly to daily */ if ( hdup_cp(inc_week,inc_day ) != 0 ) WARN("%s","failed to copy, performing full dump"); } else { if ( host->always == 0 ) { /* complain and do not go a level up */ WARN("%s","could not find previous backup list"); rmdir(host->dirname_date); hdup_cleanup(-1,host); } else { /* Go look for a weekly */ VERBOSE("%s", "Scheme override daily -> weekly"); hdup_overview("Scheme","override daily -> weekly"); return hdup_inclist(host, WEEKLY); } } g_free(inc_month); g_free(inc_week); break; } /* set the user */ (void)hdup_chown(host->inclist, host->user, host->group); VERBOSE("Using inclist %s", host->inclist); return s; } int hdup_cp(char *from, char *to) { int pid, status; char *command; /* check args */ if ( from == NULL || to == NULL ) return 1; command = g_strdup_printf("/bin/cp -f %s %s 2>/dev/null", from, to); if ((pid = fork()) < 0) { perror("fork"); hdup_cleanup(1,NULL); } if ( pid == 0 ) { /* child */ execl("/bin/sh", "sh", "-c", command, (char *)NULL); hdup_cleanup(1,NULL); } while (wait(&status) != pid) /* empty */ ; if ( status != 0 ) { /* shit hit the fan */ LOG("%s %s %s %s", "Could not perform the copy:", from, "to", to ); return 1; } return 0; } int hdup_lock(phost_t host, int l) { /* set/unset a LOCK FILE * in host->basename/LOCK */ time_t locktime; int lockfd; char *lockfile = NULL; lockfile = g_strconcat(host->basename, "/LOCK", NULL); if (!lockfile) { SYSLOG_H("%s", "Internal error"); FATAL("%s", "Internal error. Could not get LOCK"); } if (dryrun) { switch(l) { case LOCK: VVERBOSE("%s","Faking LOCK creation"); break; case UNLOCK: VVERBOSE("%s","Faking LOCK removal"); break; } return 0; } switch (l) { case LOCK: lockfd = open(lockfile, O_EXCL | O_CREAT, S_IRUSR | S_IWUSR); if (-1 == lockfd) { if (g_file_test(lockfile , G_FILE_TEST_IS_REGULAR)) { /* check the creation time */ locktime = hdup_file_time(lockfile); if (locktime != (time_t) 0) { SYSLOG_H("LOCK in %s FOUND (%s)", host->basename, strtok(ctime(&locktime),"\n") ); FATAL("%s: LOCK in %s found (%s)", host->name, host->basename, strtok(ctime(&locktime), "\n") ); } else { SYSLOG_H("LOCK in %s FOUND (%s)", host->basename, "unknown"); FATAL("%s: LOCK in %s found (%s)", host->name, host->basename, "unknown"); } } else { SYSLOG_H("%s","Could not get LOCK"); FATAL("%s: %s",host->name, "Could not get LOCK"); } } /* dirty hack, check how much room there is */ if (host->free != NULL) { if (hdup_free(lockfile) < hdup_convert(host->free)) { WARN("%s %s","Need more free space:",host->free); SYSLOG_H("Need more free space: %s",host->free); hdup_cleanup(-1,host); } } VVERBOSE("%s","Creating LOCK"); break; case UNLOCK: if (!g_file_test(lockfile , G_FILE_TEST_IS_REGULAR)) { /* hmmm, nothing */ WARN("%s", "No lockfile found"); g_free(lockfile); return 0; } else { /* lock found */ hdup_unlink(lockfile); } VVERBOSE("%s","Removing LOCK"); break; } g_free(lockfile); return 0; } int hdup_system(char * command) { /* generic command executioner */ int status = 0; char *my_command; if (quiet > 1) { my_command = g_strconcat(command, MUTE, NULL); } else { my_command = g_strdup(command); } LOGDEBUG("command: [%s]", my_command); if (dryrun) { VVERBOSE("Faking: %s", my_command); return 0; } else { VVERBOSE("Running: %s", my_command); status = system(my_command); if ( status != 0 ) { WARN("%s %s","Could not perform the command:", my_command); return 1; } else return 0; } } void hdup_cleanup(int exitcode, phost_t host) { /* exit and do some cleanups */ /* host != NULL -> unlock */ /* Oh, btw this is a mess */ /* exitcode = 0 -> print-overview + exit(0) * exitcode =-1 -> no overview + exit(1) * exitcode =-2 -> no overview + exit(0) * exitcode =>0 -> errors + overview + exit(exitcode) */ if (host != NULL) hdup_lock(host, UNLOCK); if (hdup_log == 1) closelog(); /* newline */ hdup_overview(NULL, NULL); /* no explicit status error */ if ( exitcode > 0 ) { WARN("%s", "AN ERROR OCCURED"); hdup_overview(NULL, NULL); hdup_overview("AN ERROR OCCURED!", NULL); hdup_overview("NOTHING WAS DONE!", NULL); hdup_overview(NULL, NULL); } /* no overview - abnormal exit */ if ( exitcode == -1 ) { /* extra empty line - readability */ fprintf(stderr, "\n"); exit(1); } /* no overview - normal exit */ if ( exitcode == -2 ) exit(0); hdup_print(); exit (exitcode); } int hdup_overview (char *info, char *value) { /* fill the overview */ int li, lv, i; static int row_count = 0; if (row_count > OVERVIEW ) FATAL("%s","overview overflow"); if (info == NULL && value == NULL ){ /* insert newline */ overview[row_count] = g_strdup("\n"); row_count++; return 0; } /* a info.....: value message */ li = strlen(info); lv = strlen(value); i = DOTEND - li; if (!value) { fprintf(stdout, "%.*s%s\n", DOTEND + 2, spaces, info); return 0; } if (i < 0) { WARN("%s %s","Overview \'dotend\' underflow with", info); return 1; } overview[row_count] = g_strdup_printf("%s%.*s: %s\n", info, i, dots, value); row_count++; return 0; } void hdup_print(void) { int i = 0; if ( quiet != 3 ) { /* no 3 -q's */ while (overview[i] != NULL) { fprintf(stdout,"%s", overview[i]); i++; } } } /* return size as a multiple of k, M or G */ char * hdup_humansize(long long size) { /* give back size in 5k, 5M, 5G,etc */ float s = 0; char *filesize; if ( size > GIGABYTE ) { s = (float) size / (float) GIGABYTE; filesize = g_strdup_printf("%.1f%c",s, 'G'); return filesize; } else if (size > MEGABYTE) { s = (float) size / (float) MEGABYTE; filesize = g_strdup_printf("%.1f%c",s, 'M'); return filesize; } else if (size > KILOBYTE) { s = (float) size / (float) KILOBYTE; filesize = g_strdup_printf("%.0f%c",s, 'k'); return filesize; } if (size == 0) { return "0"; } else { filesize = g_strdup_printf("%d%c",(int)size, 'B'); return filesize; } } time_t hdup_file_time (char *filepath) { /* give back the st_ctime, which I (wrongly) treat * as the file creation time */ struct stat buf; if ( filepath == NULL ) return (time_t) 0; if ( stat(filepath, &buf) == 0 ) return buf.st_ctime; else return (time_t) 0; } char * hdup_lastname(char * filepath) { char *w, *last, *t, *pos; if ( filepath == NULL) return NULL; /* if this is a split archive * *__split__ is added to the archive name * We have to chop that off again */ pos = strstr(filepath, SPLIT_WILDCARD_EXT); if ( pos != NULL ) *pos='\0'; /* cut string short */ t = strrchr (filepath, '/'); if ( t != NULL ) { /* advance 1 further */ t++; last = (char*) g_malloc (strlen(filepath)); w = last; while ( *t != '\0' ) { *last = *t; last++; t++; } *last = '\0'; last = w; /* reset */ return last; } return NULL; } int hdup_checkalg(char *algorithm, struct tab *t) { while (t->name != NULL) { if (g_str_equal(t->name, algorithm)) { return t->sym; } t++; } return 0; } int hdup_globfilecheck(char *globpath, char **firstmatch) { /* use glob(3) to search for files */ /* returns the number of found matches */ glob_t globbuf; if (globpath == NULL ) return 0; /* doit */ glob(globpath,0,NULL,&globbuf); /* return value the same on all OSses? Look inside structure */ if ( globbuf.gl_pathc > 0 ) { /* we have a match */ if ( firstmatch != NULL ) { *firstmatch = g_strdup(globbuf.gl_pathv[0]); } globfree(&globbuf); return 1; } else { globfree(&globbuf); return 0; } } int hdup_mkdir(char *dirpath, mode_t mode, char *user, char *group) { char *t, *d; struct stat buf; size_t l = strlen(dirpath); if ( dirpath == NULL ) return -1; /* quardian: / */ d = g_strconcat(dirpath, "/", NULL); /* we can go 1 step too far with t++ */ for (t = d ; *t != '\0' && (unsigned int)(t-d) <= l; t++) { if ( *t == '/' ) { *t = '\0'; /* make mkdir think the string stops here */ /* with an absolute path,we have the d is empty on the * first hit... */ if ( t - d != 0 ) { /* first check if the directory already exists */ if ( stat(d, &buf) != 0 ) { /* ok, the stat failed? Could be EEXIST */ } else { /* succesfull stat, something is there */ if (S_ISDIR(buf.st_mode)) { /* the dir exist, move on */ *t = '/'; /* go on with the loop */ continue; } if (S_ISREG(buf.st_mode)) { /* it's a FILE??? */ FATAL("%s: %s","Is a file", d); } } if (!dryrun) { if (mkdir(d, mode) != 0) { if ( errno != EEXIST ) /* some error has happened - bail out */ FATAL("%s: %s","Could not create directory", d); } hdup_chown(d,user, group); } else { VVERBOSE("Faking mkdir %s", d); } } *t = '/'; /* go on with the loop */ } } g_free(d); return 0; } int hdup_chown(char *path, char *user, char *group) { struct passwd *entry = NULL; struct group *grp = NULL; int fd; uid_t uid; gid_t gid; /* group can be NULL, in that cause use the default * for this user */ if (user == NULL || path == NULL) /* no user given */ return -1; if (group) { if ((grp = getgrnam(group)) == NULL) return -1; } if ((entry = getpwnam(user)) != NULL) { if (!group) gid = entry->pw_gid; else gid = grp->gr_gid; uid = entry->pw_uid; fd = open (path, O_RDONLY | O_NONBLOCK | O_NOCTTY); if (fd == -1) { return 1; } if (fchown(fd, uid, gid) == 0 ) { close(fd); return 0; } else { /* this give a little too much errors */ close(fd); /* perror("chown"); */ return 1; } } else return -1; } int hdup_chmod(char *path) { /* set the of a file to 640 */ mode_t mode; if (path == NULL ) return 1; mode = S_IRUSR | S_IWUSR | S_IRGRP; if ( chmod(path, mode) == 0 ) return 0; else { perror("hdup_chmod"); return 1; } } int hdup_chmod_dir(char *dirpath, int s) { /* go into a dir and give all files in there * a chmod. This does not mean to go in recursively * and do subdirs */ struct dirent *content; DIR * dir; int t = 0; dir = opendir(dirpath); if ( dir == NULL ) return 0; chdir(dirpath); while ( (content = readdir (dir)) != NULL ) { if ( strstr(content->d_name, SPLIT_EXT) != NULL && strstr(content->d_name, scheme[s]) != NULL ) { hdup_chmod(content->d_name); t++; } } return t; } int hdup_chown_dir(char *dirpath, int s, char *user, char *group) { /* see hdup_chmod_dir */ struct dirent * content; DIR * dir; int t = 0; dir = opendir(dirpath); if ( dir == NULL ) return 0; chdir(dirpath); while ( (content = readdir (dir)) != NULL ) { if ( strstr(content->d_name, SPLIT_EXT) != NULL && strstr(content->d_name, scheme[s]) != NULL ) { hdup_chown(content->d_name, user, group); t++; } } return t; } int hdup_unlink(char *path) { if ( unlink(path) == 0 ) return 0; else return 1; } /* create a fake archive * make an empty file and compress * that if needed */ int hdup_mkfake(phost_t host) { FILE *f; char *comp = NULL; /* Flawfinder: ignore */ char *crypt; char *cryptcmd; unsigned int compression; char *arch_no_ext; char *n; compression = hdup_compression(host->archivename); /* cut of extension */ arch_no_ext = g_strdup(host->archivename); switch(compression) { case NONE: break; case GZIP: n = strstr(arch_no_ext, ".gz"); if (n == NULL) WARN("%s","No .gz extension on a gzip file"); *n = '\0'; return 1; case BZIP: n = strstr(arch_no_ext, ".bz2"); if (n == NULL) WARN("%s","No .gz extension on a gzip file"); *n = '\0'; return 1; case LZOP: n = strstr(arch_no_ext, ".lzo"); if (n == NULL) WARN("%s","No .gz extension on a gzip file"); *n = '\0'; return 1; } f = fopen(arch_no_ext, "w+"); if (f == NULL) { WARN("%s", "Could not create empty archive"); return 1; } /* use -f (force) on all compression tools */ switch(compression) { case NONE: comp = NULL; break; case GZIP: comp = g_strdup_printf("%s -%s -f %s",GZIP_PROG, host->complevel, arch_no_ext); break; case BZIP: comp = g_strdup_printf("%s -%s -f %s",BZIP_PROG, host->complevel, arch_no_ext); break; case LZOP: /* -U make lzop behave like gzip/bzip */ comp = g_strdup_printf("%s -U -%s -f %s",LZOP_PROG, host->complevel, arch_no_ext); break; } if (comp != NULL) { /* compress the empty archive */ if (hdup_system(comp) != 0) { WARN("%s","Compression of empty archive failed"); return 1; } } if (host->alg != NULL) { /* Flawfinder: ignore */ crypt = setup_cryptcmd(host); /* Flawfinder: ignore */ cryptcmd = g_strdup_printf("%s %s", crypt, host->archivename); if (hdup_system(cryptcmd) != 0) { WARN("%s","Encryption of empty archive failed"); return 1; } } return 0; } int hdup_compression(char *archivename) { /* return the compression used on an archive */ /* 24 apr 2003: added split support */ char *tmpstring; char *pos; if ( archivename == NULL ) return -1; tmpstring = g_strdup(archivename); /* if archive name matches for __split__ we're * stripping that of and leave the rest of the * function untouched */ if ( (pos = strstr(tmpstring, SPLIT_EXT)) != NULL ) /* split extension found, put a \0 where __split__ * is found. This is after all the other extension. * This way we skip that all together */ *pos = '\0'; /* check for encryption */ if (strstr(tmpstring, MCRYPT_EXT) != NULL ) return CRYPT; /* check for BZIP */ if (strstr(tmpstring, BZIP_EXT) != NULL ) return BZIP; if (strstr(tmpstring, GZIP_EXT) != NULL ) return GZIP; if (strstr(tmpstring, LZOP_EXT) != NULL ) return LZOP; /* should be none than */ return NONE; } int hdup_compression_crypt (char *archivename) { /* return the compression used on an archive if * that archive is also encrypted * 24 apr 2003: split support */ char *tmpstring; char *pos; if ( archivename == NULL ) return -1; tmpstring = g_strdup(archivename); if ( (pos = strstr(tmpstring, SPLIT_EXT)) != NULL ) *pos = '\0'; if (strstr(tmpstring, MCRYPT_BZIP_EXT) != NULL ) return BZIP; if (strstr(tmpstring, MCRYPT_GZIP_EXT) != NULL ) return GZIP; if (strstr(tmpstring, MCRYPT_LZOP_EXT) != NULL ) return LZOP; if (strstr(tmpstring, MCRYPT_NONE_EXT) != NULL ) return NONE; return -1; } int hdup_chunk(char *archivename) { /* check to see if the archive is a split archive */ if ( archivename == NULL ) return -1; if ( strstr(archivename, SPLIT_EXT) != NULL ) return SPLIT; return -1; } int hdup_grep (char *into, char c) { /* search for specific character in into */ char *spot; if ( into == NULL ) return -1; spot = index(into, c); if ( spot == NULL ) /* not found */ return 1; else return 0; } char * hdup_subst(char *into, char *what, char *id) { /* substitute string what in the string into * where string id is located * returns pointer to the newly created string * or the originial string if nothing was found * or *NULL is something went wrong */ /* There is a function in glib for this */ char *lwhere, *rwhere; char *left, *right; /* the newly formed substrings */ char *newstring; size_t lsize, rsize,id_len, into_len, what_len; /* are we called correctly */ if (!into || !id) return NULL; if (!what) what = g_strdup("-empty-"); id_len = strlen(id); into_len = strlen(into); what_len = strlen(what); lwhere = strstr(into, id); /* find where id is located */ if (lwhere == NULL ) /* nothing found return the original string */ return into; /* left part before id */ lsize = lwhere - into; left = g_strdup(into); *(left + lsize) = '\0'; /* terminator */ /* right part after id */ rsize = into_len - ( lsize + id_len) ; right = (char*)g_malloc(rsize + 1); rwhere = into + into_len - rsize; strncpy(right, rwhere, rsize); *(right + rsize) = '\0'; /* terminiator */ /* get *what in between the two parts */ newstring = g_strdup_printf("%.*s%s%.*s", (int)lsize, left, what, (int)rsize, right); /* cannot free these values. See BUG #4 */ #ifdef DEBUG printf("newstring: %s\n",newstring); #endif return newstring; } char * hdup_time(time_t time) { /* print time as hh:mm:ss * time print must be alloced 12 bytes */ int hour,min,sec,mod; mod = time % 3600; hour = (time - mod) / 3600; time = time - (hour * 3600); mod = time % 60; min = (time - mod) / 60; sec = time - (min * 60); if ( hour > 1000 ) { return g_strdup(">1000:00:00s"); } else { return g_strdup_printf("%d:%.2d:%.2d",hour,min,sec); } } int hdup_putheader(pheader_t head, FILE *stream) { /* write a hdup header to stream. This consists of the following: * HDUP\nVERSION\nhostname\nscheme\ndate\ncompression\n * encryption\nextractdir\n */ fprintf(stream, "%s",head->prot_name); fprintf(stream, "%s",PROT_SEP); fprintf(stream, "%s",head->prot_ver); fprintf(stream, "%s",PROT_SEP); fprintf(stream, "%s",head->hostname); fprintf(stream, "%s",PROT_SEP); fprintf(stream, "%s",head->scheme); fprintf(stream, "%s",PROT_SEP); fprintf(stream, "%s",head->date); fprintf(stream, "%s",PROT_SEP); fprintf(stream, "%s",head->compression); fprintf(stream, "%s",PROT_SEP); fprintf(stream, "%s",head->encryption); fprintf(stream, "%s",PROT_SEP); fprintf(stream, "%s",head->extractdir); fprintf(stream, "%s",PROT_SEP); fflush(stream); /* flush it before the archive comes */ return 0; } int hdup_getheader(pheader_t head, FILE *stream) { /* read the header information */ /* NAME\nVERSION\nHOST\nSCHEME\nDATE\COMPR\nTARFILE\EOF */ hdup_readword(head->prot_name, stream, strlen(PROT_NAME)); hdup_readword(head->prot_ver, stream, strlen(PROT_NAME)); hdup_readword(head->hostname, stream, MAXPATHLEN); /* here 1 less the in hdup_fillheader */ hdup_readword(head->scheme, stream, 8); hdup_readword(head->date, stream, 11); hdup_readword(head->compression, stream, 5); hdup_readword(head->encryption, stream, 1); /* y or n */ hdup_readword(head->extractdir, stream, MAXPATHLEN); /* need for restore */ /* sanitize */ hdup_ok_char(head->prot_name); hdup_ok_char(head->prot_ver); hdup_ok_char(head->hostname); hdup_ok_char(head->scheme); hdup_ok_char(head->date); hdup_ok_char(head->compression); hdup_ok_char(head->encryption); hdup_ok_char(head->extractdir); return 0; } int hdup_fillheader(pheader_t head, phost_t host, int s, char *extractdir) { /* fill the header with the information from host */ head->prot_name = g_strdup(PROT_NAME); head->prot_ver = g_strdup(PROT_VER); head->hostname = g_strdup(host->name); head->scheme = g_strdup(scheme[s]); head->date = g_strdup(host->date); head->compression = g_strdup(host->compression); if (host->alg == NULL) head->encryption = g_strdup("n"); else head->encryption = g_strdup("y"); if (extractdir != NULL) head->extractdir = g_strdup(extractdir); else head->extractdir = g_strdup("\0"); return 0; } int hdup_checkheader(pheader_t head) { /* check to see if the header is correctly formed * if not, raise error and quit! */ int s = -1; if ( strncmp ( head->prot_name, PROT_NAME, 4 ) != 0 ) { WARN("%s", "Protocol: name mismatch"); return 1; } if ( strncmp ( head->prot_ver, PROT_VER, 2 ) != 0 ) { WARN("%s", "Protocol: version mismatch"); return 1; } if ( strncmp (head->encryption, "n", 1) != 0 && strncmp(head->encryption, "y", 1) != 0 ) { WARN("%s", "Protocol: encryption must be \'n\' or \'y\'"); return 1; } /* head->hostname is not checked at the moment, but that is not needed * the normal parsing of the config file is already done. * head->hostname MUST be equal to arg.host */ s = hdup_scheme(head->scheme); /* check for unknown and remote. The rest is legal */ if ( s == -1 || s == 3 ) { WARN("%s %s","Protocol: scheme error:", head->scheme); return 1; } /* head->date is not checked at the moment */ /* head->compression is not check at the moment */ return 0; } void hdup_sigpipe(int signal) { /* received a sigpipe, cleanup */ /* reset handler */ struct sigaction sa; sa.sa_handler = SIG_IGN; sa.sa_flags = 0; sigfillset(&sa.sa_mask); sigaction(SIGPIPE, &sa, (struct sigaction *)NULL); WARN("%s","SIGPIPE received, cleaning up"); hdup_pipe = 1; return; } void hdup_sigint(int signal) { /* received sigint, try to cleanup */ /* no resetting needed - we're going to exit */ WARN("%s","SIGINT received, cleaning up"); hdup_sig = 1; return; } void hdup_sigalrm(int signal) { /* alarm went off - this is used during ssh transfers */ WARN("%s","SIGALRM (timeout) received, cleaning up"); hdup_alrm = 1; return; } int hdup_scheme(char *sch) { /* return the scheme sequence number */ int s = -1; /* check the scheme */ if ( strncmp (sch, scheme[DAILY], strlen(scheme[DAILY])) == 0 ) s = DAILY; if ( strncmp (sch, scheme[WEEKLY], strlen(scheme[WEEKLY])) == 0 ) s = WEEKLY; if ( strncmp (sch, scheme[MONTHLY], strlen(scheme[MONTHLY])) == 0 ) s = MONTHLY; if ( strncmp (sch, scheme[REMOTE], strlen(scheme[REMOTE])) == 0 ) s = REMOTE; if ( strncmp (sch, scheme[RESTORE],strlen(scheme[RESTORE])) == 0 ) s = RESTORE; return s; } int hdup_readword(char *word, FILE *from, int lim) { char *l = word; int c; while ( ( c = getc (from)) != EOF ) { if ( c != '\n' ) { *l++ = c; lim--; } else { *l = '\0'; return 0; } if ( lim < 0 ) return 1; } return 1; } int hdup_ok_char(char *check) { /* remove dangerous characters */ /* see: http://www.colorado.edu/htmltools/sanitize.html */ char * cp; for (cp = check; *(cp += strspn(cp, ok_chars)); /* */ ) { VERBOSE("%s: %s", "sanitizing", check); *cp = '_'; } return 0; } long long int hdup_free(char *path) { /* check to see how many bytes are free on the backup file * system */ #ifdef HAVE_SYS_STATVFS_H struct statvfs *buf = (struct statvfs *)g_malloc(sizeof(struct statvfs)); #else struct statfs *buf = (struct statfs *)g_malloc(sizeof(struct statfs)); #endif /*HAVE_SYS_STATVFS_H*/ long long int bytes_free = 0; if ( path == NULL ) return -1; #ifdef HAVE_SYS_STATVFS_H if ( statvfs(path, buf) == 0 ) { #else if ( statfs(path, buf) == 0 ) { #endif /*HAVE_SYS_STATVFS_H*/ bytes_free = buf->f_bavail * buf->f_bsize; VERBOSE("Free partition space: %lld", bytes_free); return bytes_free; } else /* hmm, something wicked happened */ return -1; } long long int hdup_convert (char *value) { /* convert a value like 50k or 50K to a integer. * 50k = 51200 etc */ /* mul should be 1 instead of 0 MG 2004 21 apr */ char *cp; long long int v = 0; long int mul = 1; cp = value; while ( *cp != (char)NULL ) { switch (*cp) { case 'k': case 'K': mul = KILOBYTE; *cp = '\0'; /* mark as ended */ goto end; case 'm': case 'M': mul = MEGABYTE; *cp = '\0'; /* mark as ended */ goto end; case 'g': case 'G': mul = GIGABYTE; *cp = '\0'; /* mark as ended */ goto end; default: break; } cp++; } end: v = strtol(value, NULL, 10); v = v * mul; /* re-insert size modifier */ switch (mul) { case KILOBYTE: *cp = 'K'; break; case MEGABYTE: *cp = 'M'; break; case GIGABYTE: *cp = 'G'; break; } return v; } int usage() { fprintf(stdout,"Usage:\n"); fprintf(stdout," hdup [ OPTION ] SCHEME HOST [ @USER@REMOTE_HOST ] (1st format)\n"); fprintf(stdout," hdup [ OPTION ] restore HOST DATE DIRECTORY [ @USER@REMOTE_HOST ] (2nd format)\n\n"); fprintf(stdout," Default config file location: %s\n",ETCFILE); fprintf(stdout,"\n"); fprintf(stdout,"1st format arguments:\n"); fprintf(stdout," SCHEME"); fprintf(stdout," daily, weekly, monthly, remote\n"); fprintf(stdout," HOST"); fprintf(stdout," specify which host to backup\n"); fprintf(stdout," @USER@REMOTE_HOST"); fprintf(stdout," transfer the archive to this host using USER\n"); fprintf(stdout,"\n2nd format arguments:\n"); fprintf(stdout," HOST"); fprintf(stdout," specify which host to restore\n"); fprintf(stdout," DATE"); fprintf(stdout," restore up to this date\n"); fprintf(stdout," DIRECTORY"); fprintf(stdout," restore to this directory\n"); fprintf(stdout," @USER@REMOTE_HOST"); fprintf(stdout," restore to this host using USER\n"); #ifdef HAVE_GETOPT_H fprintf(stdout,"\nOptions:\n"); fprintf(stdout," -c, --config=config\t\tlocation of the configuration file\n"); fprintf(stdout," -s, --specific=file\t\trestore this file from an archive\n"); fprintf(stdout," -i, --igore_tar\t\tignore tar errors when restoring\n"); fprintf(stdout," -I, --igore_conf\t\tignore errors in the config file\n"); fprintf(stdout," -P, --patched-tar\t\ttar is patched, enables --no-recursion and more\n"); fprintf(stdout," -d, --dryrun\t\tdo a dry run, don't touch the filesystem\n"); fprintf(stdout," -V, --verbose\t\tbe more verbose\n"); fprintf(stdout," -V -V\t\t\tbe even more verbose\n"); fprintf(stdout," -q, --quiet\t\t\tsuppress output from subprocesses\n"); fprintf(stdout," -q -q\t\t\tsuppress logging output\n"); fprintf(stdout," -q -q -q\t\t\tno logging at all, even no overview message\n"); fprintf(stdout," -h, --help\t\t\tthis help\n"); fprintf(stdout," -v, --version\t\tshow version\n"); fprintf(stdout," -D, --debug\t\t\tshow debugging information\n"); #else fprintf(stdout,"\nOptions:\n"); fprintf(stdout," -c config\tlocation of the configuration file\n"); fprintf(stdout," -s file\trestore this file from an archive\n"); fprintf(stdout," -i\t\tignore tar errors when restoring\n"); fprintf(stdout," -I\t\tignore errors in the config file\n"); fprintf(stdout," -P\t\ttar is patched, enables --no-recursion and more\n"); fprintf(stdout," -d\t\tdo a dry run, don't touch the filesystem\n"); fprintf(stdout," -V\t\tbe more verbose\n"); fprintf(stdout," -V -V\tbe even more verbose\n"); fprintf(stdout," -q\t\tsuppress output from subprocesses\n"); fprintf(stdout," -q -q\tsuppress logging output\n"); fprintf(stdout," -q -q -q\tno logging at all, even no overview message\n"); fprintf(stdout," -h\t\tthis help\n"); fprintf(stdout," -v\t\tshow version\n"); fprintf(stdout," -D\t\tshow debugging information\n"); #endif /*HAVE_GETOPT_H*/ fprintf(stdout,"\n"); fprintf(stdout,"Report bugs to .\n"); fprintf(stdout,"Or at http://www.miek.nl/cgi-bin/bugzilla/index.cgi\n"); return 0; } int version() { /* print the version of hdup to stderr */ fprintf(stdout,"%s %s\n",PROGNAME,VERSION); fprintf(stdout,"Written by Miek Gieben.\n\n"); fprintf(stdout,"Copyright (C) 2001-2005 Miek Gieben. This is free software.\n"); fprintf(stdout,"There is NO warranty; not even for MERCHANTABILITY or FITNESS\n"); fprintf(stdout,"FOR A PARTICULAR PURPOSE.\n\n"); fprintf(stdout,"Homepage can be found at http://www.miek.nl/projects/hdup2/\n"); fprintf(stdout,"Report bugs to .\n"); fprintf(stdout,"Or at http://www.miek.nl/cgi-bin/bugzilla/index.cgi\n"); return 0; } hdup-2.0.14/src/hduprun.c0000600000175000000270000000702110341656454013432 0ustar frankie/* hduprun.c, * * functions for running the pre and post run scripts. * * $Id: hduprun.c,v 1.12 2004/06/01 12:17:40 miekg Exp $ * * Copyright: * * This package is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 dated June, 1991. * * This package is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this package; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. * */ #include"hdup.h" #include"prototype.h" int hdup_runpre(phost_t host, char *scheme[], int which_scheme) { /* run the pre script and subsitute variables */ /* hostname */ char *tmp = hdup_subst(host->prerun,host->name,subvar[0]); char *command = hdup_subst(host->prerun,host->name,subvar[0]); int c; LOGDEBUG("%s %s","prerun",command); /* we must do some prerun stuff * start with 1, as we have done 0 above */ for (c = 1; c < SUBS; c++) { switch(c) { case 1: command = hdup_subst(tmp,host->archivename,subvar[1]); break; case 2: /* scheme */ command = hdup_subst(tmp,scheme[which_scheme],subvar[2]); break; case 3: /* encryption */ if (host->alg != NULL) command = hdup_subst(tmp,"yes", subvar[3]); else command = hdup_subst(tmp,"no", subvar[3]); break; case 4: /* user */ command = hdup_subst(tmp,host->user,subvar[4]); break; case 5: if (host->chunksize != NULL) command = hdup_subst(tmp,"yes", subvar[5]); else command = hdup_subst(tmp,"no", subvar[5]); break; case 6: /* group */ command = hdup_subst(tmp,host->group,subvar[6]); break; } tmp = command; /* for the next run */ } command = tmp; /* last thing to do */ LOGDEBUG("%s %s","prerun",command); if ( hdup_system(command) != 0 ) { g_free(command); /* something went wrong */ return 1; } VERBOSE("%s","Succesfully ran pre script"); return 0; } int hdup_runpost(phost_t host, char *scheme[], int which_scheme) { /* we must do some postrun stuff */ /* hostname */ char *command = hdup_subst(host->postrun,host->name,subvar[0]); char *tmp = hdup_subst(host->postrun,host->name,subvar[0]); int c; /* we must do some prerun stuff * start with 1, as we have done 0 above */ for (c = 1; c < SUBS; c++) { switch(c) { case 1: command = hdup_subst(tmp,host->archivename,subvar[1]); break; case 2: /* scheme */ command = hdup_subst(tmp,scheme[which_scheme],subvar[2]); break; case 3: /* encryption */ if ( host->alg != NULL ) command = hdup_subst(tmp,"yes", subvar[3]); else command = hdup_subst(tmp,"no", subvar[3]); break; case 4: /* user */ command = hdup_subst(tmp,host->user,subvar[4]); break; case 5: if (host->chunksize != NULL) command = hdup_subst(tmp,"yes", subvar[5]); else command = hdup_subst(tmp,"no", subvar[5]); break; case 6: /* group */ command = hdup_subst(tmp,host->group,subvar[6]); break; } tmp = command; } command = tmp; LOGDEBUG("%s %s","postrun",command); if ( hdup_system(command) != 0 ) { g_free(command); return 1; } VERBOSE("%s","Succesfully ran post script"); return 0; } hdup-2.0.14/src/hduprestore.c0000600000175000000270000001516310341564262014312 0ustar frankie/* hduprestore.c * restore a filesystem stored with hdup * * $Id: hduprestore.c,v 1.40 2004/09/25 20:54:56 miekg Exp $ * * Copyright: * * This package is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 dated June, 1991. * * This package is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this package; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. * * Changelog: * 06 mar 2003: miekg: reworked the entire restore stuff * 16 mar 2003: miekg: reworked must of it again,for version 1.6.6 * 17 mar 2003: miekg: match name: tar.* -> tar* (catches none compression) * 05 may 2003: miekg: did not add syslogging here: seems a bit pointless * */ #include"hdup.h" #include"prototype.h" void backup_restore(phost_t host[], int which, struct argument_t *arg ) { /* restore an archive, possibly a remote one */ char *restore[MONTHLY + 1]; int i=0; int stat=0; int failure=1; int date_format = 0; int how_many = -1; /* some basic values need to be filled in */ hdup_setup(host,which); /* set the archive to null */ restore[MONTHLY] = NULL; restore[WEEKLY] = NULL; restore[DAILY] = NULL; /* check for restoring to / */ if (g_ascii_strncasecmp(arg->extractdir,"/",1) == 0 && strlen(arg->extractdir) == 1 ) { if ( host[which]->force == 0 ) FATAL("%s", "Restoring to '/' is not a good idea"); else LOG("%s", "Forcing restore to '/'"); } /* check the date format */ if (g_ascii_strncasecmp(host[which]->datespec, "iso", 3) == 0) { date_format = DATE_ISO; } else if (g_ascii_strncasecmp(host[which]->datespec, "american", 8) == 0) { date_format = DATE_US; } else { date_format = DATE_DEF; } if ((how_many = find_restore(arg,host[which], restore, date_format) ) == -1) FATAL("%s", "No archives found: nothing restored"); if (how_many > 3) FATAL("Found to many (%d) archives for restore", how_many); if (how_many < 2) LOG("%s", "No monthly archive found. Trying to restore from what I have"); /* the find_restore function return the archive in restore[]. I must * walk that array in the reverse order: 3 2 1. If it's not null I * should extract it. */ /* if only 1 stat is successfull we're in. If not there really is an error */ if (host[which]->remote == NULL) { if (host[which]->alg != NULL) { /* when moving stuff to the other side - the encryption * information in the config file is prob. bogus. MG 25 * sept 2004 */ hdup_overview("Encryption", g_strdup_printf("yes (%s, %s)", host[which]->alg, host[which]->keypath)); } else { hdup_overview("Encryption", "no"); } } for (i = how_many; i >= 0; i--) { host[which]->date = arg->date; if ( restore[i] != NULL ) { VERBOSE("%s %s", "Restoring from",restore[i]); stat = hdup_dountar(host[which], arg, restore[i]); if (stat != 0 && host[which]->remote != NULL) { /* no point in trying do something next */ break; } hdup_overview("Archives", hdup_lastname(restore[i])); } /* some tar has been lucky */ if (stat == 0) failure = 0; } if (failure == 0) hdup_overview("Status","successfully restored backup"); else hdup_cleanup(1,host[which]); } int find_restore(struct argument_t *arg, phost_t host, char *restore[], int date_format) { /* restore strategy: * first look for daily, if found look for weekly, if found look for * monthly. This all goes backwards in time (yes we can do that) * At most we will have 3 files to untar! Thank you Boris for pointing * the obvious out to me... */ int t,p,h,j;char *d; char *directory,*backupdir; char *archivename;char *matchname; int found; backupdir = host->archive; p = strlen(backupdir); h = strlen(arg->host); d=(char*) g_malloc(12); directory = (char*)g_malloc( p + h + 11 + 5); if (host->history == 1 ) d = g_strdup(STATIC); else d = g_strdup(arg->date); found = -1; for(t = 0;t <= MAXRESTORE; t++) { /* create the dirname */ directory = g_strdup_printf("%s%s/%s",backupdir,arg->host,d); /* the date dir at least exists */ VERBOSE("%s %s","Restore: looking in",directory); if (g_file_test(directory, G_FILE_TEST_IS_DIR)) { /* found = -1 the first time around...MG 1-7-2004 */ /* start with daily then weekly then monthly */ for (j=found + 1; j <= MONTHLY; j++) { /* if a 'static' archive is upped to a remote machine and placed * in a normal date directory hdup will not find it * make the date in archive and it will keep on working * Miek 16 Apr 2003 */ matchname = g_strdup_printf("%s/%s.*.%s.tar*", directory,arg->host,scheme[j]); LOGDEBUG("matchname %s", matchname); if ( hdup_globfilecheck(matchname,&archivename) == 1) { if (restore[j] == NULL) { restore[j] = g_strdup(archivename); g_free(archivename); found = j; } } g_free(matchname); } } if (found == MONTHLY) { /* found them all, or at least a montly */ return MONTHLY; /* found something */ } if (host->history == 1) { /* no history only 1 dir to look in */ return found; } else { /* the previous day */ LOGDEBUG("Current day: %s", d); d = day(d, PREV, date_format); LOGDEBUG("Previous day: %s", d); } } return found; /* nothing found */ } char * day(char *date, int direction, int date_format) { /* substract or add one day from date and return the result */ struct tm *ltime = (struct tm*)g_malloc(sizeof(struct tm)); time_t abstime; char *mydate; int day,month,year; /* unwind it */ hdup_parsedate(date,date_format,&day,&month,&year); if (year < 1990) WARN("Unlikely year seen (%d). Is the date entered correctly?", year); /* do your calculations */ ltime->tm_mday = day; ltime->tm_mon = (month -1); ltime->tm_year = (year - 1900); ltime->tm_sec = 0; ltime->tm_min = 0; ltime->tm_hour = 0; ltime->tm_wday = 0; ltime->tm_yday = 0; ltime->tm_isdst = 0; abstime = mktime(ltime); /* substract a day * if direction is NEXT (+1) this add one day * if direction is PREV (-1) this substracts one day */ abstime = abstime + ( direction * SECDAY ); ltime = localtime(&abstime); day = ltime->tm_mday; month = (ltime->tm_mon + 1); year = (ltime->tm_year + 1900); /* put is back together */ mydate = hdup_makedate(date_format, day, month, year); return mydate; } hdup-2.0.14/contrib/0002700000175000000270000000000010346355756012460 5ustar frankiehdup-2.0.14/contrib/hdup.spec.in0000600000175000000270000000330510317250443014663 0ustar frankieSummary: hdup - Backup program Name: hdup Version: @PACKAGE_VERSION@ Release: 1 Group: Applications/Archiving Vendor: Miek Gieben URL: http://miek.nl/projects/hdup2/hdup.html License: GPL Source: http://www.miek.nl/projects/hdup2/previous/%{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-root Requires: tar >= 1.14.00 # Recommends: gzip, bzip2, openssh, mcrypt # not required %description hdup is used to back up a filesystem. Features include encryption of the archive (with mcrypt), compression of the archive (bzip/gzip/none), the ability to transfer the archive to a remote host or restoring from a remote host (with ssh), the ability to split up archives, and no obscure archive format (it is a normal compressed tar file). %prep %setup -c mv hdup2/* . && rmdir hdup2 # Move into standard directory %build %configure make %install rm -rf $RPM_BUILD_ROOT install -d $RPM_BUILD_ROOT/usr/sbin %makeinstall bindir=$RPM_BUILD_ROOT/usr/sbin %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) /usr/sbin/hdup %dir /etc/hdup %config(noreplace) /etc/hdup/hdup.conf %attr(0644,root,root) %{_mandir}/man1/hdup* %attr(0644,root,root) %{_mandir}/man5/hdup.conf* %doc doc/FAQ.html contrib/*.pl %doc Credits ChangeLog* README %changelog * Fri Sep 30 2005 Miek Gieben - bump the version depency of tar to a more current one * Thu Nov 11 2004 Miek Gieben - patch from Boris to update to hdup2.0.0 * Thu Jun 19 2003 Miek Gieben - spec fixes from Anders Bjorklund - 1.6.17, release 2 * Wed Jun 18 2003 Miek Gieben - 1.6.17 - install in /usr/sbin * Fri Jun 13 2003 Anders Bjorklund - 1.6.16 - inital RPM release hdup-2.0.14/contrib/hdup.sh0000600000175000000270000001751210320047774013750 0ustar frankie#!/bin/bash # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABLILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. You should have received a # copy of the GNU General Public License along with this program; if # not, write to the Free Software Foundation, Inc, 59 Temple Place - # Suite 330, Boston, MA 02111-1307, USA. # On Debian systems, the complete text of the GNU General Public # License can be found in /usr/share/common-licenses/GPL file. # For questions please contact: Juraj.Kubelka@email.cz function snapshot_name { # $1 is name of LVM Logical Volume # Return name of Snapshot for this LVM Logical Volume echo "${1##*/}_SNAPSHOT" } function snapshot_name_long { # $1 is name of LVM Logical Volume # Return name of Snapshot for this LVM Logical Volume # - in logn form (/dev/.../...) echo "${1%/*}/$(snapshot_name "$1")" } function snapshot_directory { # $1 is name of LVM Logical Volume # Return name of directory where you can mount its snapshot echo "/$(snapshot_name "$1")" } function create_snapshot { # $1 is name of LVM Logical Volume for what you want to create snapshot # ... required # $2 is name of directory where you want to mount this snapshot # $3 is size of snapshot you want to create if [ -z "$1" ] ; then echo "Specify LVM Logical Volume for what you want to create snapshot" >& 2 fi SNAP_NAME="$(snapshot_name "$1")" SNAP_NAME_LONG="$(snapshot_name_long "$1")" SNAP_MOUNT_POINT="${2:-$(snapshot_directory "$1")}" SNAP_SIZE=${3:-4G} lvcreate -L"$SNAP_SIZE" -s -n "$SNAP_NAME" "$1" && mkdir "$SNAP_MOUNT_POINT" && mount -o ro "$SNAP_NAME_LONG" "$SNAP_MOUNT_POINT" return $? } # create_snapshot function remove_snapshot { # $1 is name of LVM Logical Volume you want to umount and remove its Snapshot # ... required # $2 is name of directory where this snapshot is mounted if [ -z "$1" ] ; then echo "Specify LVM Logical Volume you want to remove its snapshot" >& 2 fi SNAP_NAME="$(snapshot_name "$1")" SNAP_NAME_LONG="$(snapshot_name_long "$1")" SNAP_MOUNT_POINT="${2:-$(snapshot_directory "$1")}" umount "$SNAP_MOUNT_POINT" rmdir "$SNAP_MOUNT_POINT" lvremove -f "$SNAP_NAME_LONG" } # remove_snapshot LOCK_FILE="/tmp/hdup.lock" function unlock_backups { rm -f $LOCK_FILE } # unlock_backups function lock_backups { # $1 is scheme you want to use (daily, weekly, monthly) lockfile -0 -r1 $LOCK_FILE && \ trap 'unlock_backups ; exit 1' 1 2 3 15 || \ ( echo "HDUP is runnig (scheme: $(cat $LOCK_FILE))." >& 2 return 1 ) || return 1 chmod u+w $LOCK_FILE && echo -n "$1" > $LOCK_FILE && chmod u-w $LOCK_FILE || ( unlock_backups return 1 ) || return 1 } # lock_backups function backup_host { # $1 is scheme you want to use (daily, weekly, monthly) # $2 is name of host you want to backup echo "" echo "+++ Start hdup backup: $1, $2 +++" nice -n 2 hdup -q -q "$1" "$2" RET=$? echo "+++ Done hdup backup: $1, $2 +++" echo "" return $RET } # backup_host function backup_all_hosts { # $1 is scheme you want to use (daily, weekly, monthly) for i in $(cat /etc/hdup/hdup.conf \ | grep -e '^\[[^[]*\]' \ | grep -v global \ | sed -e 's/\[//g' -e 's/\]//g') do backup_host "$1" "$i" || \ return 1 done run_post_backups "$1" } # backup_all_hosts function backup_all_hosts_with_lock { # $1 is scheme you want to use (daily, weekly, monthly) if lock_backups "$1" ; then backup_all_hosts "$1" && unlock_backups "$1" || ( echo "An error during backup." >& 2 echo " Write \`$0 unlock\` before new start." >& 2 return 1 ) || return 1 fi } # backup_all_hosts_with_lock POST_BACKUPS_ADR="/etc/hdup/post-backup.d" function run_post_backups { # $1 is scheme you want to use (daily, weekly, monthly) export HDUP_SCHEME="$1" [ ! -d "$POST_BACKUPS_ADR" ] && return 0 echo "" echo "+++ Start post backups: $1 +++" ls "$POST_BACKUPS_ADR" \ | \ while read backup_script do [ ! -x "$POST_BACKUPS_ADR/$backup_script" ] && continue echo -n "Script ($backup_script): " "$POST_BACKUPS_ADR/$backup_script" && \ echo "done." || \ echo "An ERROR!!!" done echo "+++ Done post backups: $1 +++" echo "" } # run_post_backups HDUP_OUTPUT="/tmp/hdup.output.$$.txt" function backup_and_send_email { # Backup and send email with backup results. # $1 is scheme you want to use (daily, weekly, monthly) HDUP_START_DATE="$(date)" backup_all_hosts_with_lock $* 2>&1 | tee "$HDUP_OUTPUT" HDUP_END_DATE="$(date)" ( echo "HDUP start time: $HDUP_START_DATE." echo "HDUP end time : $HDUP_END_DATE." echo "" cat "$HDUP_OUTPUT" ) \ | mail -s "HDUP backup, scheme $1." root@localhost rm -f "$HDUP_OUTPUT" } # backup_and_send_email function help { cat < [parameters] Commands for backup: backup - backup all hosts backup-by-email - backup all hosts and send report by email Email is sent to root@localhost. There is used screen application. backup-by-email-no-screen - backup all hosts and send report by email There isn't used screen application. parameters: scheme = { daily | weekly | monthly } - see man hdup Commands for support backup: lock - lock backup process Preserve before run backup process. It can be used for disable automatic run backup process. unlock - unlock backup process run-post-backups [scheme] - rerun post backup process manually Usually it is run after all hosts are backup. Scripts are located in ${POST_BACKUPS_ADR} directory. When it is used automatically after backup process, variable HDUP_SCHEME is set to scheme { daily | weekly | monthly }. So it can be used inside scripts. create-snapshot [mount-point] [Snapshot-size] - Create snapshot of LVM-name (see man lvcreate). Size will be set to Snapshot-size. Mount point will be mount-point. remove-snapshot [mount-point] - Remove snapshot of LVM-name. When I've tested it last time (about February 2005), there were some kernel problems with allocating memory for "snapshot table". So now I don't use it. Idea: Write in hdup config file (/etc/hdup/hdup.conf) scheme: [scheme-usr-local] dir = /SYSTEM-USR-SNAPSHOT/local prerun = ${0} create-snapshot /dev/SYSTEM/USR /SYSTEM-USR-SNAPSHOT postrun = ${0} remove-snapshot /dev/SYSTEM/USR /SYSTEM-USR-SNAPSHOT EOF } # help # -------------------------------------------- if [ "$1" = "create-snapshot" ] ; then shift create_snapshot $* elif [ "$1" = "remove-snapshot" ] ; then shift remove_snapshot $* elif [ "$1" = "lock" ] ; then lock_backups testing elif [ "$1" = "unlock" ] ; then unlock_backups elif [ "$1" = "backup" ] ; then shift backup_all_hosts_with_lock $* elif [ "$1" = "backup-by-email" ] ; then shift screen -t hdup.backup."$1" bash -c "$0 backup-by-email-no-screen $*" elif [ "$1" = "backup-by-email-no-screen" ] ; then shift backup_and_send_email $* elif [ "$1" = "run-post-backups" ] ; then shift run_post_backups $* elif [ \( "$1" = "help" \) -o \( "$1" = "-h" \) -o \( "$1" = "--help" \) ] ; then help fi hdup-2.0.14/contrib/cleanup.pl0000600000175000000270000001361310312614216014426 0ustar frankie#!/usr/bin/perl -T -w ### Clean up old backup files according to desired schedule. ### This can be run daily on each machine where backups are stored; ### it will clean up the directories for all client machines. ### # Distributed under the GPL version 2 # This is free software. There is NO warranty; not even for MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. # # Contributed by: Boris Goldowsky use strict; our $usage = "USAGE: $0 [options] Options: -v, --verbose Give details about what was done and why. -n, --dry-run Show what would be done, but do not actually run any backups. -h, --help Show this help message.\n"; ### Customize the variables below for your site ### Or, put all your settings in a configuration file and list it here: our $conf_file = "/opt/hdup/backup-script.conf"; # Path should be sufficient to find "df" $ENV{PATH}="/opt/hdup/sbin:/usr/sbin:/usr/bin:/bin"; $ENV{BASH_ENV} = ''; # Directory where hdup backup files are stored our $basedir = "/backup"; # Keep all daily backups from the last N days our $daily_keep_days = 13; # Keep all weekly backups from the last N days # For dailies to be useful, this value should be >= $daily_keep_days, # and you should keep all monthlies through this time period as well. our $weekly_keep_days = 30; # List desired approximate ages for monthlies to be kept. # The number of elements in this list is the number of monthly dumps that # will be kept at all times. # Each element defines a target age; the best matches are kept. # The default keeps the newest monthly, plus approx. 1, 3, and 6 months ago. our @monthly_keep = (180, 90, 30, 0); ###################################################### ### You shouldn't have to change anything below here ###################################################### # Function prototypes sub delete_file_and_dir ($); sub remove_backups ($$); sub age_of ($); # Command line options defauls here, so conf file can override them: our $verbose = 0; our $dry_run = 0; if (-r $conf_file) { do $conf_file; warn "Couldn't parse $conf_file: $@" if $@; } # Parse command line while ($_ = shift) { if (/^-h$/ or /^--help$/) { print "$usage"; exit 0; } if (/^-v$/ or /^--verbose$/) { $verbose = 1; next; } if (/^-n$/ or /^--dry-run$/) { $dry_run = 1; next; } print STDERR "Unknown option: $_\n$usage"; exit 1; } if ($weekly_keep_days < $daily_keep_days) { print STDERR "Unreasonable parameters: \$weekly_keep_days ($weekly_keep_days) is less than \$daily_keep_days ($daily_keep_days). But the older daily backups will not be useful without preceding weeklies. "; exit 1; } remove_backups ($daily_keep_days, "*daily*"); remove_backups ($weekly_keep_days, "*weekly*"); # Algorithm for monthlies: # Generate list of ages of existing monthlies. # For each desired age, starting with oldest: # Find closest age match from existing backups. # Mark that one as a keeper, and remove it from the list (can't use twice) # Finally, delete monthlies that are not marked as keepers. # Future enhancements: # should check for zero-length files. # should force keeping monthlies up to and just past $weekly_keep_days. foreach my $dir (glob ("$basedir/*")) { ## Security check on names: if ($dir =~ m{\A($basedir/\w[\w .-]*)\Z}) { $dir = $1; } else { print STDERR "Directory does not match expected pattern: $dir"; next; } my %ages = (); my @files = glob ("$dir/*/*monthly.tar*"); if ($#files <= $#monthly_keep) { # print "\nNo extra monthlies in $dir\n" if ($verbose); } else { print "\nAges of monthlies in $dir:\n" if ($verbose); for my $f (@files) { ## For security, check filename against expected pattern if ($f =~ m{\A($dir/\w[\w .-]*/\w[\w .-]*)\Z}i) { my $file = $1; my $age = age_of($file); printf "%4d %s\n", $age, $file; $ages{$age} = $file; } else { print STDERR "File does not match expected pattern: $f"; } } for my $want (@monthly_keep) { my $best_match = -1; for my $age (keys %ages) { if ($best_match < 0 || abs($age-$want) < abs($best_match-$want)) { $best_match = $age; } } if ($best_match>=0) { print "Best match for desired age $want is $best_match days old\n" if ($verbose); delete $ages{$best_match}; # remove from future consideration } } # Remaining files are extraneous for my $age (keys %ages) { if ($age < $weekly_keep_days) { print STDERR "Algorithm says to delete $ages{$age}, but I'm keeping it so that weekly backups are still valid. You should change your setting of \@monthly_keep to keep all monthly backups for at least $weekly_keep_days days (the value of \$weekly_keep_days).\n"; } else { delete_file_and_dir ($ages{$age}); } } } } print "\n" . `df -lkh $basedir` if ($verbose); sub remove_backups ($$) { my ($age, $glob) = @_; my $header_printed = 0; foreach my $file (glob ("$basedir/*/*/$glob")) { ## Security check on filename. This is not just a good idea, it's required by -T. if ($file =~ m{\A($basedir/\w[\w .-]*/\w[\w .-]*/\w[\w .-]*)\Z}) { $file = $1; } else { print STDERR "File doesn't match expected pattern: $file\n"; next; } my $fileage = age_of($file); if ($fileage > $age) { if ($verbose && not $header_printed) { print "Cleaning up $glob files older than $age days:\n"; $header_printed = 1; } delete_file_and_dir ($file); } } } sub delete_file_and_dir ($) { my $file = shift; my ($directory) = ($file =~ m{\A(.*)/[^/]+\Z}); printf (" Removing (age %2d) %s\n", age_of($file), $file) if ($verbose); if (not $dry_run) { if (unlink ($file) != 1) { print STDERR "Problem deleting: $!\n"; } } printf (" and directory %s\n", $directory) if ($verbose); if (not $dry_run) { rmdir $directory or warn $!; } } ## Return age of file, in days sub age_of ($) { return int ((time() - (stat($_[0]))[9])/3600/24); } hdup-2.0.14/contrib/backup.pl0000600000175000000270000000722610312614216014247 0ustar frankie#!/usr/bin/perl -T -w ### Determine what type of backup to run, and start hdup process to do it. ### # Distributed under the GPL version 2 # This is free software. There is NO warranty; not even for MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. # # Contributed by: Boris Goldowsky use strict; use POSIX; our $usage="USAGE: $0 [options] Options: -v, --verbose Give details about what was done and why. -n, --dry-run Show what would be done, but do not actually run any backups. -h, --help Show this help message.\n"; ### Customize the variables below for your site ### Or, put all your settings in a configuration file and list it here: our $conf_file = "/opt/hdup/backup-script.conf"; # Make PATH sufficient to find hdup, hostname, and ls: $ENV{PATH}="/opt/hdup/sbin:/usr/sbin:/usr/bin:/bin"; $ENV{BASH_ENV} = ''; # Name of this host our $host="hostname"; # Directory where hdup backup files are stored our $basedir="/backup"; # Set these to the number of days that backups are to be considered current. # So if you want weekly backups done every 7 days, set week to 6 (6 days good, # the next day they'll be forced to be re-run). If you want to run a daily # backup every time this script is run, set day to 0. our $month = 30; our $week = 6; our $day = 0; # Additional args to pass to hdup running on this host: our $hdup_args = ""; # Remote user & host to store backups on, expressed as @user@host.com # For local backups, set to empty string: our $remote = ""; ###################################################### ### You shouldn't have to change anything below here ###################################################### # Filenames to be checked to determine when previous backups were performed. our $monthlyfile="inclist.monthly"; our $weeklyfile="inclist.weekly"; our $dailyfile="inclist.daily"; # Command line options defauls here, so conf file can override them: our $verbose = 0; our $dry_run = 0; if (-r $conf_file) { do $conf_file; warn "Couldn't parse $conf_file: $@" if $@; } # Parse command line while ($_ = shift) { if (/^-h$/ or /^--help$/) { print "$usage"; exit 0; } if (/^-v$/ or /^--verbose$/) { $verbose = 1; next; } if (/^-n$/ or /^--dry-run$/) { $dry_run = 1; next; } print STDERR "Unknown option: $_\n$usage"; exit 1; } # Function CHECKFILE. # takes two arguments: a FILENAME and an AGE. # returns success (0) if and only if: # FILENAME exists # FILENAME is not zero length # FILENAME is newer than AGE days old. # ie, returns true if there is a good-enough backup there. sub checkfile ($$) { my $file = shift; my $age = shift; if ( ! -f $file ) { print "No $file\n"; return 1; } if ( ! -s $file ) { print "$file is zero length\n"; print `ls -l $file` if ($verbose); return 2; } my $daysold = POSIX::ceil ((time() - (stat($file))[9])/3600/24); if ($daysold > $age) { print "$file is $daysold days old: more than $age\n" if ($verbose); print `ls -l $file` if ($verbose); return 3; } print "$file is new enough ($daysold days old is <= $age):\n" . `ls -l $file` if ($verbose); return 0; } # Location of inclist files my $indexdir="$basedir/$host/etc"; my $today = ""; if (checkfile ("$indexdir/$monthlyfile", $month )) { $today = "monthly"; } elsif (checkfile ("$indexdir/$weeklyfile", $week)) { $today = "weekly"; } elsif (checkfile ("$indexdir/$dailyfile", $day)) { $today = "daily"; } else { print "No need to run backup.\n"; exit 0; } print "Running $today\n"; my $cmd = "hdup $hdup_args $today $host $remote"; print " Command is $cmd\n"; if (!$dry_run) { print `hdup $hdup_args $today $host $remote`; exit $?; } hdup-2.0.14/GPL-20000600000175000000270000004311010312614216011501 0ustar frankie GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. hdup-2.0.14/glib-2.0.m40000600000175000000270000001776210312614216012467 0ustar frankie# Configure paths for GLIB # Owen Taylor 1997-2001 dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject or dnl gthread is specified in MODULES, pass to pkg-config dnl AC_DEFUN([AM_PATH_GLIB_2_0], [dnl dnl Get the cflags and libraries from pkg-config dnl AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run a test GLIB program], , enable_glibtest=yes) pkg_config_args=glib-2.0 for module in . $4 do case "$module" in gmodule) pkg_config_args="$pkg_config_args gmodule-2.0" ;; gobject) pkg_config_args="$pkg_config_args gobject-2.0" ;; gthread) pkg_config_args="$pkg_config_args gthread-2.0" ;; esac done AC_PATH_PROG(PKG_CONFIG, pkg-config, no) no_glib="" if test x$PKG_CONFIG != xno ; then if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then : else echo *** pkg-config too old; version 0.7 or better required. no_glib=yes PKG_CONFIG=no fi else no_glib=yes fi min_glib_version=ifelse([$1], ,2.0.0,$1) AC_MSG_CHECKING(for GLIB - version >= $min_glib_version) if test x$PKG_CONFIG != xno ; then ## don't try to run the test against uninstalled libtool libs if $PKG_CONFIG --uninstalled $pkg_config_args; then echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH" enable_glibtest=no fi if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then : else no_glib=yes fi fi if test x"$no_glib" = x ; then GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0` GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args` GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args` glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_glibtest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GLIB_CFLAGS" LIBS="$GLIB_LIBS $LIBS" dnl dnl Now check if the installed GLIB is sufficiently new. (Also sanity dnl checks the results of pkg-config to some extent) dnl rm -f conf.glibtest AC_TRY_RUN([ #include #include #include int main () { int major, minor, micro; char *tmp_version; system ("touch conf.glibtest"); /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = g_strdup("$min_glib_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_glib_version"); exit(1); } if ((glib_major_version != $glib_config_major_version) || (glib_minor_version != $glib_config_minor_version) || (glib_micro_version != $glib_config_micro_version)) { printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version, glib_major_version, glib_minor_version, glib_micro_version); printf ("*** was found! If pkg-config was correct, then it is best\n"); printf ("*** to remove the old version of GLib. You may also be able to fix the error\n"); printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); printf("*** required on your system.\n"); printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); printf("*** to point to the correct configuration files\n"); } else if ((glib_major_version != GLIB_MAJOR_VERSION) || (glib_minor_version != GLIB_MINOR_VERSION) || (glib_micro_version != GLIB_MICRO_VERSION)) { printf("*** GLIB header files (version %d.%d.%d) do not match\n", GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); printf("*** library (version %d.%d.%d)\n", glib_major_version, glib_minor_version, glib_micro_version); } else { if ((glib_major_version > major) || ((glib_major_version == major) && (glib_minor_version > minor)) || ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro))) { return 0; } else { printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n", glib_major_version, glib_minor_version, glib_micro_version); printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n", major, minor, micro); printf("*** GLIB is always available from ftp://ftp.gtk.org.\n"); printf("***\n"); printf("*** If you have already installed a sufficiently new version, this error\n"); printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); printf("*** being found. The easiest way to fix this is to remove the old version\n"); printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n"); printf("*** correct copy of pkg-config. (In this case, you will have to\n"); printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); printf("*** so that the correct libraries are found at run-time))\n"); } } return 1; } ],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_glib" = x ; then AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)) ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$PKG_CONFIG" = "no" ; then echo "*** A new enough version of pkg-config was not found." echo "*** See http://www.freedesktop.org/software/pkgconfig/" else if test -f conf.glibtest ; then : else echo "*** Could not run GLIB test program, checking why..." ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GLIB_CFLAGS" LIBS="$LIBS $GLIB_LIBS" AC_TRY_LINK([ #include #include ], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GLIB or finding the wrong" echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means GLIB is incorrectly installed."]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi GLIB_CFLAGS="" GLIB_LIBS="" GLIB_GENMARSHAL="" GOBJECT_QUERY="" GLIB_MKENUMS="" ifelse([$3], , :, [$3]) fi AC_SUBST(GLIB_CFLAGS) AC_SUBST(GLIB_LIBS) AC_SUBST(GLIB_GENMARSHAL) AC_SUBST(GOBJECT_QUERY) AC_SUBST(GLIB_MKENUMS) rm -f conf.glibtest ]) hdup-2.0.14/README0000600000175000000270000000165410346355205011673 0ustar frankieHDUP2 - README To compile and install hdup2 just do a: ./configure && make install Current Issues #1 hdup2 does not include directory information in the backup. Why? Because Gnu tar cannot handle that correctly. If hdup2 would include this information in the backup list, the backup (ie. the tar file) would include everything twice! Yes, this is a bug in Gnu tar and will be fixed eventually. So hdup2 does not include this information. Related to this is that empty directories are not included in the archive. As soon as Gnu tar can handle this, hdup2 will be able to handle this. I've included a patch to tar, which when applied will allow you to do sane backups. #2 Older tar's (1.3.25) do not work reliabily with hdup2. If you cannot upgrade Gnu tar to a more modern version don't upgrade to hdup2, but stay with hdup1.6. Current Gnu tar releases are for instance 1.15.1. hdup-2.0.14/configure0000700000175000000270000047575610346355760012750 0ustar frankie#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for hdup 2.0.14. # # Report bugs to . # # Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME='hdup' PACKAGE_TARNAME='hdup2' PACKAGE_VERSION='2.0.14' PACKAGE_STRING='hdup 2.0.14' PACKAGE_BUGREPORT='hdup-user@miek.nl' ac_unique_file="src/prototype.h" ac_default_prefix=/usr # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP SET_MAKE tar mcrypt gpg ssh bzip gzip lzop split cat PKG_CONFIG GLIB_CFLAGS GLIB_LIBS GLIB_GENMARSHAL GOBJECT_QUERY GLIB_MKENUMS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures hdup 2.0.14 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of hdup 2.0.14:";; esac cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-glibtest do not try to compile and run a test GLIB program Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd "$ac_popdir" done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF hdup configure 2.0.14 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by hdup $as_me 2.0.14, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Configure paths for GLIB # Owen Taylor 1997-2001 ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std1 is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std1. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 echo "${ECHO_T}$ac_cv_prog_egrep" >&6 EGREP=$ac_cv_prog_egrep echo "$as_me:$LINENO: checking for AIX" >&5 echo $ECHO_N "checking for AIX... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef _AIX yes #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define _ALL_SOURCE 1 _ACEOF else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest* # Checks for programs. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std1 is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std1. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF all: @echo 'ac_maketemp="$(MAKE)"' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi # my own checks # Extract the first word of "tar", so it can be a program name with args. set dummy tar; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_tar+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $tar in [\\/]* | ?:[\\/]*) ac_cv_path_tar="$tar" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_tar="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_path_tar" && ac_cv_path_tar=""/bin/tar"" ;; esac fi tar=$ac_cv_path_tar if test -n "$tar"; then echo "$as_me:$LINENO: result: $tar" >&5 echo "${ECHO_T}$tar" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "mcrypt", so it can be a program name with args. set dummy mcrypt; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_mcrypt+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $mcrypt in [\\/]* | ?:[\\/]*) ac_cv_path_mcrypt="$mcrypt" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_mcrypt="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_path_mcrypt" && ac_cv_path_mcrypt=""/usr/bin/mcrypt"" ;; esac fi mcrypt=$ac_cv_path_mcrypt if test -n "$mcrypt"; then echo "$as_me:$LINENO: result: $mcrypt" >&5 echo "${ECHO_T}$mcrypt" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "gpg", so it can be a program name with args. set dummy gpg; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_gpg+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $gpg in [\\/]* | ?:[\\/]*) ac_cv_path_gpg="$gpg" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_gpg="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_path_gpg" && ac_cv_path_gpg=""/usr/bin/gpg"" ;; esac fi gpg=$ac_cv_path_gpg if test -n "$gpg"; then echo "$as_me:$LINENO: result: $gpg" >&5 echo "${ECHO_T}$gpg" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "ssh", so it can be a program name with args. set dummy ssh; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_ssh+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $ssh in [\\/]* | ?:[\\/]*) ac_cv_path_ssh="$ssh" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ssh="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_path_ssh" && ac_cv_path_ssh=""/usr/bin/ssh"" ;; esac fi ssh=$ac_cv_path_ssh if test -n "$ssh"; then echo "$as_me:$LINENO: result: $ssh" >&5 echo "${ECHO_T}$ssh" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "bzip2", so it can be a program name with args. set dummy bzip2; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_bzip+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $bzip in [\\/]* | ?:[\\/]*) ac_cv_path_bzip="$bzip" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_bzip="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_path_bzip" && ac_cv_path_bzip=""/usr/bin/bzip2"" ;; esac fi bzip=$ac_cv_path_bzip if test -n "$bzip"; then echo "$as_me:$LINENO: result: $bzip" >&5 echo "${ECHO_T}$bzip" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "gzip", so it can be a program name with args. set dummy gzip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_gzip+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $gzip in [\\/]* | ?:[\\/]*) ac_cv_path_gzip="$gzip" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_gzip="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_path_gzip" && ac_cv_path_gzip=""/bin/gzip"" ;; esac fi gzip=$ac_cv_path_gzip if test -n "$gzip"; then echo "$as_me:$LINENO: result: $gzip" >&5 echo "${ECHO_T}$gzip" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "lzop", so it can be a program name with args. set dummy lzop; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_lzop+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $lzop in [\\/]* | ?:[\\/]*) ac_cv_path_lzop="$lzop" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_lzop="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_path_lzop" && ac_cv_path_lzop=""/bin/lzop"" ;; esac fi lzop=$ac_cv_path_lzop if test -n "$lzop"; then echo "$as_me:$LINENO: result: $lzop" >&5 echo "${ECHO_T}$lzop" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "split", so it can be a program name with args. set dummy split; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_split+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $split in [\\/]* | ?:[\\/]*) ac_cv_path_split="$split" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_split="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_path_split" && ac_cv_path_split=""/usr/bin/split"" ;; esac fi split=$ac_cv_path_split if test -n "$split"; then echo "$as_me:$LINENO: result: $split" >&5 echo "${ECHO_T}$split" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "cat", so it can be a program name with args. set dummy cat; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_cat+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $cat in [\\/]* | ?:[\\/]*) ac_cv_path_cat="$cat" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_cat="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_path_cat" && ac_cv_path_cat=""/bin/cat"" ;; esac fi cat=$ac_cv_path_cat if test -n "$cat"; then echo "$as_me:$LINENO: result: $cat" >&5 echo "${ECHO_T}$cat" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Checks for glib # Check whether --enable-glibtest or --disable-glibtest was given. if test "${enable_glibtest+set}" = set; then enableval="$enable_glibtest" else enable_glibtest=yes fi; pkg_config_args=glib-2.0 for module in . do case "$module" in gmodule) pkg_config_args="$pkg_config_args gmodule-2.0" ;; gobject) pkg_config_args="$pkg_config_args gobject-2.0" ;; gthread) pkg_config_args="$pkg_config_args gthread-2.0" ;; esac done # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_PKG_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 echo "${ECHO_T}$PKG_CONFIG" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi no_glib="" if test x$PKG_CONFIG != xno ; then if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then : else echo *** pkg-config too old; version 0.7 or better required. no_glib=yes PKG_CONFIG=no fi else no_glib=yes fi min_glib_version=2.0.0 echo "$as_me:$LINENO: checking for GLIB - version >= $min_glib_version" >&5 echo $ECHO_N "checking for GLIB - version >= $min_glib_version... $ECHO_C" >&6 if test x$PKG_CONFIG != xno ; then ## don't try to run the test against uninstalled libtool libs if $PKG_CONFIG --uninstalled $pkg_config_args; then echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH" enable_glibtest=no fi if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then : else no_glib=yes fi fi if test x"$no_glib" = x ; then GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0` GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args` GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args` glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` if test "x$enable_glibtest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GLIB_CFLAGS" LIBS="$GLIB_LIBS $LIBS" rm -f conf.glibtest if test "$cross_compiling" = yes; then echo $ac_n "cross compiling; assumed OK... $ac_c" else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include int main () { int major, minor, micro; char *tmp_version; system ("touch conf.glibtest"); /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = g_strdup("$min_glib_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_glib_version"); exit(1); } if ((glib_major_version != $glib_config_major_version) || (glib_minor_version != $glib_config_minor_version) || (glib_micro_version != $glib_config_micro_version)) { printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version, glib_major_version, glib_minor_version, glib_micro_version); printf ("*** was found! If pkg-config was correct, then it is best\n"); printf ("*** to remove the old version of GLib. You may also be able to fix the error\n"); printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); printf("*** required on your system.\n"); printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); printf("*** to point to the correct configuration files\n"); } else if ((glib_major_version != GLIB_MAJOR_VERSION) || (glib_minor_version != GLIB_MINOR_VERSION) || (glib_micro_version != GLIB_MICRO_VERSION)) { printf("*** GLIB header files (version %d.%d.%d) do not match\n", GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); printf("*** library (version %d.%d.%d)\n", glib_major_version, glib_minor_version, glib_micro_version); } else { if ((glib_major_version > major) || ((glib_major_version == major) && (glib_minor_version > minor)) || ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro))) { return 0; } else { printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n", glib_major_version, glib_minor_version, glib_micro_version); printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n", major, minor, micro); printf("*** GLIB is always available from ftp://ftp.gtk.org.\n"); printf("***\n"); printf("*** If you have already installed a sufficiently new version, this error\n"); printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); printf("*** being found. The easiest way to fix this is to remove the old version\n"); printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n"); printf("*** correct copy of pkg-config. (In this case, you will have to\n"); printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); printf("*** so that the correct libraries are found at run-time))\n"); } } return 1; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) no_glib=yes fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_glib" = x ; then echo "$as_me:$LINENO: result: yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" >&5 echo "${ECHO_T}yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" >&6 : else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 if test "$PKG_CONFIG" = "no" ; then echo "*** A new enough version of pkg-config was not found." echo "*** See http://www.freedesktop.org/software/pkgconfig/" else if test -f conf.glibtest ; then : else echo "*** Could not run GLIB test program, checking why..." ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GLIB_CFLAGS" LIBS="$LIBS $GLIB_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GLIB or finding the wrong" echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means GLIB is incorrectly installed." fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi GLIB_CFLAGS="" GLIB_LIBS="" GLIB_GENMARSHAL="" GOBJECT_QUERY="" GLIB_MKENUMS="" : fi rm -f conf.glibtest echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in getopt.h sys/vfs.h sys/statvfs.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## -------------------------------- ## ## Report this to hdup-user@miek.nl ## ## -------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in sys/param.h sys/mount.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #if HAVE_SYS_PARAM_H # include #endif #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test $prefix = "NONE"; then if test $sysconfdir = '${prefix}/etc'; then sysconfdir="/etc" fi fi ac_config_files="$ac_config_files Makefile src/Makefile src/hdup.h contrib/hdup.spec" ac_config_headers="$ac_config_headers src/config.h" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by hdup $as_me 2.0.14, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ hdup config.status 2.0.14 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "src/hdup.h" ) CONFIG_FILES="$CONFIG_FILES src/hdup.h" ;; "contrib/hdup.spec" ) CONFIG_FILES="$CONFIG_FILES contrib/hdup.spec" ;; "src/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@CPP@,$CPP,;t t s,@EGREP@,$EGREP,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@tar@,$tar,;t t s,@mcrypt@,$mcrypt,;t t s,@gpg@,$gpg,;t t s,@ssh@,$ssh,;t t s,@bzip@,$bzip,;t t s,@gzip@,$gzip,;t t s,@lzop@,$lzop,;t t s,@split@,$split,;t t s,@cat@,$cat,;t t s,@PKG_CONFIG@,$PKG_CONFIG,;t t s,@GLIB_CFLAGS@,$GLIB_CFLAGS,;t t s,@GLIB_LIBS@,$GLIB_LIBS,;t t s,@GLIB_GENMARSHAL@,$GLIB_GENMARSHAL,;t t s,@GOBJECT_QUERY@,$GOBJECT_QUERY,;t t s,@GLIB_MKENUMS@,$GLIB_MKENUMS,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } # Do quote $f, to prevent DOS paths from being IFS'd. echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # And first: Protect against being on the right side of a sed subst in # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\_ACEOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/defines.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # grep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/undefs.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>$CONFIG_STATUS <<\_ACEOF # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then echo "/* Generated by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if diff $ac_file $tmp/config.h >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } rm -f $ac_file mv $tmp/config.h $ac_file fi else cat $tmp/config.h rm -f $tmp/config.h fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi hdup-2.0.14/tar-1.15.1.patch0000600000175000000270000000153310346355205013337 0ustar frankie--- tar-1.15.1/src/create.c 2004-10-04 11:21:31.000000000 +0200 +++ tar-1.15.1.local/src/create.c 2005-06-30 13:35:51.647593741 +0200 @@ -1175,7 +1175,14 @@ buffer = xrealloc (buffer, buffer_size); } strcpy (buffer + plen, q + 1); - dump_file (buffer, -1, (dev_t) 0); + /* Hack to make --listed-incremental and + * --files-from and --no-recursion work; + */ + if (!listed_incremental_option && + !files_from_option && + !recursion_option) { + dump_file (buffer, -1, (dev_t) 0); + } } q += qlen + 1; } hdup-2.0.14/configure.ac0000600000175000000270000000223610346355205013276 0ustar frankie# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ(2.57) AC_INIT(hdup, 2.0.14, hdup-user@miek.nl, hdup2) AC_CONFIG_SRCDIR([src/prototype.h]) AC_PREFIX_DEFAULT(/usr) sinclude(glib-2.0.m4) AC_AIX # Checks for programs. AC_PROG_CC AC_PROG_MAKE_SET # my own checks AC_PATH_PROG(tar, tar, "/bin/tar") AC_PATH_PROG(mcrypt, mcrypt,"/usr/bin/mcrypt") AC_PATH_PROG(gpg, gpg,"/usr/bin/gpg") AC_PATH_PROG(ssh, ssh, "/usr/bin/ssh") AC_PATH_PROG(bzip, bzip2, "/usr/bin/bzip2") AC_PATH_PROG(gzip, gzip, "/bin/gzip") AC_PATH_PROG(lzop, lzop, "/bin/lzop") AC_PATH_PROG(split, split, "/usr/bin/split") AC_PATH_PROG(cat, cat, "/bin/cat") # Checks for glib AM_PATH_GLIB_2_0(2.0.0) AC_CHECK_HEADERS([getopt.h sys/vfs.h sys/statvfs.h]) AC_CHECK_HEADERS(sys/param.h sys/mount.h,,, [ [ #if HAVE_SYS_PARAM_H # include #endif ] ]) if test $prefix = "NONE"; then if test $sysconfdir = '${prefix}/etc'; then sysconfdir="/etc" fi fi AC_CONFIG_FILES([Makefile src/Makefile src/hdup.h contrib/hdup.spec]) AC_CONFIG_HEADER([src/config.h]) AC_OUTPUT hdup-2.0.14/postrun-warn-user0000700000175000000270000000116410312635070014360 0ustar frankie#!/bin/sh # I'm just burned by a rather bad crash and even I didn't # have my backups correctly setup. So I lost data :-( # Warn the user after a monthly and weekly to move # the backups to other systems and/or to CD/DVD # Miek, 16 Sept 2005. # one arg scheme=$1 if [ -z $scheme ]; then exit; fi if [ $scheme = "weekly" ]; then echo "** Don't forgot to write this backup to a ** ** more permanent storage **" exit fi if [ $scheme = "monthly" ]; then echo "*** IT IS RECOMMENDED THAT YOU WRITE YOUR PREVIOUS *** *** MONTH DUMP TO PERMANENT STORAGE ***" exit fi hdup-2.0.14/install-sh0000700000175000000270000001273610312614216013011 0ustar frankie#!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: chmodcmd="" else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 hdup-2.0.14/Credits0000600000175000000270000000224510315744075012333 0ustar frankieThe following persons have helped with the development of hdup. Miek Gieben, miek@miek.nl o primary author Boris Goldowsky and Robert Haskins were extremely helpfull in preparing the first working hdup2.0.x release. Wouter van Gils o initial cron file o initial testing o documentation Milan Gigel Petr Divina o helped a lot with (early) testing o (a lot of) feature requests Jonathan Baker-Bates o helped to nail down bugs in restore and encryption part of hdup o README clarifications Boris Goldowsky o helped a lot with testing of hdup 1.6.X (on Mac OS X) o backup script Assorted patches, ideas, bug reports/bugfixes: (in no particular order) o Anders Bjorklund o Jiri Bajer o Francesco P. Lovergine o Frank Behrendt o Charles Shannon Hendrix o Marek Chlopek o Ruben van de Ginste o Matthew Gream (inherit keyword) o Jesper K. Pedersen o Josh Richards o Christian Josefsson o Andreas Nilsson o Uli Bubenheimer o Iiro Niinikoski o Adam Piatyszek o Rob Cotrone o Yoichi Takayama o Robert Haskins o Daniel Webert o David Ziman o GT o Crispin Boylan o Peter Baumann And the kind people from the hdup-user mailing list. Also see ChangeLog. hdup-2.0.14/Makefile.in0000600000175000000270000000133410346354326013056 0ustar frankie# Standard installation path names VERSION = @PACKAGE_VERSION@ # use by tar to package hdup home = $(shell pwd) base = $(shell basename ${home}) hdup2 = hdup2 .PHONY: clean install all uninstall tar tarclean web doclean all: hdup Makefile hdup: @echo hdup version: ${VERSION} @(cd src ; $(MAKE) all) clean: tarclean docclean @rm -f Makefile @rm -f config.log @rm -rf config.status @rm -rf autom4te.cache (cd src ; $(MAKE) clean) tarclean: @echo -n "Removing .tar files..." @rm -f hdup*.tar.bz2 @echo "done" docclean: @echo -n "Removing web docs..." @rm -f doc/hdup.1.html doc/hdup.conf.5.html @rm -f doc/grohtml*.png @echo "done" uninstall: @(cd src ; make uninstall ) install: @(cd src ; make install ) hdup-2.0.14/hdup.conf0000600000175000000270000000331310345050711012605 0ustar frankie#### # config for hdup # # see man 5 hdup.conf for more information # '#' is comment, empty lines are ignored #### [global] # top backup directory where all the archives are put archive dir = /tmp/storage/backup/ # what date to use (see hdup.conf) date spec = iso # use this tar tar = /bin/tar # if there is no daily try a weekly # if there is no weekly try a monthly always backup = on # skip the top backup directory skip = yes # restore to / switch force = no # overwrite an existing archive (dangerous!) overwrite = yes # what options for ssh to use proto = /usr/bin/ssh proto option = -q -oProtocol=2 # chown to this user user = operator # use this compression and level compression = bzip compression level = 9 # exclude these files and dirs # dirs must be ended in '/' exclude = lost+found/ ,proc/ , dev/, sys/ # if this file is found in a dir - leave it out # of the backup nobackup = .nobackup # my own host, backup this all important directory [elektron] # backup this dir dir = /home/miekg/bin, /etc/hdup/hdup.conf, /etc/X11/xorg.conf # redefine the nobackup keyword nobackup = .nobackup exclude = .svn/ # run this script before the backup - if it fails the backup is # aborted prerun = echo %c %e %a %u %g # do this afterwards postrun = ./postrun-warn-user %s # my laptop will put some archive heres, put them in # them in the correct place [lappie] dir = /var/www # log to syslog log = yes # exlude this directory exclude = /var/*/docs/ # don't stay on the same filesystem one filesystem = no compression = gzip #key = key2 #algorithm = tripledes allow remote = no free = 20m # where can we find the remote hdup exe's remote hdup = /mnt/key/hdup16/src/hdup2 remote hdup option = -c /mnt/key/hdup16/hdup2.conf hdup-2.0.14/hdup.conf.distr0000600000175000000270000000324010312635713013735 0ustar frankie#### # config for hdup # # see man 5 hdup.conf for more information # '#' is comment, empty lines are ignored # # Skeleton hdup.conf file to be installed by distribution # See for a full explanation the hdup.conf manpage # #### # everything put under [global] is "inherited" by # all the other hosts defined in this config file [global] # where to put the tar archives archive dir = /vol/backup/ # use the normal date date spec = iso # try to figure out the current scheme, and perform the # correct backup always backup = on # skip the archive dir from the backup skip = on # restore option: disallow restoring to / force = no # overwrite existing archives in 'archive dir' overwrite = on # ssh options proto = /usr/bin/ssh proto option = -q -oProtocol=2 # chown the archives to this user user = operator # compression options compression = bzip compression level = 6 # is such a file is found, exclude that directory nobackup = .nobackup # give tar some extra options, not needed # tar option = # my own host [elektron] # what to backup, separate with ,. # For directories add closing slash, like /home/ dir = /home/ # don't include theses directories exclude = lost\+found/, /proc/, /dev/, /sys/ # if we want to split it (to fit a CD) #chunk size = 640m # enable for nagging #postrun = /etc/hdup/postrun-warn-user %s # my laptop will put some archive heres, put them in # them in the correct place [www-host] dir = /var/www # log to syslog log = yes exclude = /var/.*/docs/ one filesystem = no compression = gzip #key = key2 #algorithm = tripledes allow remote = no free = 20m #prerun = echo %c %e remote hdup = /mnt/key/src/hdup2 remote hdup option = -c /mnt/key/hdup2.conf hdup-2.0.14/INSTALL0000600000175000000270000000175010312631463012035 0ustar frankieHDUP2 - README To compile and install hdup2 just do a: ./configure && make install Current Issues #1 hdup2 does not include directory information in the backup. Why? Because Gnu tar cannot handle that correctly. If hdup2 would include this information in the backup list, the backup (ie. the tar file) would include everything twice! Yes, this is a bug in Gnu tar and will be fixed eventually. So hdup2 does not include this information. Related to this is that empty directories are not included in the archive. As soon as Gnu tar can handle this, hdup2 will be able to handle this. #2 See http://www.miek.nl/cgi-bin/bugzilla/show_bug.cgi?id=5 Some Gnu Tar seems to have an issue with files having '\' (backslashes) in them. #3 Older tar's (1.3.25) do not work reliabily with hdup2. If you cannot upgrade Gnu tar to a more modern version don't upgrade to hdup2, but stay with hdup1.6. Current Gnu tar releases are for instance 1.15.1. hdup-2.0.14/examples/0002700000175000000270000000000010346355756012636 5ustar frankiehdup-2.0.14/examples/hdup.cron0000600000175000000270000000241310317744101014441 0ustar frankie######################################### # cron file of hdup, the backup utility # ######################################### # minute 0-59 # hour 0-23 # day of month 1-31 # month 1-12 # day of week 0-7 (0 or 7 is sunday) # In debian the "root" argument in a cron line is allowed. I have conformation # that this is not the case in e.g. SuSE Linux. # # Put this for instance in /etc/cron.d # be AWARE that files in there must NOT contain dots (on Debian) # --- start of new backup season --- # 00 02 1 * * root /usr/local/sbin/hdup -q -q monthly host # --- the weekly --- # 00 06 1,7,14,21,28 * * root /usr/local/sbin/hdup -q -q weekly host # --- the daily --- # 00 08 1-31 * * root /usr/local/sbin/hdup -q -q daily host # --- remote backup --- # # 00 06 1-31 * * root /usr/local/sbin/hdup -q -q daily host @user@remotehost # first remove the files #0 3 * * * root find /backup/path/host/ -mtime +32 -depth -type f -print0 -mindepth 1 | xargs --no-run-if-empty --null rm -f # then the dirs #30 3 * * * root find /backup/path/host/ -mtime +32 -depth -type d -print0 -mindepth 1 | xargs --no-run-if-empty --null rmdir # Also see: http://pflanze.mine.nu/~chris/scripts/utilities/purgeolditems # for a secure perl version with the same functionality. hdup-2.0.14/examples/no-history-post-run.sh0000600000175000000270000000154710317744101017061 0ustar frankie#!/bin/sh # this script should be used when 'no history = yes' in hdup's configuration # What it does: it copies the static archives to a save place. # It takes three arguments: # 1. the current archive name # 2. the directory to which #1 should be copied # 3. the current scheme # This script can serve as a basis. Feel free to extend it. # (c) Miek Gieben, distributed under GPL v2 # It currently does not: check if encryption is used - there not # copying the archive # It also does not take chunk size into account ar=$1 to=$2 scheme=$3 if [ $scheme == "restore" -o $scheme == "remote" ]; then echo "Wrong scheme" exit 1; fi; if [ ! -f $ar ]; then echo "Cannot find archive" exit 1; fi if [ -f $to ]; then echo "Destination directory is a file" exit 1; fi if [ ! -e $to ]; then mkdir -p $to fi # copy it cp -f $ar $to hdup-2.0.14/ChangeLog0000600000175000000270000002256510346355205012571 0ustar frankie10 Dec 2005: 2.0.14 Miek - bugfix release - * bug #3: when adding a file to the filelist also use NULL as a delimeter, not a newline. (Thanks to Chad Sawatzky for reporting) * Overhauled the tarball making. It's now distributed as hdup2-.tar.bz2 and unpacks in hdup-/ directory. 25 Nov 2005: 2.0.13 Miek - bugfix release - * Don't create a LOCK file when restoring * Cosmetic updates to the restore code were made [bugs] * Fixed a NULL derefence when restoring * Make the bytes counter a unsigned long long, to avoid the overflow at 4 GB. 02 Oct 2005: 2.0.12 Miek - very minor bug fix release - [bugs] * Don't display the -P warning when receiving a remote archive - as it is useless then. * Don't say a remote archive failed to be written when in fact it did succeed. [build] * cleanup the svn directory * re-add the examples/ dir, this was somehow lost during my harddisk crash 30 Sept 2005: 2.0.11 Miek - minor bug fix and feature additions release - [bugs] * Debian bug #322421 fixed. Static is now 'static' and not 'stati' * Minor corrections to hdup.conf(5) * Skip is now always enabled * Install a script which says to put your monthly dump on permanent storage (isn't enabled by default) * With -VV -D a list of backed up files it printed * Show the amount of bytes written when doing a remote backup. The logging and overview message have changed slightly for this change, resp: o Bytes written: 46K and: o SUCCESS, elektron (monthly): 22K, 0:00:00 * If hdup is set suid or sgid it refuses to run as hdup was never designed to handle that. * A double free in the postrun/prerun code was fixed. * Add a warning when running without -P (patched tar) - as this might lead to incomplete backups 07 Aug 2005: 2.0.10 Miek - small bug fix release - [bugs] * Used bfbtester to make hdup more robust * Bug #23: -s (specific restore) is working again * Set default prefix back to /usr * Use \0 as a delimeter when creating the filelist. Tar is now called with --null. * Correctly display the help when using long options (reformatted it too) 04 Jul 2005: 2.0.9 Miek - major bug fixes - [bugs] * -P flag was added, which stands for patched-tar, this enables --no-recusion for tar and allows directory information to be included in the archives. See Debian bug: 302790 Instruction and the patch to tar are on the hdup project page. * Bug #22: don't use isblank() because it's a gnu-ism * removed unneeded reference to /home/miekg in contrib/dirinfo.sh (thanks to Crispin Boylan for spotting) * @sysconfdir@ fixes and tweaks. Patches and ideas from Francesco P. Lovergine and Adam Piatyszek. [remarks] * There are warnings when compiling on FreeBSD (MIN/MAX redefined). These are harmless and besides they are in system libs, so I can not fix them... 22 Jun 2005: 2.0.8 Miek - bug fixes - [bugs] * When restoring the pre-run command was run twice. (Found, fix, patch by Arnaud de Grandmaison) * When restoring the check to see if an archive exists should be done after the pre-run script ran. (Found, fix, patch by Arnaud de Grandmaison) * $DESTDIR failed to make in the Makefile, so applied patch again * Check 'keyword=' in the config file and emit a warning that that prob. won't work. (Thanks to Billy Newsom for reporting) * Added contrib/hdup.sh - a small script to help manage your backups (From: Juraj.Kubelk) * Bug #21: update the link to gnu tar on the website, (thanks to Robert Locke). Also update the FAQ.html in the hdup2 tar. * Added a rough bash shell script that can add the missing directory info to an archive (not impl./not tested). This is a quick hack. In 2.0.9 I hope to have a better solution. 18 Mar 2005: 2.0.7 Miek - bug fixes - [Bugs] * Really allow \, in the config file. This is done with an evil hack whereby \, is rewritten as \. It's ugly but I'll leave it in (until I rewrite the whole parser in yacc/lex someday - if ever). * The locking has changed and now uses open(bla, O_EXCL|O_CREAT) This closes a race condition - but this fails on older NFS < 3, but I don't expect anybody to run that these days. (thanks to Hotzi for reporting and testing) * When adding a / to a path, be sure there is room, a few people were bitten by this. [Bug #19] * Applied $DESTDIR patch from Richard Bos, allows mortal users to make an RPM, this may impact other package creators. 03 Feb 2005: 2.0.6 Miek - bug fixes - [Bugs] * Fix a bug whereby the files to be backed up where not counted correctly (patch from: Peter Baumann) This could lead hdup2 into creating an empty archive, while it should have backed up something. * Thanks also go to Hotzi for pre-testing this release. * Due to some Debian weirdness my bugzilla database experienced some weirdness. I've lost some bug reports in the process, but the old ones are back again :) [I have to look into this in detail] * Cleanup LOCK files when compilation in the regexps fails. * Allow \, in the config file. (This fixes another debian bug) * Added -D switch to print debugging information * Make one-filesystem working again (Thanks to Peter Baumann) * When restoring give a warning when an entered date is likely not to match the current date format. * Some changes in the remote restore code to make it more robust. * Updated the online FAQ on miek.nl * Disallow -s and remote restore (for now) [Todo] * documentation 19 Jan 2005: 2.0.5: Miek - bug fixes - [Bugs] * [Bug #3] Compile fix for FreeBSD 4.11 (actually for older gcc's (<3)) (Applied patch from Martin Chabot) * [Bug #6] Infinite loop on none existing dirs was fixed * [Bug #4] Fix pre- and post-run scripts. * Make hdup really read long configuration lines (Tnanks to Lars Brown for reporting) * Readded the example cron file and no-history-post-run.sh (290723@bugs.debian.org) * Small addition to hdup.conf example (290599@bugs.debian.org) related to the include/exclude examples in there * Fix 290600@bugs.debian.org. The comma-thingy is on the todo. * Fix the dot underflow message * Default location of the remote hdup is now set correctly * Remove LOCK when creation of empty archives fails * Added ':' to ok_chars [Todo] * documentation * comma's in hdup.conf 6 Jan 2005: 2.0.4 Miek - bug fixes - [Bugs] * Select the right compression (thanks to GT) * fixes a double increment in the include/exlude parsing (thanks to Viktor Vraniak) * Re-added the examples/ directory * Fixed the directory include/exclude * Set the user from the config file to the host structure (thanks to Drdák Radoslav for reporting) 22 Dec 2004: 2.0.3 Miek - bug fixes - [Bugs] * Incremental backups are fixed * Security fixes (thanks to pscan, rats, flawfinder) * Compile fix for OSX * Compilation now needs gmake [Features] * unexpandable arguments in the pre- and post- scripts are expanded to -empty- [Remark] * You need 'gmake' to compile it [Todo] * It does not compile on FreeBSD 4.11 (it does on 5.3...) 14 Dec 2004: 2.0.2 Miek - major bug fixes - [Bugs] * Fix the include/exclude mechanism. Per default there is a .* include, which is overriden by any user defined include. * Use -f when compressing (see bzip2/gzip/lzop man pages) * Removed bogus fprintf * Gzip compression wasn't enabled by default [Todo] [Features] * Use fread, speedup of factor 2 (est.) 12 Nov 2004: 2.0.1 Miek - bug fixes - [Bugs] * Fix autconf, put glib-2.0.m4 directly in the distribution * Only test for dirs or not, in walker.c * Hdup remote: wrote x bytes now uses k/M/G suffix [Todo] * documentation [Features] * Allow newlines to be escaped (\\n) 11 Nov 2004: 2.0.0 prerelease2 Miek - bug fixes - [Bugs] * Check for SIGKILL in walker.c * Really count how many files we need to backup and do the actual backing up * Fix incremental dumps * Patch from boris to fix the spec file [Features] * - [Todo] * regexps documentation 04 Nov 2004: 2.0.0 prerelease Miek - major overhaul and new build depencies - [Features] * Moved to Glib for lowlevel C function - lots of changes to the source - g_strdup_printf and g_strconcat are now used a lot * #define LEN gone * Moved to subversion for development * Dependency on find was removed. We use our own routine now. * Support for .nobackup files (see nobackup keyword) * Updated documentation * Public repository accessible (TODO) * Makefile.in made smaller * Totally reworked the include/exclude mechanism. It is now POSIX regexp based. * hdup will now always make to passes over the harddisk - one to determine what to backup and then the actual backup. Yes I know; this is a race. [Bugs] * Bug #12 fixed; removed -a in GPG encryption/decryption * Bug #16 fixed: the non-tweaked hdup.conf.distr is installed as the default hdup.conf * Bug fixed: the include and exclude lists are not copied to other host when they define their own lists.