patch + defect - hdup 1.6.19
Matthew <[email protected]> Tue, 14 Oct 2003 23:43:40 +0000
| Newsgroups | gmane.comp.sysutils.backup.hdup.devel |
|---|---|
| Message-ID | <[email protected]> |
--M9NhX3UHpAaciwkO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hello, (a) the hdup tar.gz contains a file "hdup-1.6.19" which is an archive of the same release, this needs to be deleted. (b) I enclose a patch allows a [host] statement to inherit from another [host] statement, making it possible to have configuration of the following form: [host-root] dir = /root/.cpan/Bundle [host-users] dir = /home/usera, /home/userb, /home/userc [host-source] dir = /usr/src/contrib [host] inherit = host-root, host-users, host-source Very handy tool! Matthew [email protected] -- --M9NhX3UHpAaciwkO Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="hdup-1.6.19-host-inherit.patch" diff -u doc/hdup.conf.5 ../hdup16.old/doc/hdup.conf.5 --- doc/hdup.conf.5 Tue Oct 14 23:42:11 2003 +++ ../hdup16.old/doc/hdup.conf.5 Wed May 7 11:28:15 2003 @@ -15,8 +15,7 @@ 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. +works for \fIall\fR options. Config entries may be given multiple times, in that case the latest one is taken as the final choice. @@ -37,14 +36,8 @@ proto option = -q -oProtocol=2 overwrite = yes -[host-name-a-conf] +[host-name] 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 @@ -61,11 +54,7 @@ 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. +There is a maximum of 10 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 @@ -75,7 +64,7 @@ The following keywords are supported: \fIalgorithm\fR, \fIallow remote\fR, \fIalways backup\fR, \fIarchive dir\fR, \fIchunk size\fR, \fIcompression\fR, \fIdate\fR \fIdir\fR, \fIexclude\fR, \fIfind\fR, -\fIforce\fR, \fIfree\fR. \fIinclude\fR, \fIinherit\fR, \fIkey\fR, \fIlog\fR, +\fIforce\fR, \fIfree\fR. \fIinclude\fR,xi \fIkey\fR, \fIlog\fR, \fImcrypt\fR, \fIno history\fR, \fIone filesystem\fR, \fIoverwrite\fR, \fIpostrun\fR, \fIprerun\fR, \fIproto\fR, \fIproto\fR, \fIremote hdup\fR, \fIremote hdup option\fR \fIskip\fR, \fIsparse\fR, @@ -164,13 +153,6 @@ determine which files should be backed up. \fBHdup\fR uses GNU \fBfind\fR(1) to generate the filelist which is then given to tar. Included files take precedence on exclude files. Note the difference with \fBexclude\fR. - -.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 --- doc/hdup.conf.5 Tue Oct 14 23:42:11 2003 +++ ../hdup16.old/doc/hdup.conf.5 Wed May 7 11:28:15 2003 @@ -15,8 +15,7 @@ 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. +works for \fIall\fR options. Config entries may be given multiple times, in that case the latest one is taken as the final choice. @@ -37,14 +36,8 @@ proto option = -q -oProtocol=2 overwrite = yes -[host-name-a-conf] +[host-name] 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 @@ -61,11 +54,7 @@ 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. +There is a maximum of 10 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 @@ -75,7 +64,7 @@ The following keywords are supported: \fIalgorithm\fR, \fIallow remote\fR, \fIalways backup\fR, \fIarchive dir\fR, \fIchunk size\fR, \fIcompression\fR, \fIdate\fR \fIdir\fR, \fIexclude\fR, \fIfind\fR, -\fIforce\fR, \fIfree\fR. \fIinclude\fR, \fIinherit\fR, \fIkey\fR, \fIlog\fR, +\fIforce\fR, \fIfree\fR. \fIinclude\fR,xi \fIkey\fR, \fIlog\fR, \fImcrypt\fR, \fIno history\fR, \fIone filesystem\fR, \fIoverwrite\fR, \fIpostrun\fR, \fIprerun\fR, \fIproto\fR, \fIproto\fR, \fIremote hdup\fR, \fIremote hdup option\fR \fIskip\fR, \fIsparse\fR, @@ -164,13 +153,6 @@ determine which files should be backed up. \fBHdup\fR uses GNU \fBfind\fR(1) to generate the filelist which is then given to tar. Included files take precedence on exclude files. Note the difference with \fBexclude\fR. - -.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 diff -u src/hdup.h.in ../hdup16.old/src/hdup.h.in --- src/hdup.h.in Tue Oct 14 22:16:47 2003 +++ ../hdup16.old/src/hdup.h.in Thu Sep 11 08:18:30 2003 @@ -136,7 +136,7 @@ #define MCRYPT_NONE_EXT ".tar.nc" /* the number of keywords */ -#define KEYWORDS 30 +#define KEYWORDS 29 /* the keywords are defined in hdupconf.c */ #define KEY_BACKUP 0 #define KEY_EXCLUDE 1 @@ -167,7 +167,6 @@ #define KEY_CHUNKSIZE 26 #define KEY_FREE 27 #define KEY_LOG 28 -#define KEY_INHERIT 29 /* holds the %-vars (%h,%a,%s,%e,%u,%c) -1 */ #define SUBS 5 diff -u src/hdupconf.c ../hdup16.old/src/hdupconf.c --- src/hdupconf.c Tue Oct 14 23:10:12 2003 +++ ../hdup16.old/src/hdupconf.c Thu Sep 11 08:18:05 2003 @@ -37,7 +37,7 @@ "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" + "free", "log" }; int readline (char *line, FILE *from, int lim) { @@ -168,9 +168,6 @@ /* get ride of spaces */ chop(left);cut(right); switch (whatkey(left)) { - case KEY_INHERIT: - inherit(right, host[i], host); - break; case KEY_BACKUP: setlist(right, host[i]->path); break; @@ -309,55 +306,6 @@ return -1; } -int inherit (char *hostnames, phost_t curr, phost_t host[]) { - /* inherit all from hostname into host */ - char* hostlist[MAXDIR]; - int i = 0; - - i = setlist(hostnames, hostlist); - if (i < 0) { - LOG("Not able to parse inherit list [%s] so ignoring", hostnames); - return -1; - } - for (i = 0; hostlist[i] != NULL && hostlist[i][0] != '\0'; i++) { - int h = findhost(hostlist[i], host); - if (h < 0) - FATAL("Cannot find hostname to inherit from [%s]", 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]->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); - addvar(host[h]->find, & curr->find); - 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]->chunksize, & curr->chunksize); - addvar(host[h]->free, & curr->free); - } - - return 0; -} - int setvar (char *dir, char *var) { /* set var to dir */ @@ -373,20 +321,6 @@ return 0; } -int addvar (char* org, char **cur) { - /* add org over cur - already cut + okayed */ - - if (org != NULL) { - if (*cur != NULL) { - free(*cur); - *cur = NULL; - } - *cur = (char*)malloc(strlen(org)); - strcpy(*cur, org); - } - return 0; -} - int yesno ( char *what, char *which) { /* there are four possible answer in such a config option * no/off -> 0, or yes/on -> 1 @@ -405,15 +339,6 @@ 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[]) { /* parse a comma seperate list of directories */ int l; @@ -443,25 +368,6 @@ 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] = (char*)malloc(strlen(org[i])); - strcpy(cur[t], org[i]); - t++; i++; - } - if (i > 0) { - cur[t] = (char*)malloc(1); - cur[t] = '\0'; - } - } - return 0; -} int whatkey(char *key) { /* found out what keyword is found */ diff -u src/hduplib.c ../hdup16.old/src/hduplib.c --- src/hduplib.c Tue Oct 14 22:13:48 2003 +++ ../hdup16.old/src/hduplib.c Thu Sep 11 08:18:05 2003 @@ -501,7 +501,7 @@ /* child */ execl("/bin/sh", "sh", "-c", command, - (char *)NULL); + NULL); hdup_cleanup(1,NULL); } diff -u src/prototype.h ../hdup16.old/src/prototype.h --- src/prototype.h Tue Oct 14 23:07:11 2003 +++ ../hdup16.old/src/prototype.h Fri Jun 20 21:16:17 2003 @@ -10,14 +10,10 @@ void hdup_sigint(int); int config(char *, phost_t host[]); int setlist(char *, char *hostpath[]); -int addlist(char *org[], char *cur[]); int setvar(char *, char *); -int addvar(char *, char **); int whatkey(char *); int findhost (char *, phost_t host[]); int yesno(char *, char *); -int addyesno(int, int *); -int inherit(char *, phost_t, phost_t host[]); int hdup_archive (phost_t , int ); int hdup_checkfile (char *); int hdup_checkdir ( char *); --- src/hdup.h.in Tue Oct 14 22:16:47 2003 +++ ../hdup16.old/src/hdup.h.in Thu Sep 11 08:18:30 2003 @@ -136,7 +136,7 @@ #define MCRYPT_NONE_EXT ".tar.nc" /* the number of keywords */ -#define KEYWORDS 30 +#define KEYWORDS 29 /* the keywords are defined in hdupconf.c */ #define KEY_BACKUP 0 #define KEY_EXCLUDE 1 @@ -167,7 +167,6 @@ #define KEY_CHUNKSIZE 26 #define KEY_FREE 27 #define KEY_LOG 28 -#define KEY_INHERIT 29 /* holds the %-vars (%h,%a,%s,%e,%u,%c) -1 */ #define SUBS 5 --- src/hdupconf.c Tue Oct 14 23:10:12 2003 +++ ../hdup16.old/src/hdupconf.c Thu Sep 11 08:18:05 2003 @@ -37,7 +37,7 @@ "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" + "free", "log" }; int readline (char *line, FILE *from, int lim) { @@ -168,9 +168,6 @@ /* get ride of spaces */ chop(left);cut(right); switch (whatkey(left)) { - case KEY_INHERIT: - inherit(right, host[i], host); - break; case KEY_BACKUP: setlist(right, host[i]->path); break; @@ -309,55 +306,6 @@ return -1; } -int inherit (char *hostnames, phost_t curr, phost_t host[]) { - /* inherit all from hostname into host */ - char* hostlist[MAXDIR]; - int i = 0; - - i = setlist(hostnames, hostlist); - if (i < 0) { - LOG("Not able to parse inherit list [%s] so ignoring", hostnames); - return -1; - } - for (i = 0; hostlist[i] != NULL && hostlist[i][0] != '\0'; i++) { - int h = findhost(hostlist[i], host); - if (h < 0) - FATAL("Cannot find hostname to inherit from [%s]", 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]->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); - addvar(host[h]->find, & curr->find); - 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]->chunksize, & curr->chunksize); - addvar(host[h]->free, & curr->free); - } - - return 0; -} - int setvar (char *dir, char *var) { /* set var to dir */ @@ -373,20 +321,6 @@ return 0; } -int addvar (char* org, char **cur) { - /* add org over cur - already cut + okayed */ - - if (org != NULL) { - if (*cur != NULL) { - free(*cur); - *cur = NULL; - } - *cur = (char*)malloc(strlen(org)); - strcpy(*cur, org); - } - return 0; -} - int yesno ( char *what, char *which) { /* there are four possible answer in such a config option * no/off -> 0, or yes/on -> 1 @@ -405,15 +339,6 @@ 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[]) { /* parse a comma seperate list of directories */ int l; @@ -443,25 +368,6 @@ 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] = (char*)malloc(strlen(org[i])); - strcpy(cur[t], org[i]); - t++; i++; - } - if (i > 0) { - cur[t] = (char*)malloc(1); - cur[t] = '\0'; - } - } - return 0; -} int whatkey(char *key) { /* found out what keyword is found */ --- src/hduplib.c Tue Oct 14 22:13:48 2003 +++ ../hdup16.old/src/hduplib.c Thu Sep 11 08:18:05 2003 @@ -501,7 +501,7 @@ /* child */ execl("/bin/sh", "sh", "-c", command, - (char *)NULL); + NULL); hdup_cleanup(1,NULL); } --- src/prototype.h Tue Oct 14 23:07:11 2003 +++ ../hdup16.old/src/prototype.h Fri Jun 20 21:16:17 2003 @@ -10,14 +10,10 @@ void hdup_sigint(int); int config(char *, phost_t host[]); int setlist(char *, char *hostpath[]); -int addlist(char *org[], char *cur[]); int setvar(char *, char *); -int addvar(char *, char **); int whatkey(char *); int findhost (char *, phost_t host[]); int yesno(char *, char *); -int addyesno(int, int *); -int inherit(char *, phost_t, phost_t host[]); int hdup_archive (phost_t , int ); int hdup_checkfile (char *); int hdup_checkdir ( char *); --M9NhX3UHpAaciwkO--