diff --git a/AUTHORS b/AUTHORS index 4c72215e3baea0f2b3a03be1cf2710079d549564..a8dec1abec0abba5e1e26b7b19bdbf9cb1c81f6e 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,18 +1,18 @@ BACKUPNINJA was written by the Riseup Collective: intellectual property is theft. -Ninjas: +Ninjas: elijah@riseup.net -- original code, bug fixes, man pages micah@riseup.net -- debian package, vserver support, bug fixes stefani@riseup.net -- makecd handler, man pages intrigeri@boum.org -- dup handler, pgsql handler, vserver support, bug fixes Charles Lepple -- trac handler -Petr Kl�ma <petr.klima@madeta-group.cz> -- autotools, RPM support and sys checks +Petr Kl�ma <petr.klima@madeta-group.cz> -- autotools, RPM support and sys checks paulv@bikkel.org -- rsnap handler Robert Napier -- improved RPM build rhatto -- rub handler and patches -Patches: +Patches: cmccallum@thecsl.org Daniel.Bonniot@inria.fr -- mysql ignores and nodata @@ -59,9 +59,12 @@ Daniel Lo Nigro <daniel@dan.cx> -- Dropbox support for Duplicity Matthijs Wensveen <matthijs.wensveen@gmail.com> -- fix symmetric encryption in dup handler ulrich <ulrich@habmalnefrage.de> -- Added validation check for when Romain Dessort <romain@univers-libre.net> -- Fix list of devices when dumping partition tables -Guillaume Subiron <ben@wainei.net> -- borg handler +Guillaume Subiron <guillaume@sysnove.fr> -- borg handler Jerome Charaoui <jerome@riseup.net> -- borg handler David Gasaway <dave@gasaway.org> -- Fixes for configuration files without suffix Hugh Nowlan <nosmo@nosmo.me> -- dup check for archive dir Lyz <lyz@riseup.net> -- sys support for LUKS in disk partitions Glandos <bugs-0xacab@antipoul.fr> -- sys excludes zram devices +Nicolas Karolak <nicolas@karolak.fr> -- Add restic support +Derek Laventure -- Add restic helper +Colan Schwartz -- Fix restic options handler diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..1640a7114a8cd23d0253e02b8024c039e34f81bf --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,1221 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [1.2.0] - 2021-01-21 + +### Fixed + +- [dup] Fix missing options from config file created with helper (DEBBUG-726119) + +## [1.2.0-rc1] - 2021-01-14 + +### Added + +- [tests] Add a testsuite +- [core] Add `--version` (`-V`) command-line option +- [borg] New config options: `cache_directory`, `sshoptions` (#11310), + `ignore_missing` and `port` +- [restic] Introduce new handler for the restic backup program +- [sys] Add SystemD and EFI infos to sytem report (#11325) +- [all] Added new config setting `ionicelevel` (DEBBUG-409239) + +### Changed + +- [core] Implement non-zero exit codes for main process (#8279) +- [borg] Emit warning if borg returns exit code 1 instead of fail +- [dup] Allow `bandwidthlimit` with `desturl` +- [rsync] Change default ssh key file to RSA in `id_file` (#11315, DEBBUG-976650) +- [project] Adopt Keep a Changelog format and convert old ChangeLog to markdown +- [project] Moved project group from RiseupLabs to Liberate (#11314) + +### Removed + +- [core] Support for vservers support has been completely removed +- [rsync] Removed unused config parameter `ssh` (#4379) + +### Fixed + +- [core] Fix issue with zero-padded integers in when setting (#9397) +- [core] Fix incorrect warning related to day component in when setting + (DEBBUG-974770) +- [borg] Fix connection test when empty remote directory exists +- [borg] Properly quote create_options setting (#11304) +- [borg] Raise fatal error if includes are missing +- [dup] Test ssh connection when test mode enabled +- [mysql] Fix helper writing incomplete config file (#11272) +- [rsync] Fix initial directory creation in `mirror` and remote `short` modes +- [sys] Fix LUKS version 2 header backup (#11316) +- [sys] Fix dumping non-existent partition tables (#11293, DEBBUG-956206) +- [sys] Fix error in rc.d info gathering on redhat/centos (##11294) +- [sys] Fix error in sysctl info gathering + +## [1.1.0] - 2018-06-29 + +### backupninja changes + +- Add validation check for when parameter. (#640) Thanks to ulrich + <ulrich@habmalnefrage.de> for the patch. +- Quote output strings passed to logging functions (#11278). +- Ignore files in /etc/backup.d that lack suffix. Thanks to David Gasaway + <dave@gasaway.org> for the patch. +- Add Vagrantfile to help with testing/release process. + +### documentation changes + +- Fix typos in README.md and manpages. Thank you, Lintian! +- Improve release process documentation. + +### handler changes + +#### borg + +- Add initial support for the borgbackup program. Thanks to Ben + <ben@wainei.net> and Thomas Preissler <thomas@preissler.co.uk> for + contributing patches. + +#### dup + +- Fix symmetric encryption. (#11274) Thanks to Matthijs Wensveen + <matthijs.wensveen@gmail.com> for the patch. +- Bail if archive dir doesn't exist. (#11286) Thanks to Hugh Nowlan + <nosmo@nosmo.me> for the patch. + +#### sys + +- Use lsblk instead of sfdisk to get a list of block devices. (#11273) + Thanks to Romain Dessort <romain@univers-libre.net> for the patch. +- Avoid looking for partitions on zram devices. Thanks to Glandos + <bugs-0xacab@antipoul.fr> for the patch. +- Support extracting LUKS headers from partitions. Thanks to Lyz + <lyz@riseup.net> for the patch. + +## [1.0.2] - 2017-09-05 + +### handler changes + +#### dsync + +- Miscellaneous improvements to this experimental handler. + +#### dup + +- For local backups, check that the destination directory exists. Thanks to + ulrich for the preliminary patch. (#4049) +- Gracefully handle legacy spaces between -o and IdentityFile. +- Don't remove useful signature files with --extra-clean, on duplicity versions + that have a sane handling of the cache. Thanks to Alexander Mette + <mail@amette.eu> for the patch! (Closes: #6357) +- Fix buggy version comparison. (#6746) +- Support using a different passphrase for the signing key from the one used + for the encryption key (Closes: DEBBUG-726072). Thanks to Dominik George + <nik@naturalnet.de> for the patch! +- Run duplicity in a C locales environment (Closes: DEBBUG-736280). Thanks to + Jonathan Dupart <jonathan@dupart.org> for the report, and the initial patch! +- Fix handling of Dropbox access token (Closes: #11260). + +#### mysql + +- Make "nodata" option compatible with compress=no. +- Fix non-qualified table name extraction. (Closes: #4373) +- Skip dumping information and performance\_schema databasase. (Closes: + #11148) + +#### rdiff + +- Add option to include rdiff-backup output in reports. Thanks to David + Gasaway <dave@gasaway.org> for the patch! + +#### rsync + +- Solve quoting issue with "su". (Closes: DEBBUG-683731, #4019) +- Update increment folder date to avoid ending up with contradictory + information. (Closes: #3929) +- Force rsync handler run bash at the remote destination. (Closes: + #3003) +- Support running in test mode (Closes: #8196). Thanks to shred for the + initial patch. + +#### sys + +- Fix LUKS header backup to properly detect partitions. +- Provide the ability to backup the MBR for every device found, and to backup + the BIOS (if the flashrom program is installed, and the mainboard is + supported). +- Add suse to the list of supported OS (#7101). Thanks to Christian + Prause <cprause@suse.com> for the patch. +- Fix indentation. Thanks to Jools Wills <jools@oxfordinspire.co.uk> for the + patch. (Closes: #6802) +- Exclude tmpfs filesystems from df output. (Closes: DEBBUG-745818) + +#### tar + +- Support test mode and xz compression. Thanks to Pierre ROUDIER + <contact@pierreroudier.net> for the patches. + +### helper changes + +#### rdiff + +- Don't give misleading information regarding required fields. (#4410) +- Support output\_as\_info. Thanks to David Gasaway <dave@gasaway.org> for the + patch! + +#### sys + +- Remove spurious quotes that broke the helper (Closes: #6803). Thanks + to Jools Wills <jools@oxfordinspire.co.uk> for the patch. + +### backupninja changes + +- Indentation fixes, thanks to exobuzz. (#6726) +- Ignore jobs whose filename ends with "~". Thanks to Mark Janssen + <mark@sig-io.nl> for the patch. + +#### build system changes + +- Pass the "foreign" option to AM\_INIT\_AUTOMAKE: README has been renamed to + README.md. + +### documentation changes + +- Update INSTALL file to add some missing recommended programs. +- Document release process. +- Merge FAQ content from the Redmine wiki into the one shipped with + backupninja. +- README.md: reorganize, reformat, and point to the examples configuration + files. +- INSTALL.md: recommend using packages on Debian and derivatives. +- bandwidthlimit for the dup handler needs to be given in KB/s, and not (as + wrongly advertised previously) in Kbit/s. (Closes: #7603) + +## [1.0.1] - 2012-06-29 + +### handler changes + +#### rsync + +- Issue warnings, not fatal errors, on non-fatal rsync errors. (#3966) + +## [1.0] - 2012-06-15 + +The "happy birthdays" release! + +### handler changes + +#### mysql + +- Use --skip-events when backing up the performance_schema database. (Closes: + DEBBUG-673572) + +#### rsync + +- Generate excludes command-line snippet the same way as the duplicity handler + does. +- Run rsync command-line through a shell, so that single-quotes around excludes + are interpreted (Closes: DEBBUG-677410) + +#### sys + +- Don't execute /usr/bin/lspci or /sbin/modinfo when $hardware == "no" + +### backupninja changes + +- Make it clear what lockfile could not be acquired, if any. + +## [1.0-rc1] - 2012-05-15 + +### handler changes + +#### dup + +- Make the .dup generated by ninjahelper more consistent with example.dup. +- Add support for RackSpace's CloudFiles. Thanks to Yuval Kogman + <nothingmuch@woobling.org> for the patch. +- Adapt for new duplicity SSH backend. Support bandwidthlimit with new + duplicity, using trickle. (Closes: DEBBUG-657201) +- Report failure output at error loglevel so that it is emailed (Closes: + DEBBUG-536858) + +#### maildir + +- Remove 'loadlimit' parameter - it is not used anywhere. + +#### mysql + +- Don't attempt to dump performance_schema database (#3741). + +#### pgsql + +- Don't produce empty uncompressed backups (#3820). + +#### rdiff-backup + +- Use fatal function to report failure of rdiff-backup jobs as such. + +#### rysnc + +- Fix numericids option (#3691). +- Mangle $rsync_options just afterwards (#3702, #3001). +- Fix metadata rotation. +- Allow disabling rotation or setting 2 days as minimum for backup increments + in rsync short format (#2107). +- Abort on rsync error (#3692). +- Cleanup orphaned metadata (#3727). +- Use the backup start time and not the time the backup was finished. (Closes: + DEBBUG-654192). +- Use 'debug', 'fatal' and 'warning' functions instead of regular echo and exit + (#3840, #3721). +- Quoting $starttime (#3868). +- Validate created date on long_rotation to avoid too many arguments at + comparison (#3868). +- Quoting $exclude and $excludes and avoiding a for loop on $exclude to not + expand wildcards in beforehand (#3882). +- Quote excludes (#3882). +- Changing remaining 'exit' to 'fatal' at rsync handler (#3721). +- Removing duplicated locking support (#3838). +- Documenting rotation parameters at example.rsync (#3891). +- Ensure that a non-zero rsync exit status is caught (#3892). + +#### build system changes + +- Workaround automake sanity check that would prevent us from installing lib/\* + into lib/backupninja/. Where else are be supposed to install such files + anyway? +- Have "make dist" ship handlers/\*.in instead of make results. +- Have "make dist" ship the FAQ. +- Install handlers as pkgdata_DATA, instead of their .in files. + +### documentation changes + +- Document what features available to .sh jobs (Redmine #1558). + +## [0.9.10] - 2011-09-23 + +### backupninja changes + +- Fix email reports, that were broken by the new locking support. + +### handler changes + +#### dup + +- Cleanup: stop supporting duplicity < 0.6.01 (#2538). +- Fix incorrect duplicity version check for keepincroffulls. Thanks to Olivier + Berger <oberger@ouvaton.org> for the patch. (Closes #3443) + (Closes: DEBBUG-641120) + +#### ldap + +- Don't install LDAP handler, helper and example configuration file. Don't + mention LDAP support in documentation. Official LDAP support will come back + once this code has found itself a maintainer. Interested? Get in touch! + +#### rsync + +- Fixing $rsync_options output when rsync is local (Closes #3001) + (Closes: DEBBUG-639545) + +#### sh + +- Allow 'when = XXX' with spaces (#2769). Thanks to aihtdikh for the + patch. + +#### sys + +- Remove useless and inconsistent executable bit on handler. + +### helper changes + +#### rdiff + +- Fix infinite loop when version inconsistency is detected. Thanks to Chris + Lamb <lamby@debian.org> for the patch. (Closes: DEBBUG-639547) + +## [0.9.9] - 2011-05-15 + +### backupninja changes + +- Use locking to avoid running concurrent instances of the same backup action. + Thanks to Olivier Berger <oberger@ouvaton.org> for the patch. (Closes: + DEBBUG-511300) + +### handler changes + +#### all handlers: + +- Stop using "local VAR" outside functions. (Closes: DEBBUG-530647) + +#### dup + +- Use --tempdir option rather than TMPDIR environment variable. (Closes + Roundup bug #598) +- Remove support for duplicity < 0.4.4. Even etch-backports has a newer one. +- Now support remove-all-inc-but-n-full command for duplicity >= 0.9.10 to + allow removal of increments for older full backups. Thanks to Olivier Berger + <oberger@ouvaton.org> for the patch. (Closes #2492) (Closes: + DEBBUG-603478) + +#### ldap + +- Fix reliance on bash for pipefail. + +#### mysql + +- Fix reliance on bash for pipefail. Thanks to Sergio Talens-Oliag + <sto@debian.org> for the patch. (Closes: DEBBUG-602374) + +#### postgresql + +- Support various pg_dump formats in addition to pg_dumpall. Thanks to Jacob + Anawalt <jlanawalt@gmail.com> for the patch. (Closes Roundup bug #2534) +- Fix reliance on bash for pipefail. + +#### rdiff + +- Support reading include/exclude patterns from files using the "include + @/etc/backup_includes" syntax (Closes Roundup bug #2370). Thanks to ale for + the patch. + +#### rsync + +- Fix long rotation. +- Make units clearer (Closes #2737) +- Do arithmetic using bash rather than bc (Closes: DEBBUG-603173) + +#### sys + +- Fix hwinfo (Closes: DEBBUG-625501) +- Fix gathering of information about loaded modules: cut is in /usr/bin + actually. + +#### tar + +- Install by default. (Closes #2907) + +### helper changes + +#### dup + +- Fix separate signing key usecase. Thanks to Ian Beckwith for the patch. +- Make units clearer (Closes #2737) + +#### rdiff + +- Generate 4096 bits RSA keys. + +#### tar + +- Install by default. (Closes #2907) + +### documentation changes + +- Recommend using 4096 bits RSA keys everywhere. + +## [0.9.8.1] - 2010-10-31 + +### backupninja changes + +- Do not error out when no job is configured. Thanks to Jordi Mallach + <jordi@debian.org> for the patch (Closes: DEBBUG-597684) + +### handler changes + +#### sys + +- Route around broken vgcfgbackup not able to handle multiple VG arguments + +## [0.9.8] - 2010-09-12 + +### backupninja changes + +- Added GZIP_OPTS option, defaulting to --rsyncable, so that this option can be + disabled on systems that don't support it. This also allows to use another + compression program, such as pbzip2 on SMP machines (Closes Roundup bug + #2405) + +### handler changes + +#### sys + +- Only run mdadm if RAID devices actually exist (Closes: DEBBUG-572450) + +#### dup + +- Now default to use --full-if-older-than; see the new "increments" option to + opt-out or tweak the default (30D) delay between full backups. Thanks a lot + to Olivier Berger (Closes: DEBBUG-535996) +- Use duplicity's --extra-clean option to get rid of unnecessary old cache + files when cleaning up. This is enabled when using duplicity 0.6.01 or newer, + that depends on local caching (Closes: DEBBUG-572721) +- Ignore anything but digits and "." when comparing versions (Closes: DEBBUG-578987) +- Put archive directory (cache) into /var/cache/backupninja/duplicity rather + than the default /root/.cache/duplicity, unless the user has specified it + (Closes: 580213) +- Better example.dup documentation. Thanks, Alster! +- Added ftp_password option to securely transmit the FTP password from + backupninja to duplicity. + +#### mysql + +- Don't lock tables in the information_schema database (Closes: DEBBUG-587011) +- Fix code logic to make dbusername/dbpassword actually usable (Closes Redmine + bug #2264) + +#### rsync + +- Fix lockfile checks. This prevents multiple instances of the same rsync job + to run in parallel. +- Avoid passing the remote user twice to rsync-over-ssh. + +### doc changes + +#### manpage + +- Fix typo in manpage (Closes: DEBBUG-583778) + +#### ldap + +- Add ssl option description, fix tls option description (Closes Roundup bug + #2407) + +## [0.9.7] - 2010-01-27 + +### backupninja changes + +- fix bug in reportspace, thanks Dan Garthwaite +- do not assume English locale when using date (Closes: DEBBUG-465837) +- add 'when = manual' option, that can be used in the global config file or in + a given backup action file. Thanks Tuomas Jormola for the preliminary patch + (Closes: DEBBUG-511299) +- new reportinfo option: when set, messages sent by handlers with "info" are + included in the report e-mail (closes DEBBUG-563734) +- reportspace: skip non-directories and places that don't exist on the local + filesystem (Closes: DEBBUG-536049) +- set BACKUPNINJA_DEBUG when invoked with -d (Closes: DEBBUG-537266) + +### lib changes + +#### easydialog + +- Allow form fields input to grow up to 100 chars (Closes: DEBBUG-562249) + +### handler changes + +#### ldap + +- Use gzip's --rsyncable option. +- Use bash pipefail option when needed so that failed dumps are reported as + such. + +#### maildir + +- fix location of deleted_on file +- add missing destid_file options to ssh connections +- added sshoptions variable for arbitrary ssh options +- updated example file to include destid_file, destport and sshoptions +- use any subdirectories not just "a" to "z". Thanks Chris Nolan! (#606) + +#### mysql + +- Options passed to mysqldump are now customizable with the new sqldumpoptions + configuration variable. Thanks to Chris Lamb for his preliminary patch + (Closes: DEBBUG-502966) +- Hide 'mysqladmin ping' output, to prevent confusing the user in case mysqld + is running but the authentication fails, which apparently does not prevent + mysqldump to work. +- Fix the error message displayed when mysqld is not running: mysqladmin ping + indeed returns 0 when authentication fails. +- Use gzip's --rsyncable option. +- Quote output filenames to support shell meta-characters in database names. +- Use bash pipefail option when needed so that failed dumps are reported as + such. + +#### pgsql + +- Use gzip's --rsyncable option. +- Quote output filenames to support shell meta-characters in database names. +- Use bash pipefail option when needed so that failed dumps are reported as + such. + +#### rdiff + +- Fix include/exclude paths with spaces (Closes: DEBBUG-398435) +- Fix confusing error if rdiff-backup cannot be found on remote server. +- Increased element number in include/exclude and vserver ninjahelper interface + +#### sys + +- New luksheaders option (default=disabled) to backup the Luks header of every + Luks device. +- New lvm option (default=disabled) to backup LVM metadata for every detected + volume group. +- Backup dmsetup info as well, for easier restoring of Luks headers. + +#### dup + +- Fixed bandwidthlimit syntax error. Thanks to Ian Beckwith for the patch. +- Send duplicity output to debug line by line instead of as a whole at one time + (Closes: DEBBUG-536360) +- Report duplicity output as "info" so that it can be included in report e-mail + when reportinfo is on (Closes: DEBBUG-563734) +- Fix include/exclude paths with spaces +- Support backups to Amazon S3 buckets, thanks to stefan for the patch. + +### helper changes + +#### dup + +- Do not propose to exclude /home/\*/.gnupg twice anymore (Closes: DEBBUG-563044) + +### autotools + +- Added the stat command to the automagically replaced ones, hoping it will + help supporting \*BSD some day. + +## [0.9.6] - 2008-07-21 + +### backupninja changes + +- fix bug in cstream definition, thanks Jamie McClelland +- Allow the entire backup run to be halted by an action, thanks to Matthew + Palmer (Closes: DEBBUG-455836) +- Fixed tr construct reporting a warning (Closes: DEBBUG-452669) + +### lib changes + +#### vserver + +- added vservers_running function + +#### tools + +- mktemp is now required to run backupninja, removed less secure fall-back if + mktemp did not exist on the system + +### handler changes + +#### dup + +- General cleanup +- Better support for new duplicity (>= 0.4.4) command line syntax: run + remove-older-than when $keep is not set to yes (Closes: DEBBUG-458816), and run + "duplicity cleanup" before any other duplicity command; both only trigger a + warning on failure, since they should not stop backups from being done. Also + migrated full/incremental backup switch to the new syntax. +- Support every duplicity-supported transport with new configuration option + desturl (Closes: DEBBUG-483712, DEBBUG-346040, Trac#2). +- Actually allow to backup only VServers, by relaxing $include test. +- Set secure permissions on tmpdir when creating it. + +#### ldap + +- support HDB backend just as the BDB one, and make message clearer when no + supported backend is found (Closes: DEBBUG-476910) + +#### rdiff + +- Fixed ignore_version default value missing +- Add patch from Matthew Palmer to rdiff handler to incorporate sshoptions into + options via remote-schema not already specified (Closes: DEBBUG-424639) + +#### wget + +- New handler from rhatto designed to incrementally pull content from a website + to a local folder, based on the rsync handler + +#### maildir + +- fixed bug where maildirs that start with a number were skipped +- make maildir helper look in every subdirectory of the source directory for + maildirs, rather than just looking in the directories [a-zA-Z0-9], thanks for + the patch from chris@cenolan.com (Trac#43). +- make deleted maildirs record the date they were deleted +- add destid_file configuration option to enable you to specify an alternate + ssh public key authentication file (defaulting to /root/.ssh/id_rsa) pgsql, + mysql, svn, sys: +- use new vservers_running function from lib/vserver (factorization++) + +#### sys + +- update for 2.6 kernels: use /proc/kallsyms instead of /proc/ksyms (Closes: + Trac#39) +- support selection of VServers to run on, in the same way as in the dup + handler, with the new vsnames configuration option ; (Closes: Trac#45) +- add support for capturing the package debconf selection states using + debconf-get-selections +- fixed catifexec function to actually work, also now passes the arguments + given to catifexec() to the called command (Thanks John Hallam!) +- Added more robust software RAID information capture by running mdadm -Q + --detail /dev/md?\* because some people may have empty mdadm.conf files + (Thanks to John Hallam). + +#### trac + +- stop failing on all the trac backups if just one fails, this means removing + the temporary trac backup directories if they fail + +#### makecd + +- updated handler for new toolset (genisoimage and wodim) + +## [0.9.5] - 2007-12-02 + +### backupninja changes + +- Fixed checks on configuration files permissions, since the patch applied to + fix DEBBUG-370396 broke this, especially for configuration files created with + permissions 000 by an older ninjahelper version. +- Enhanced portability for other platforms +- Added quoting because it was needed to prevent shell expansion, broking the + toint function sometimes (Closes: Trac#11) +- Fixed reportspace option (Closes: Trac#10) +- Fixed ldap handler not recognizing database suffix (Closes: Trac#28) + +### handler changes + +#### dup + +- Support duplicity >= 0.4.3 invocation syntax (--ssh-command option is not + supported anymore) (Closes: DEBBUG-447425) +- New tmpdir configuration option, very useful in case duplicity tends to fill + up /tmp. + +#### ldap + +- Fixed shell command quoting issues, missing 'then' clauses, cleaned up + compress=yes to be less redundant and not create empty uncompressed file + (Closes: DEBBUG-394935) +- Fixed ninjahelper to properly set compress option, standardized on yes/no + instead of on/off +- Fixed problem that caused combination of slapcat and compress to not work + together (Closes: Trac#29) +- Applied patch from romain.tartiere@healthgrid.org to fix the SSL/TLS options + to be correct, also set TLS to be the default over SSL (Closes: Trac#13) + +#### maildir + +- Added an examples file (Closes: Trac#23) +- Applied patch from Anarcat that fixes the cp/mkdir calls to not use GNU + coreutils options, as well as some bashisms (Closes: Trac#24) +- Fix test mode (Closes: Trac#25) + +#### mysql + +- Fixed case where odd combination of configuration options caused sqldump + backups to get overwritten with an empty file (Closes: DEBBUG-402679) +- Added 'nodata' option to enable you to specify tables that you want to omit + the data from a backup, but still backup the table structure. This is very + useful in cases where tables contain large amounts of cache data. See the + example.mysql for options, thanks Daniel Bonniot (Closes: DEBBUG-408829) +- Enhance code for selecting databases by asking MySQL not to give us the + header (-N), to not draw pretty boxes around the output (-B), send the query + via -e instead of a pipe and ensure MySQL listens to -B. Thanks to Matthew + Palmer (Closes: DEBBUG-452039). + +#### pgsql + +- Support configuring PGSQLUSER for real, and document it a bit; this broken + support actually prevented pgsql handler to work for VServers (Closes: + DEBBUG-396578) + +#### rdiff-backup + +- Added cstream support to allow for bandwidth limiting +- Handle "keep = yes" to disable old backups removal (Closes: DEBBUG-424633) +- Add configuration option to allow you to disable the version check as in some + instances this may be an ok scenario (Closes: DEBBUG-424632) +- Added local destination support to helper (Closes: Trac#4) +- Allow exclude-only configurations (Closes: Trac#21) + +#### rub/rsync + +- Fixed typo in rub handler that caused it to not work +- Changed to use lib/vserver code +- Fixed fsck error +- Fixed integer comparison (Closes: Trac#3) +- Renamed handler to 'rsync', replaces outdated rub handler +- updated examples/Makefile.am and handlers/Makefile.am to include rsnap/rsync + (Closes: DEBBUG-440554) +- Added example.rsync configuration file + +#### sys + +- Fixed typo breaking things for VServers. +- Fix bug when vrootdir is on its own partition (Closes: DEBBUG-395928) +- Better sfdisk error and output handling: should now properly warn when it + does not manage to backup a partition table, and shut up when it succeeds + (Closes: DEBBUG-396632) +- Added option to not use sfdisk at all, useful for vserver/xen instances that + produce warnings about no harddisks found (Closes: DEBBUG-404071) +- Fixed example in example.sys to detail the `__star__` in partitionsfile and + note why its necessary (Closes: DEBBUG-409192) +- Force C locale for sfdisk to ensure english words are found in grep +- Make directory where output is placed configurable, and create the parent dir + if it doesn't exist (Closes: Trac#1) + +#### ninjareport + +- Added first draft of method to aggregate reports from many servers into one + email. Requires logtail, rsync, configuration of reporthost, reportdirectory + and reportuser in backupninja.conf. Configure cron to run once a day, and + individual backupninjas not to report by email their status, then enjoy one + email report from all hosts, rather than multiple + +#### other + +- fixed 'make install' bug that failed if /etc/backup.d already existed +- changed spaces to tabs in Makefile.am +- updated redhat spec file (thanks Adam Monsen) + +## [0.9.4] - 2006-10-06 + +### backupninja changes + +- Fixed bug in toint(), and thus isnow(), which caused it to not work when run + from cron. +- Recursively ignore subdirs in /etc/backup.d (Closes: DEBBUG-361102) +- Add admingroup option to configuration to allow a group that can read/write + configurations (instead of only allowing root). Checks and complains about + group-readable files only when the group differs from the one in the + configuration file (default is root as before). Thanks to Martin Krafft for + the patch (Closes: DEBBUG-370396). +- When determining which backup actions to make, find now follows symlinks for + $configdirectory +- Changed order of -s to mail for compatibility +- fixed permission stat call so it uses the --format supported by coreutils + (Closes: DEBBUG-382747) +- Added disk space report option (thanks Adam Kosmin) + +### handler changes + +#### Added tar handler + +- create tarballs + +#### Added rsnap handler + +- rotated rsync snapshops +- code from paulv@bikkel.org + +#### Added rub handler + +- alternative to rsnap +- code from rhatto@riseup.net + +#### mysql + +- Fixed improper use of $vuserhome (Closes: DEBBUG-351083) +- Fixed erroneous removal of tmpfile when it didn't exit +- Fixed inversed vsname emptiness check +- Fixed su quote usage to be more posixy +- Compress for sqldumps now happens in-line to save some disk space (Closes: + DEBBUG-370778) +- Fixed --defaults-file now as --defaults-extra-file (thanks rhatto) + +#### pgsql + +- Fixed inversed vsname emptiness check +- Fixed su quote usage to be more posixy +- Fixed shell expansion, thanks Thomas Kotzian (Closes: DEBBUG-363297) +- postgres user UID is now the one from inside the vserver if necessary +- Compress now happens in-line to save some disk space (Closes: DEBBUG-370778) +- $PGSQLUSER is used instead of hardcoding user 'postgres' (although this is + the default) + +#### svn + +- Fixed inversed vsname emptiness check + +#### rdiff + +- Symlink and globbing support in include/exclude/vsinclude. Clarification: + globbing is fully supported again, whereas no attempt is done to dereference + symlinks anymore, due to incompatibilities between various readlink versions + in this field. +- Removed overzealous vsnames check +- Now works if testconnect=no and if $test is not defined. +- add $sshoptions config parameter in [dest] section of config so connections + to ports other than 22 can be made by adding the following to the top of the + handler config: options = --remote-schema 'ssh -p REMOTE-PORT -C %s + rdiff-backup --server' + +#### dup + +- Symlink and globbing support in include/exclude/vsinclude. Clarification + globbing is fully supported again, whereas no attempt is done to dereference + symlinks anymore, due to incompatibilities between various readlink versions + in this field. +- Removed over zealous vsnames check +- Does not pretend anymore that duplicity can work without any passphrase +- Support duplicity 0.4.2 (with Debian patches applied; upstream's 0.4.3 will + integrate them); documented how to write sftp-compatible sshoptions (Closes: + DEBBUG-388543) +- Now forbid to (try to) include /. + +#### sys + +- Many more system checks were added, (thanks to Petr Klíma) +- Added warning if no devices were found (thanks Ranier Zocholl) +- Enhanced debian package selections to include purged packages (thanks Tom + Hoover) +- Removed warning about vserver not running (thanks anarcat) + +#### ldap + +- Compress now happens in-line to save some disk space (Closes: DEBBUG-370778) + +#### makecd + +- Added nicelevel option (thanks rhatto) + +#### trac + +- fixed problem when src was set to the trac repo directly (Closes: DEBBUG-382737) + +### lib changes + +#### vserver + +- init_vservers: fixed DEBBUG-351083 (improper readlink syntax) +- found_vservers: escaped special grep repetition character + +- forced mktemp to use a template with a name to be more compatible with + different versions of mktemp, thanks anarcat + +### ninjahelper changes + +- Recursively ignore subdirs in /etc/backup.d (Closes: DEBBUG-361102) +- Fix configdirectory error that forced you to use /etc/backup.d, thanks + anarcat +- When determining which backup actions to list, find now follows symlinks for + $configdirectory +- Stop checking helpers perms: both "make install" and distros packages install + them with appropriate permissions, it's overzealous to check this at runtime, + and is more complicated to do with current admingroup option. + +#### dup.helper + +- Fix: signing was enabled with symmetric encryption. + +#### other + +- changed cron permissions to 644 +- changed /etc/backup.d permissions to 0770 (for admingroup) +- minor documentation fixes +- improved RPM build process allowing 'make rpm-package' and 'make + srpm-package' targets, also fixes permissions on man directories, cleans up + RPM-related files during distclean, and adds default EDITOR for "autogen.sh + -f" if none is set. (thanks Robert Napier) + +## [0.9.3] - 2006-02-01 + +### backupninja changes + +#### backupninja.conf + +- added (commented out) the various default paths to programs such as + PGSQLDUMP, so that users can figure out more easily they can customize them + +#### code refactor + +- now uses vservers lib to initialize vservers support + +### handler changes + +#### duplicity, mysql, pgsql, rdiff, svn, sys: + +- start to use (at different degrees) new lib/vserver functionality + +#### mysql + +- fixed no user defaults file processing + +#### duplicity + +- fixed (again...) globbing in include and exclude options (DEBBUG-348022, + follow-up to DEBBUG-338796) +- warn if vsnames or vsinclude is enabled while vservers support is disabled in + backupninja.conf +- now works when multiple vservers names are given (separated by space) in + vsnames config variable rdiff +- fixed globbing bug in include, exclude and vsinclude options +- it's now possible to choose exactly which vservers should be backed-up, as it + already was with duplicity handler, with the "vsnames" configuration setting + +### ninjahelper changes + +#### rdiff.helper + +- fixed errors in create remote dir +- code formatting cleanup (three spaces indent) +- fixed bug which caused only first include/exclude dir to have "include = " +- fixed globbing bug with exclude + +#### ninjahelper + +- now reports error if the helper script has a syntax error or bombs out. +- code formatting cleanup (three spaces indent) + +### lib changes + +#### vserver + +- init_vservers: improved VROOTDIR detection +- init_vservers: test in a stricter way the real vservers availability +- init_vservers: canonicalize VROOTDIR (since duplicity et al. don't follow + symlinks) +- init_vservers: warn if vservers are enabled but no vserver is found +- new function: vservers_exist known bugs: + +#### easydialog + +- formDisplay does not return exit status. + +#### other + +- autotools fixes + +## [0.9.2] - 2005-12-29 + +### backupninja changes + +- fixed broken toint() which caused when "everyday" problems +- backupninja.conf.5 updated to include "when" and "vservers" + +#### code refactor: + +- moved to lib/ some code that has to be shared between backupninja and + ninjahelper + +### handler changes + +#### trac + +- mkdir subdirectory problem fixed + +#### duplicity + +- globbing support fixed in include and exclude options +- different signing and encrypting key support added +- fixed erroneous comments in example.dup about the way GnuPG-related options + are used + +#### mysql + +- handler vserver bugs fixed and debug output enhanced + +### ninjahelper(s) changes + +- vserver-related functions added to lib/vservers.in +- added man/ninjahelper.1 man page + +#### makecd + +- was missing in Makefile.am/.in + +#### rdiff-backup + +- used to expand '\*' in default source directories +- the "Cancel" buttons used to have a weird behaviour +- updated to include Vserver selection + +#### pgsql + +- forbid the user to choose an empty database set +- "Cancel" button now does what it is meant to do + +#### mysql + +- enhanced for vserver support +- now able to select databases and dump directory + +#### duplicity + +- new handler added (with Vserver support) + +## [0.9.1] - 2005-11-05 + +- rearranged source so that it is relocatable with autotools (thanks to Petr + Klíma petr.klima@madeta-group.cz) +- fixed many bugs in rdiff helper +- rdiff handler does not require 'label' (for real this time?) +- added makecd ninjahelper (thanks to Stefani stefani@riseup.net) +- made ninjahelper create files with mode 600 rather than 000 +- changed subversion handler to use svnadmin hotcopy instead of the unsupported + hot-copy.py script, which was moved in Debian +- update rdiff ninjahelper: now detects and auto-install rdiff-backup on the + remote machine if possible, also tests the remote backup directory and offers + to create it if it doesn't exist + +## [0.9] - 2005-10-19 + +*IMPORTANT CHANGE, UPGRADE AT ONCE* + +- fixed insecure temporary file creation +- removed erroneous magic file marker in pgsql handler +- fixed incorrect find positional +- changed direct grep of /etc/passwd to getent passwd. +- rdiff helper has much better information on failed ssh attempt (patch from + cmccallum@thecsl.org). +- rdiff handler now supports remote source and local dest. (patch from + cmccallum@thecsl.org). +- man pages are greatly improved. + +## [0.8] - 2005-09-15 + +- added pgsql (PostgreSQL) handler, with vservers support. +- added vservers support to duplicity handler Note: the configuration is a bit + different than the rdiff handler's one, but the default behavior is the same: + have a look at example.dup. +- improved README +- documented .disabled method. +- corrected VROOTDIR default value. +- added ninjahelper to the install instructions. +- improved rdiff, dup and sys handlers' vservers support prevent + vserver-debiantools' $VROOTDIR/ARCHIVES directory to be seen as a vserver +- changes to sys handler make use of configurable $VSERVERINFO instead of + hard-coded vserver-info. fixed dpkg existence test inside vserver. fixed + $nodpkg use. +- changes to pgsql handler now checks if the specified vserver is running. now + checks if $PGSQLDUMP/$PGSQLDUMPALL are available where needed. now checks if + "postgres" user exists on the host/vserver. +- changes to ninjahelper check_perms() does not die anymore on group/world + readable helper scripts (now consistent with the "helper scripts must not be + group or world writable!" error msg). +- xedit action now tries $EDITOR, then /etc/alternatives/editor, then nano, vim + and vi, and aborts if none of these exists. +- added helper for pgsql handler. +- rdiff handler now does not require 'label' +- changes to mysql and svn handlers' vservers support these handlers now check + if the source vserver is running +- added 'ignores' for mysql handler. (thanks Daniel.Bonniot@inria.fr) + +## [0.7] - 2005-07-26 + +- added ninjahelper: a dialog based wizard for creating backupninja configs. +- considerably improved and changed the log file output. +- you can now disable actions with .disabled (this is new preferred method). +- added makecd handler and example.makecd for backing up to cd/dvd (thanks + stef). +- fixed bug when specifying multiple 'when' options. + +## [0.6] - 2005-06-16 + +- ldap handler has new options: backup method to use (ldapsearch or slapcat), + restart, passwordfile and binddn. Default backup method is set to ldapsearch + as this is safer +- *NOTE: to get the previous default behavior with the ldap handler, + you must set "method = slapcat". The new default is ldapsearch.* +- implemented fix so that the main script will echo fatal errors rather than + being silent about them, this means an error message every hour if there is a + major configuration problem (not a handler problem) +- added vserver support to main script and to the handlers: mysql, svn, sys, + rdiff +- changes to duplicity handler (thanks intrigeri!): "keep = yes" now disables + file cleaning on desthost added "sign" option for backups signing added + "encryptkey" option to specify the gpg key to use split config into [source], + [gpg] and [dest] sections added "nicelevel" option added "testconnect" option + added "sshoptions" option (will be passed to ssh/scp) added "bandwidthlimit" + option +- example.dup example config file for duplicity handler +- added trac (http://trac.edgewall.com/) environment handler (thanks Charles + Lepple!) +- added configfile option to mysql handler the default is + /etc/mysql/debian.cnf. with this, sqldump doesn't need dbusername. (hotcopy + still does). +- fixed bug in mysql handler which caused some passwords to not work. (.my.cnf + files now have double quotes around password) +- can now pass options to hwinfo and sfdisk in sys handler. + +## [0.5] - 2005-04-12 + +- rdiff handler works when remote sshd has a banner +- rdiff handler supports local dest +- logfile is created if it doesn't exist +- added "when = hourly" +- added optional 'nicelevel' to rdiff handler +- fixed bug where actions were not run in numeric order. +- improved 'when' parsing. + +## [0.4.4] - 2005-03-18 + +- results of handlers are now read line by line. +- changes to rdiff handler: added "options", and "keep" is not necessarily days + now (ie, it will pass straight through to rdiff-backup if the keep has a unit + on it, otherwise it adds the 'D'). +- added dup handler (still pretty beta) +- added maildir handler (very specialized handler) +- added --run option (runs the specified action file) +- improved sys handler, now uses hwinfo +- added subversion hotbackup handler, svn. +- added PATH to cron.d file, which fixes file not found errors. + +## [0.4.2] - 2005-01-06 + +- fixed bug which caused a report email to be sent even if no actions were run. +- fixed bug where multiple handler status messages were ignored +- added status in the subject line of report emails + +## [0.4.1] - 2005-01-03 + +- added $usecolors and now more conservative about when colors are echoed. +- fixed major bug, 'when' actually works now. +- replaced debug function with debug, info, warning, error, fatal. +- added --now option to force all actions to be performed now. + +## [0.4] - 2004-12-26 + +- added "when" option, so that all configs can specify when + they are to be run. +- added reportsuccess and reportwarning config options +- added .sys handler (hardware, packages, partitions). + +## [0.3.4] - 2004-12-08 + +- fixed numerical variable quoting compatibility with older wc +- fixed stderr redirect bug +- some comments in example.rdiff + +## [0.3.3] - 2004-11-10 + +- '\*' (asterisk) works now in rdiff config files +- works now with gawk as well as mawk +- many bug fixes to ldap handler +- paths to helper scripts can be configured in global config +- does not require /usr/bin/stat + +## [0.3.2] - 2004-09-29 + +- handler scripts are no longer executable (to comply with debian policy) +- handler error and warning messages are sent with the notify email + +## [0.3.1] - 2004-09-05 + +- added ldap handler +- moved sh support to a handler script +- add test mode, where no action is taken. +- added --help +- force only root can read /etc/backup.d/\* +- fixed missing equals symbols in example.rdiff +- changed backupninja executable to be /usr/sbin rather than /usr/bin + +## [0.3] - 2004-10-20 + +- *IMPORTANT* all config files are now ini style, not apache style +- rewrote all scripts in bash for portability +- added drop-in backupninja lib directory (/usr/share/backupninja) +- all scripts are now run as root + +## [0.2] - 2004-10-14 + +- move distribution folder ./cron.d to ./etc/cron.d +- fixed bug: removed printr of excludes (!) +- added support for changing the user/group in rdiff sources. +- added support for .mysql config files. + +## [0.1] - 2004-10-08 + +- initial release diff --git a/ChangeLog b/ChangeLog deleted file mode 100644 index 8804cace10080de13bc796799788efb94b6de14e..0000000000000000000000000000000000000000 --- a/ChangeLog +++ /dev/null @@ -1,896 +0,0 @@ -version 1.1.0 -- June 29, 2018 - - backupninja changes - · Add validation check for when parameter - Thanks to ulrich <ulrich@habmalnefrage.de> for the patch - · Quote output strings passed to logging functions - · Ignore files in /etc/backup.d that lack suffix - Thanks to David Gasaway <dave@gasaway.org> for the patch - · Add Vagrantfile to help with testing/release process - documentation changes - · Fix typos in README.md and manpages. Thank you, Lintian! - · Improve release process documentation - handler changes - borg: - . Add initial support for the borgbackup program - Thanks to Ben <ben@wainei.net> and Thomas Preissler - <thomas@preissler.co.uk> for contributing patches - dup: - · Fix symmetric encryption - Thanks to Matthijs Wensveen <matthijs.wensveen@gmail.com> for - the patch. - · Bail if archive dir doesn't exist - Thanks to Hugh Nowlan <nosmo@nosmo.me> for the patch - sys: - · Use lsblk instead of sfdisk to get a list of block devices - Thanks to Romain Dessort <romain@univers-libre.net> for the patch - · Avoid looking for partitions on zram devices - Thanks to Glandos <bugs-0xacab@antipoul.fr> for the patch - · Support extracting LUKS headers from partitions - Thanks to Lyz <lyz@riseup.net> for the patch. - -version 1.0.2 -- September 05, 2017 - handler changes - dsync: - . Miscellaneous improvements to this experimental handler. - dup: - . For local backups, check that the destination directory exists. - Thanks to ulrich for the preliminary patch. (Redmine#4049) - . Gracefully handle legacy spaces between -o and IdentityFile. - . Don't remove useful signature files with --extra-clean, - on duplicity versions that have a sane handling of the cache. - Thanks to Alexander Mette <mail@amette.eu> for the patch! - (Closes: Redmine#6357) - . Fix buggy version comparison. (Redmine#6746) - . Support using a different passphrase for the signing key - from the one used for the encryption key (Closes: #726072). - Thanks to Dominik George <nik@naturalnet.de> for the patch! - · Run duplicity in a C locales environment (Closes: #736280). - Thanks to Jonathan Dupart <jonathan@dupart.org> for the report, - and the initial patch! - . Fix handling of Dropbox access token (Closes: GitLab#11260). - mysql: - . Make "nodata" option compatible with compress=no. - . Fix non-qualified table name extraction. (Closes: Redmine#4373) - . Skip dumping information and performance_schema databasase. - (Closes: GitLab#11148) - rdiff: - . Add option to include rdiff-backup output in reports. - Thanks to David Gasaway <dave@gasaway.org> for the patch! - rsync: - . Solve quoting issue with "su". (Closes: #683731, Redmine#4019) - . Update increment folder date to avoid ending up with contradictory - information. (Closes: Redmine#3929) - . Force rsync handler run bash at the remote destination. - (Closes: Redmine#3003) - . Support running in test mode (Closes: Redmine#8196). - Thanks to shred for the initial patch. - sys: - . Fix LUKS header backup to properly detect partitions. - . Provide the ability to backup the MBR for every device found, - and to backup the BIOS (if the flashrom program is installed, - and the mainboard is supported). - . Add suse to the list of supported OS (Redmine#7101). - Thanks to Christian Prause <cprause@suse.com> for the patch. - . Fix indentation. Thanks to Jools Wills <jools@oxfordinspire.co.uk> - for the patch. (Closes: Redmine#6802) - . Exclude tmpfs filesystems from df output. (Closes: Debian#745818) - tar: - . Support test mode and xz compression. - Thanks to Pierre ROUDIER <contact@pierreroudier.net> for the patches. - helper changes - rdiff: - . Don't give misleading information regarding required fields. - (Redmine#4410) - . Support output_as_info. - Thanks to David Gasaway <dave@gasaway.org> for the patch! - sys: - . Remove spurious quotes that broke the helper (Closes: Redmine#6803). - Thanks to Jools Wills <jools@oxfordinspire.co.uk> for the patch. - backupninja changes - . Indentation fixes, thanks to exobuzz. (Redmine#6726) - . Ignore jobs whose filename ends with "~". - Thanks to Mark Janssen <mark@sig-io.nl> for the patch. - build system changes - · Pass the "foreign" option to AM_INIT_AUTOMAKE: README has been - renamed to README.md. - documentation changes - . Update INSTALL file to add some missing recommended programs. - . Document release process. - . Merge FAQ content from the Redmine wiki into the one shipped - with backupninja. - . README.md: reorganize, reformat, and point to the examples - configuration files. - . INSTALL.md: recommend using packages on Debian and derivatives. - . bandwidthlimit for the dup handler needs to be given in KB/s, - and not (as wrongly advertised previously) in Kbit/s. - (Closes: GitLab#7603) - -version 1.0.1 -- June 29, 2012 - handler changes - rsync: - . Issue warnings, not fatal errors, on non-fatal rsync errors. - (Redmine#3966) - -version 1.0 -- June 15, 2012 - The "happy birthdays" release! - handler changes - mysql: - . Use --skip-events when backing up the performance_schema database. - (Closes: #673572) - rsync: - . Generate excludes command-line snippet the same way as - the duplicity handler does. - . Run rsync command-line through a shell, so that single-quotes - around excludes are interpreted (Closes: #677410) - sys: - . Don't execute /usr/bin/lspci or /sbin/modinfo when $hardware == "no" - backupninja changes - . Make it clear what lockfile could not be acquired, if any. - -version 1.0-rc1 -- May 15, 2012 - handler changes - dup: - . Make the .dup generated by ninjahelper more consistent with - example.dup. - . Add support for RackSpace's CloudFiles. - Thanks to Yuval Kogman <nothingmuch@woobling.org> for the patch. - . Adapt for new duplicity SSH backend. - Support bandwidthlimit with new duplicity, using trickle. - (Closes: #657201) - . Report failure output at error loglevel so that it is emailed - (Closes: #536858) - maildir: - . Remove 'loadlimit' parameter - it is not used anywhere. - mysql: - . Don't attempt to dump performance_schema database (Redmine#3741). - pgsql: - . Don't produce empty uncompressed backups (Redmine#3820). - rdiff-backup: - . Use fatal function to report failure of rdiff-backup jobs as such. - rysnc: - . Fix numericids option (Redmine#3691). - . Mangle $rsync_options just afterwards (Redmine#3702, Redmine#3001). - . Fix metadata rotation. - . Allow disabling rotation or setting 2 days as minimum for backup - increments in rsync short format (Redmine#2107). - . Abort on rsync error (Redmine#3692). - . Cleanup orphaned metadata (Redmine#3727). - . Use the backup start time and not the time the backup was finished. - (Closes: #654192). - . Use 'debug', 'fatal' and 'warning' functions instead of regular echo - and exit (Redmine#3840, Redmine#3721). - . Quoting $starttime (Redmine#3868). - . Validate created date on long_rotation to avoid too many arguments - at comparison (Redmine#3868). - . Quoting $exclude and $excludes and avoiding a for loop on $exclude - to not expand wildcards in beforehand (Redmine#3882). - . Quote excludes (Redmine#3882). - . Changing remaining 'exit' to 'fatal' at rsync handler (Redmine#3721). - . Removing duplicated locking support (Redmine#3838). - . Documenting rotation parameters at example.rsync (Redmine#3891). - . Ensure that a non-zero rsync exit status is caught (Redmine#3892). - build system changes - . Workaround automake sanity check that would prevent us from - installing lib/* into lib/backupninja/. Where else are be supposed - to install such files anyway? - . Have "make dist" ship handlers/*.in instead of make results. - . Have "make dist" ship the FAQ. - . Install handlers as pkgdata_DATA, instead of their .in files. - documentation changes - . Document what features available to .sh jobs (Redmine #1558). - -version 0.9.10 -- September 23, 2011 - backupninja changes - . Fix email reports, that were broken by the new locking support. - handler changes - dup: - . Cleanup: stop supporting duplicity < 0.6.01 (Redmine#2538). - . Fix incorrect duplicity version check for keepincroffulls. - Thanks to Olivier Berger <oberger@ouvaton.org> for the patch. - (Closes Redmine bug #3443) - (Closes: #641120) - ldap: - . Don't install LDAP handler, helper and example configuration file. - Don't mention LDAP support in documentation. - Official LDAP support will come back once this code has found - itself a maintainer. Interested? Get in touch! - rsync: - . Fixing $rsync_options output when rsync is local - (Closes Redmine bug #3001) - (Closes: #639545) - sh: - . Allow 'when = XXX' with spaces (Redmine#2769). - Thanks to aihtdikh for the patch. - sys: - . Remove useless and inconsistent executable bit on handler. - helper changes - rdiff: - . Fix infinite loop when version inconsistency is detected. - Thanks to Chris Lamb <lamby@debian.org> for the patch. - (Closes: #639547) -version 0.9.9 -- May 15, 2011 - backupninja changes - . Use locking to avoid running concurrent instances of the same backup - action. Thanks to Olivier Berger <oberger@ouvaton.org> for the patch. - (Closes: #511300) - handler changes - all handlers: - . Stop using "local VAR" outside functions. (Closes: #530647) - dup: - . Use --tempdir option rather than TMPDIR environment variable. - (Closes Roundup bug #598) - . Remove support for duplicity < 0.4.4. Even etch-backports has - a newer one. - . Now support remove-all-inc-but-n-full command for duplicity >= - 0.9.10 to allow removal of increments for older full backups. - Thanks to Olivier Berger <oberger@ouvaton.org> for the patch. - (Closes Redmine bug #2492) - (Closes: #603478) - ldap: - . Fix reliance on bash for pipefail. - mysql: - . Fix reliance on bash for pipefail. - Thanks to Sergio Talens-Oliag <sto@debian.org> for the patch. - (Closes: #602374) - postgresql: - . Support various pg_dump formats in addition to pg_dumpall. - Thanks to Jacob Anawalt <jlanawalt@gmail.com> for the patch. - (Closes Roundup bug #2534) - . Fix reliance on bash for pipefail. - rdiff: - . Support reading include/exclude patterns from files using the - "include @/etc/backup_includes" syntax (Closes Roundup bug - #2370). Thanks to ale for the patch. - rsync: - . Fix long rotation. - . Make units clearer (Closes Redmine bug #2737) - . Do arithmetic using bash rather than bc (Closes: #603173) - sys: - . Fix hwinfo (Closes: #625501) - . Fix gathering of information about loaded modules: - cut is in /usr/bin actually. - tar: - . Install by default. (Closes Redmine bug #2907) - helper changes - dup: - . Fix separate signing key usecase. Thanks to Ian Beckwith for - the patch. - . Make units clearer (Closes Redmine bug #2737) - rdiff: - . Generate 4096 bits RSA keys. - tar: - . Install by default. (Closes Redmine bug #2907) - documentation changes - . Recommend using 4096 bits RSA keys everywhere. - -version 0.9.8.1 -- October 31, 2010 (boo!) - backupninja changes - . Do not error out when no job is configured. Thanks to Jordi Mallach - <jordi@debian.org> for the patch (Closes: #597684) - handler changes - sys: - . Route around broken vgcfgbackup not able to handle multiple VG arguments - -version 0.9.8 -- September 12, 2010 - backupninja changes - . Added GZIP_OPTS option, defaulting to --rsyncable, so that this - option can be disabled on systems that don't support it. This - also allows to use another compression program, such as pbzip2 - on SMP machines (Closes Roundup bug #2405) - handler changes - sys: - . Only run mdadm if RAID devices actually exist (Closes: #572450) - dup: - . Now default to use --full-if-older-than; see the new "increments" - option to opt-out or tweak the default (30D) delay between full - backups. Thanks a lot to Olivier Berger (Closes: #535996) - . Use duplicity's --extra-clean option to get rid of unnecessary old - cache files when cleaning up. This is enabled when using duplicity - 0.6.01 or newer, that depends on local caching (Closes: #572721) - . Ignore anything but digits and "." when comparing versions - (Closes: #578987) - . Put archive directory (cache) into /var/cache/backupninja/duplicity - rather than the default /root/.cache/duplicity, unless the user - has specified it (Closes: 580213) - . Better example.dup documentation. Thanks, Alster! - . Added ftp_password option to securely transmit the FTP password - from backupninja to duplicity. - mysql: - . Don't lock tables in the information_schema database - (Closes: #587011) - . Fix code logic to make dbusername/dbpassword actually usable - (Closes Redmine bug #2264) - rsync: - . Fix lockfile checks. This prevents multiple instances of the same - rsync job to run in parallel. - . Avoid passing the remote user twice to rsync-over-ssh. - doc changes - manpage: - . Fix typo in manpage (Closes: #583778) - ldap: - . Add ssl option description, fix tls option description (Closes - Roundup bug #2407) - -version 0.9.7 -- January 27, 2010 - backupninja changes - . fix bug in reportspace, thanks Dan Garthwaite - . do not assume English locale when using date (Closes: #465837) - . add 'when = manual' option, that can be used in the global config - file or in a given backup action file. Thanks Tuomas Jormola for the - preliminary patch (Closes: #511299) - . new reportinfo option: when set, messages sent by handlers with - "info" are included in the report e-mail (closes #563734) - . reportspace: skip non-directories and places that don't exist on the - local filesystem (Closes: #536049) - . set BACKUPNINJA_DEBUG when invoked with -d (Closes: #537266) - lib changes - easydialog: - . Allow form fields input to grow up to 100 chars (Closes: #562249) - handler changes - ldap: - . Use gzip's --rsyncable option. - . Use bash pipefail option when needed so that failed dumps are - reported as such. - maildir: - . fix location of deleted_on file - . add missing destid_file options to ssh connections - . added sshoptions variable for arbitrary ssh options - . updated example file to include destid_file, destport and sshoptions - . use any subdirectories not just "a" to "z". Thanks Chris Nolan! (Redmine#606) - mysql: - . Options passed to mysqldump are now customizable with the new - sqldumpoptions configuration variable. Thanks to Chris Lamb for his - preliminary patch (Closes: #502966) - . Hide 'mysqladmin ping' output, to prevent confusing the user in - case mysqld is running but the authentication fails, which apparently - does not prevent mysqldump to work. - . Fix the error message displayed when mysqld is not running: - mysqladmin ping indeed returns 0 when authentication fails. - . Use gzip's --rsyncable option. - . Quote output filenames to support shell meta-characters in - database names. - . Use bash pipefail option when needed so that failed dumps are - reported as such. - pgsql: - . Use gzip's --rsyncable option. - . Quote output filenames to support shell meta-characters in - database names. - . Use bash pipefail option when needed so that failed dumps are - reported as such. - rdiff: - . Fix include/exclude paths with spaces (Closes: #398435) - . Fix confusing error if rdiff-backup cannot be found on remote server. - . Increased element number in include/exclude and vserver ninjahelper interface - sys: - . New luksheaders option (default=disabled) to backup the Luks header - of every Luks device. - . New lvm option (default=disabled) to backup LVM metadata for every - detected volume group. - . Backup dmsetup info as well, for easier restoring of Luks headers. - dup: - . Fixed bandwidthlimit syntax error. Thanks to Ian Beckwith for - the patch. - . Send duplicity output to debug line by line instead of as a whole at - one time (Closes: #536360) - . Report duplicity output as "info" so that it can be included in - report e-mail when reportinfo is on (Closes: #563734) - . Fix include/exclude paths with spaces - . Support backups to Amazon S3 buckets, thanks to stefan for the patch. - helper changes - dup: - . Do not propose to exclude /home/*/.gnupg twice anymore - (Closes: #563044) - autotools - . Added the stat command to the automagically replaced ones, hoping it - will help supporting *BSD some day. - -version 0.9.6 -- July 21, 2008 - backupninja changes - . fix bug in cstream definition, thanks Jamie McClelland - . Allow the entire backup run to be halted by an action, thanks to - Matthew Palmer (Closes: #455836) - . Fixed tr construct reporting a warning (Closes: #452669) - lib changes - vserver: - . added vservers_running function - tools - . mktemp is now required to run backupninja, removed less secure - fall-back if mktemp did not exist on the system - handler changes - dup: - . General cleanup - . Better support for new duplicity (>= 0.4.4) command line syntax: - run remove-older-than when $keep is not set to yes (Closes: #458816), - and run "duplicity cleanup" before any other duplicity command; both - only trigger a warning on failure, since they should not stop backups - from being done. Also migrated full/incremental backup switch to the - new syntax. - . Support every duplicity-supported transport with new configuration - option desturl (Closes: #483712, #346040, Trac#2). - . Actually allow to backup only VServers, by relaxing $include test. - . Set secure permissions on tmpdir when creating it. - ldap: - . support HDB backend just as the BDB one, and make message clearer - when no supported backend is found (Closes: #476910) - rdiff: - . Fixed ignore_version default value missing - . Add patch from Matthew Palmer to rdiff handler to incorporate sshoptions - into options via remote-schema not already specified (Closes: #424639) - wget: - . New handler from rhatto designed to incrementally pull content from - a website to a local folder, based on the rsync handler - maildir: - . fixed bug where maildirs that start with a number were skipped - . make maildir helper look in every subdirectory of the source directory for - maildirs, rather than just looking in the directories [a-zA-Z0-9], thanks - for the patch from chris@cenolan.com (Trac#43). - . make deleted maildirs record the date they were deleted - . add destid_file configuration option to enable you to specify an alternate - ssh public key authentication file (defaulting to /root/.ssh/id_rsa) - pgsql, mysql, svn, sys: - . use new vservers_running function from lib/vserver (factorization++) - sys: - . update for 2.6 kernels: use /proc/kallsyms instead of /proc/ksyms - (Closes: Trac#39) - . support selection of VServers to run on, in the same way as in the - dup handler, with the new vsnames configuration option ; (Closes: Trac#45) - . add support for capturing the package debconf selection states using - debconf-get-selections - . fixed catifexec function to actually work, also now passes the arguments - given to catifexec() to the called command (Thanks John Hallam!) - . Added more robust software RAID information capture by running mdadm - -Q --detail /dev/md?* because some people may have empty mdadm.conf files - (Thanks to John Hallam). - trac: - . stop failing on all the trac backups if just one fails, this means - removing the temporary trac backup directories if they fail - makecd - . updated handler for new toolset (genisoimage and wodim) - -version 0.9.5 -- December 2, 2007 - backupninja changes - . Fixed checks on configuration files permissions, since the patch - applied to fix #370396 broke this, especially for configuration files - created with permissions 000 by an older ninjahelper version. - . Enhanced portability for other platforms - . Added quoting because it was needed to prevent shell expansion, broking the - toint function sometimes (Closes: Trac#11) - . Fixed reportspace option (Closes: Trac#10) - . Fixed ldap handler not recognizing database suffix (Closes: Trac#28) - handler changes - dup: - . Support duplicity >= 0.4.3 invocation syntax (--ssh-command option - is not supported anymore) (Closes: #447425) - . New tmpdir configuration option, very useful in case duplicity tends - to fill up /tmp. - ldap: - . Fixed shell command quoting issues, missing 'then' clauses, cleaned up - compress=yes to be less redundant and not create empty uncompressed - file (Closes: #394935) - . Fixed ninjahelper to properly set compress option, standardized on yes/no - instead of on/off - . Fixed problem that caused combination of slapcat and compress to not work - together (Closes: Trac#29) - . Applied patch from romain.tartiere@healthgrid.org to fix the SSL/TLS options - to be correct, also set TLS to be the default over SSL (Closes: Trac#13) - maildir: - . Added an examples file (Closes: Trac#23) - . Applied patch from Anarcat that fixes the cp/mkdir calls to not use GNU - coreutils options, as well as some bashisms (Closes: Trac#24) - . Fix test mode (Closes: Trac#25) - mysql: - . Fixed case where odd combination of configuration options caused sqldump - backups to get overwritten with an empty file (Closes: #402679) - . Added 'nodata' option to enable you to specify tables that you want to omit - the data from a backup, but still backup the table structure. This is very - useful in cases where tables contain large amounts of cache data. See the - example.mysql for options, thanks Daniel Bonniot (Closes: #408829) - . Enhance code for selecting databases by asking MySQL not to give us the - header (-N), to not draw pretty boxes around the output (-B), send the query - via -e instead of a pipe and ensure MySQL listens to -B. Thanks to - Matthew Palmer (Closes: #452039). - pgsql: - . Support configuring PGSQLUSER for real, and document it a bit; this - broken support actually prevented pgsql handler to work for VServers - (Closes: #396578) - rdiff-backup: - . Added cstream support to allow for bandwidth limiting - . Handle "keep = yes" to disable old backups removal (Closes: #424633) - . Add configuration option to allow you to disable the version check - as in some instances this may be an ok scenario (Closes: #424632) - . Added local destination support to helper (Closes: Trac#4) - . Allow exclude-only configurations (Closes: Trac#21) - rub/rsync - . Fixed typo in rub handler that caused it to not work - . Changed to use lib/vserver code - . Fixed fsck error - . Fixed integer comparison (Closes: Trac#3) - . Renamed handler to 'rsync', replaces outdated rub handler - . updated examples/Makefile.am and handlers/Makefile.am to include - rsnap/rsync (Closes: #440554) - . Added example.rsync configuration file - sys: - . Fixed typo breaking things for VServers. - . Fix bug when vrootdir is on its own partition (Closes: #395928) - . Better sfdisk error and output handling: should now properly warn - when it does not manage to backup a partition table, and shut up when - it succeeds (Closes: #396632) - . Added option to not use sfdisk at all, useful for vserver/xen instances - that produce warnings about no harddisks found (Closes: #404071) - . Fixed example in example.sys to detail the __star__ in partitionsfile and - note why its necessary (Closes: #409192) - . Force C locale for sfdisk to ensure english words are found in grep - . Make directory where output is placed configurable, and create the parent dir - if it doesn't exist (Closes: Trac#1) - ninjareport - . Added first draft of method to aggregate reports from many servers into - one email. Requires logtail, rsync, configuration of reporthost, - reportdirectory and reportuser in backupninja.conf. Configure cron to - run once a day, and individual backupninjas not to report by email their - status, then enjoy one email report from all hosts, rather than multiple - fixed 'make install' bug that failed if /etc/backup.d already existed - changed spaces to tabs in Makefile.am - updated redhat spec file (thanks Adam Monsen) - -version 0.9.4 -- October 6th, 2006 - backupninja changes - . Fixed bug in toint(), and thus isnow(), which caused it - to not work when run from cron. - . Recursively ignore subdirs in /etc/backup.d (Closes: #361102) - . Add admingroup option to configuration to allow a group that can - read/write configurations (instead of only allowing root). Checks - and complains about group-readable files only when the group differs - from the one in the configuration file (default is root as before). - Thanks to Martin Krafft for the patch (Closes: #370396). - . When determining which backup actions to make, find now follows - symlinks for $configdirectory - . Changed order of -s to mail for compatibility - . fixed permission stat call so it uses the --format supported by - coreutils (Closes: #382747) - . Added disk space report option (thanks Adam Kosmin) - handler changes - Added tar handler: - . create tarballs - Added rsnap handler: - . rotated rsync snapshops - . code from paulv@bikkel.org - Added rub handler: - . alternative to rsnap - . code from rhatto@riseup.net - mysql: - . Fixed improper use of $vuserhome (Closes: #351083) - . Fixed erroneous removal of tmpfile when it didn't exit - . Fixed inversed vsname emptiness check - . Fixed su quote usage to be more posixy - . Compress for sqldumps now happens in-line to save some disk space (Closes: #370778) - . Fixed --defaults-file now as --defaults-extra-file (thanks rhatto) - pgsql: - . Fixed inversed vsname emptiness check - . Fixed su quote usage to be more posixy - . Fixed shell expansion, thanks Thomas Kotzian (Closes: #363297) - . postgres user UID is now the one from inside the vserver if necessary - . Compress now happens in-line to save some disk space (Closes: #370778) - . $PGSQLUSER is used instead of hardcoding user 'postgres' (although this is the default) - svn: - . Fixed inversed vsname emptiness check - rdiff: - . Symlink and globbing support in include/exclude/vsinclude - clarification: globbing is fully supported again, whereas no attempt - is done to dereference symlinks anymore, due to incompatibilities - between various readlink versions in this field. - . Removed overzealous vsnames check - . Now works if testconnect=no and if $test is not defined. - . add $sshoptions config parameter in [dest] section of config so - connections to ports other than 22 can be made by adding the - following to the top of the handler config: - options = --remote-schema 'ssh -p REMOTE-PORT -C %s rdiff-backup - --server' - dup: - . Symlink and globbing support in include/exclude/vsinclude - clarification: globbing is fully supported again, whereas no attempt - is done to dereference symlinks anymore, due to incompatibilities - between various readlink versions in this field. - . Removed over zealous vsnames check - . Does not pretend anymore that duplicity can work without - any passphrase - . Support duplicity 0.4.2 (with Debian patches applied; upstream's - 0.4.3 will integrate them); documented how to write sftp-compatible - sshoptions (Closes: #388543) - . Now forbid to (try to) include /. - sys: - . Many more system checks were added, (thanks to Petr Klíma) - . Added warning if no devices were found (thanks Ranier Zocholl) - . Enhanced debian package selections to include purged packages (thanks - Tom Hoover) - . Removed warning about vserver not running (thanks anarcat) - ldap: - . Compress now happens in-line to save some disk space (Closes: #370778) - makecd: - . Added nicelevel option (thanks rhatto) - trac: - . fixed problem when src was set to the trac repo directly (Closes: #382737) - lib changes - vserver: - . init_vservers: fixed Debian bug #351083 (improper readlink syntax) - . found_vservers: escaped special grep repetition character + - . forced mktemp to use a template with a name to be more compatible with - different versions of mktemp, thanks anarcat - ninjahelper changes - . Recursively ignore subdirs in /etc/backup.d (Closes: #361102) - . Fix configdirectory error that forced you to use /etc/backup.d, thanks anarcat - . When determining which backup actions to list, find now follows - symlinks for $configdirectory - . Stop checking helpers perms: both "make install" and distros packages - install them with appropriate permissions, it's overzealous to check - this at runtime, and is more complicated to do with current - admingroup option. - dup.helper: - . Fix: signing was enabled with symmetric encryption. - changed cron permissions to 644 - changed /etc/backup.d permissions to 0770 (for admingroup) - minor documentation fixes - improved RPM build process allowing 'make rpm-package' and 'make - srpm-package' targets, also fixes permissions on man directories, - cleans up RPM-related files during distclean, and adds default - EDITOR for "autogen.sh -f" if none is set. (thanks Robert Napier) - -version 0.9.3 -- February 1st, 2006 - autotools fixes - backupninja changes - backupninja.conf - . added (commented out) the various default paths to - programs such as PGSQLDUMP, so that users can figure - out more easily they can customize them - code refactor: - . now uses vservers lib to initialize vservers support - handler changes - duplicity, mysql, pgsql, rdiff, svn, sys: start to use (at different - degrees) new lib/vserver functionality - mysql: - . fixed no user defaults file processing - duplicity: - . fixed (again...) globbing in include and exclude options (Debian bug - #348022, follow-up to #338796) - . warn if vsnames or vsinclude is enabled while vservers support is - disabled in backupninja.conf - . now works when multiple vservers names are given (separated by space) - in vsnames config variable - rdiff - . fixed globbing bug in include, exclude and vsinclude options - . it's now possible to choose exactly which vservers should be - backed-up, as it already was with duplicity handler, with the - "vsnames" configuration setting - ninjahelper changes - rdiff.helper: - . fixed errors in create remote dir - . code formatting cleanup (three spaces indent) - . fixed bug which caused only first include/exclude dir to - have "include = " - . fixed globbing bug with exclude - ninjahelper: - . now reports error if the helper script has a syntax error or bombs out. - . code formatting cleanup (three spaces indent) - lib changes - vserver: - . init_vservers: improved VROOTDIR detection - . init_vservers: test in a stricter way the real vservers availability - . init_vservers: canonicalize VROOTDIR (since duplicity et al. - don't follow symlinks) - . init_vservers: warn if vservers are enabled but no vserver is found - . new function: vservers_exist - known bugs: - easydialog: - . formDisplay does not return exit status. - -version 0.9.2 -- December 29, 2005 - backupninja changes - fixed broken toint() which caused when "everyday" problems - backupninja.conf.5 updated to include "when" and "vservers" - code refactor: - . moved to lib/ some code that has to be shared between - backupninja and ninjahelper - handler changes - trac: - . mkdir subdirectory problem fixed - duplicity: - . globbing support fixed in include and exclude options - . different signing and encrypting key support added - . fixed erroneous comments in example.dup about the way - GnuPG-related options are used - mysql: - . handler vserver bugs fixed and debug output enhanced - ninjahelper(s) changes - vserver-related functions added to lib/vservers.in - added man/ninjahelper.1 man page - makecd: - . was missing in Makefile.am/.in - rdiff-backup: - . used to expand '*' in default source directories - . the "Cancel" buttons used to have a weird behaviour - . updated to include Vserver selection - pgsql: - . forbid the user to choose an empty database set - . "Cancel" button now does what it is meant to do - mysql: - . enhanced for vserver support - . now able to select databases and dump directory - duplicity: - . new handler added (with Vserver support) - -version 0.9.1 -- November 05 2005 - rearranged source so that it is relocatable with autotools - (thanks to Petr Klíma petr.klima@madeta-group.cz) - fixed many bugs in rdiff helper - rdiff handler does not require 'label' (for real this time?) - added makecd ninjahelper - (thanks to Stefani stefani@riseup.net) - made ninjahelper create files with mode 600 rather than 000 - changed subversion handler to use svnadmin hotcopy instead of - the unsupported hot-copy.py script, which was moved in Debian - update rdiff ninjahelper - now detects and auto-install rdiff-backup on the remote - machine if possible, also tests the remote backup directory - and offers to create it if it doesn't exist - -version 0.9 -- October 19 2005 - *** IMPORTANT CHANGE, UPGRADE AT ONCE *** - fixed insecure temporary file creation - ***************************************** - removed erroneous magic file marker in pgsql handler - fixed incorrect find positional - changed direct grep of /etc/passwd to getent passwd. - rdiff helper has much better information on failed ssh attempt - (patch from cmccallum@thecsl.org). - rdiff handler now supports remote source and local dest. - (patch from cmccallum@thecsl.org). - man pages are greatly improved. - -version 0.8 -- September 15 2005 - added pgsql (PostgreSQL) handler, with vservers support. - added vservers support to duplicity handler - Note: the configuration is a bit different than the rdiff - handler's one, but the default behavior is the same: - have a look at example.dup. - improved README - documented .disabled method. - corrected VROOTDIR default value. - added ninjahelper to the install instructions. - improved rdiff, dup and sys handlers' vservers support - prevent vserver-debiantools' $VROOTDIR/ARCHIVES directory - to be seen as a vserver - changes to sys handler - make use of configurable $VSERVERINFO instead of hard-coded vserver-info. - fixed dpkg existence test inside vserver. - fixed $nodpkg use. - changes to pgsql handler - now checks if the specified vserver is running. - now checks if $PGSQLDUMP/$PGSQLDUMPALL are available where needed. - now checks if "postgres" user exists on the host/vserver. - changes to ninjahelper - check_perms() does not die anymore on group/world readable - helper scripts (now consistent with the "helper scripts - must not be group or world writable!" error msg). - xedit action now tries $EDITOR, then /etc/alternatives/editor, - then nano, vim and vi, and aborts if none of these exists. - added helper for pgsql handler. - rdiff handler now does not require 'label' - changes to mysql and svn handlers' vservers support - these handlers now check if the source vserver is running - added 'ignores' for mysql handler. (thanks Daniel.Bonniot@inria.fr) - -version 0.7 -- July 26 2005 - added ninjahelper: a dialog based wizard for creating backupninja configs. - considerably improved and changed the log file output. - you can now disable actions with .disabled (this is new preferred method). - added makecd handler and example.makecd for backing up to cd/dvd (thanks stef). - fixed bug when specifying multiple 'when' options. - -version 0.6 -- June 16 2005 - ldap handler has new options: backup method to use (ldapsearch or - slapcat), restart, passwordfile and binddn. Default backup method - is set to ldapsearch as this is safer - ****************************************************************** - NOTE: to get the previous default behavior with the ldap handler, - you must set "method = slapcat". The new default is ldapsearch. - ****************************************************************** - implemented fix so that the main script will echo fatal errors rather - than being silent about them, this means an error message every hour - if there is a major configuration problem (not a handler problem) - added vserver support to main script and to the handlers: mysql, svn, sys, rdiff - changes to duplicity handler (thanks intrigeri!): - "keep = yes" now disables file cleaning on desthost - added "sign" option for backups signing - added "encryptkey" option to specify the gpg key to use - split config into [source], [gpg] and [dest] sections - added "nicelevel" option - added "testconnect" option - added "sshoptions" option (will be passed to ssh/scp) - added "bandwidthlimit" option - example.dup example config file for duplicity handler - added trac (http://trac.edgewall.com/) environment handler (thanks Charles Lepple!) - added configfile option to mysql handler - the default is /etc/mysql/debian.cnf. with this, - sqldump doesn't need dbusername. (hotcopy still does). - fixed bug in mysql handler which caused some passwords to not work. - (.my.cnf files now have double quotes around password) - can now pass options to hwinfo and sfdisk in sys handler. - -version 0.5 -- April 12 2005 - rdiff handler works when remote sshd has a banner - rdiff handler supports local dest - logfile is created if it doesn't exist - added "when = hourly" - added optional 'nicelevel' to rdiff handler - fixed bug where actions were not run in numeric order. - improved 'when' parsing. - -version 0.4.4 -- March 18 2005 - results of handlers are now read line by line. - changes to rdiff handler: added "options", and "keep" is - not necessarily days now (ie, it will pass straight through to - rdiff-backup if the keep has a unit on it, otherwise it adds the 'D'). - added dup handler (still pretty beta) - added maildir handler (very specialized handler) - added --run option (runs the specified action file) - improved sys handler, now uses hwinfo - added subversion hotbackup handler, svn. - added PATH to cron.d file, which fixes file not found errors. - -version 0.4.2 -- Jan 6 2005 - fixed bug which caused a report email to be sent even if no actions were run. - fixed bug where multiple handler status messages were ignored - added status in the subject line of report emails - -version 0.4.1 -- Jan 3 2005 - added $usecolors and now more conservative about when colors are echoed. - fixed major bug, 'when' actually works now. - replaced debug function with debug, info, warning, error, fatal. - added --now option to force all actions to be performed now. - -version 0.4 -- Dec 26 2004 - added "when" option, so that all configs can specify when - they are to be run. - added reportsuccess and reportwarning config options - added .sys handler (hardware, packages, partitions). - -version 0.3.4 -- Dec 8 2004 - fixed numerical variable quoting compatibility with older wc - fixed stderr redirect bug - some comments in example.rdiff - -version 0.3.3 -- Nov 10 2004 - '*' (asterisk) works now in rdiff config files - works now with gawk as well as mawk - many bug fixes to ldap handler - paths to helper scripts can be configured in global config - does not require /usr/bin/stat - -version 0.3.2 -- Sept 29 2004 - handler scripts are no longer executable (to comply with debian policy) - handler error and warning messages are sent with the notify email - -version 0.3.1 -- Sept 5 2004 - added ldap handler - moved sh support to a handler script - add test mode, where no action is taken. - added --help - force only root can read /etc/backup.d/* - fixed missing equals symbols in example.rdiff - changed backupninja executable to be /usr/sbin rather than /usr/bin - -version 0.3 -- Oct 20 2004 - ** IMPORTANT ** all config files are now ini style, not apache style - rewrote all scripts in bash for portability - added drop-in backupninja lib directory (/usr/share/backupninja) - all scripts are now run as root - -version 0.2 -- Oct 14 2004 - move distribution folder ./cron.d to ./etc/cron.d - fixed bug: removed printr of excludes (!) - added support for changing the user/group in rdiff sources. - added support for .mysql config files. - -version 0.1 -- Oct 8 2004 - initial release - diff --git a/INSTALL.md b/INSTALL.md index 4ea811273161000a9485250a4035cda63d43978f..175fe1fd9c42ea6f64b8991be11d45d359400aba 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -15,7 +15,7 @@ Requirements: Recommended: - rdiff-backup duplicity rsync borgbackup gzip hwinfo sfdisk cryptsetup flashrom hwinfo + borgbackup cryptsetup duplicity flashrom gzip hwinfo rdiff-backup restic rsync sfdisk To install backupninja, simply do the following: diff --git a/Makefile.am b/Makefile.am index 8b2fb8a38ac6bb131559ab6e96ab8dc95c12d103..c9e6b57b06711ab797978e15a19772e6823a36ba 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ # vi: noexpandtab softtabstop=0 ## Process this file with automake to produce Makefile.in -EXTRA_DIST = FAQ.md README.md COPYING AUTHORS INSTALL.md NEWS ChangeLog \ +EXTRA_DIST = FAQ.md README.md COPYING AUTHORS INSTALL.md NEWS CHANGELOG.md \ backupninja.spec backupninja.spec.in autogen.sh SUBDIRS = etc examples handlers lib man src diff --git a/Makefile.in b/Makefile.in index 7f1e3d1aebce20eefcf2c504533ee8bb2159be94..92039b1fb8871cb4845c570fd5887ef2c64e0e4d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -133,7 +133,7 @@ am__recursive_targets = \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ - cscope distdir dist dist-all distcheck + cscope distdir distdir-am dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is @@ -156,7 +156,7 @@ CTAGS = ctags CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/backupninja.spec.in \ - AUTHORS COPYING ChangeLog NEWS TODO install-sh missing + AUTHORS COPYING NEWS TODO install-sh missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -281,7 +281,7 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -EXTRA_DIST = FAQ.md README.md COPYING AUTHORS INSTALL.md NEWS ChangeLog \ +EXTRA_DIST = FAQ.md README.md COPYING AUTHORS INSTALL.md NEWS CHANGELOG.md \ backupninja.spec backupninja.spec.in autogen.sh SUBDIRS = etc examples handlers lib man src @@ -310,8 +310,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -431,7 +431,10 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @@ -496,7 +499,7 @@ distdir: $(DISTFILES) ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir @@ -522,7 +525,7 @@ dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 - shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir @@ -540,7 +543,7 @@ dist dist-all: distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ @@ -550,7 +553,7 @@ distcheck: dist *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac diff --git a/NEWS b/NEWS index 9867b54358e0bee6578a56fd5be370b14484a1e6..ed499b2278296fc2121932fd4fcafb05c1d93e82 100644 --- a/NEWS +++ b/NEWS @@ -39,7 +39,7 @@ backupninja (0.9.4-1) UNRELEASED situations, with weird behavious, due to incompatibilities between various readlink versions in this field. This has been made clear eventually: globbing is fully supported again, whereas no - attempt is done to dereference symlinks anymore. + attempt is done to dereference symlinks anymore. Please read the new /usr/share/doc/backupninja/examples/example.dup or /usr/share/doc/backupninja/examples/example.rdiff file, and update your own configuration files if needed. @@ -51,7 +51,7 @@ backupninja (0.9.4-1) UNRELEASED sshoptions = -i /root/.ssh/id_dsa_duplicity with: sshoptions = -o IdentityFile=/root/.ssh/id_dsa_duplicity - + backupninja (0.9.2-1) unstable; urgency=low WARNING FOR DUPLICITY USERS diff --git a/README.md b/README.md index 61a255edd1b90b6d09c95f3392b0155ae705f15a..8867041dc382a2910b44e276b74916e798730835 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,6 @@ The key features of backupninja are: - console-based wizard (ninjahelper) makes it easy to create backup action configuration files - passwords are never sent via the command line to helper programs - - works with [Linux-Vservers](http://linux-vserver.org/) The following backup types are supported: @@ -82,8 +81,7 @@ To add an additional 'wizard' to ninjahelper, follow these steps: } 3. Look at the existing helpers to see how they are written. Try to re-use - functions, such as the dialog functions that are defined in `easydialog.sh`, - or the vserver functions defined in `lib/vserver`. + functions, such as the dialog functions that are defined in `easydialog.sh`. 4. Test, re-test, and test again. Try to break the helper by going backwards, try to think like someone who has no idea how to configure your handler @@ -106,6 +104,7 @@ file in `/etc/backup.d` according to the file's suffix: - `.sh`: run this file as a shell script. - `.rdiff`: filesystem backup (using rdiff-backup) + - `.restic`: filesystem backup (using restic) - `.dup`: filesystem backup (using duplicity) - `.borg`: filesystem backup (using borg) - `.mysql`: backup mysql databases @@ -137,11 +136,11 @@ Unless otherwise specified, the config file format is "ini style." For example: # this is a comment - + [fishes] fish = red fish = blue - + [fruit] apple = yes pear = no thanks \ @@ -215,25 +214,6 @@ Since it performs incremental backups it minimizes the number of request per operation therefore reducing the costs. The boto Python interface to Amazon Web Services is needed to use duplicity with S3 (Debian package: `python-boto`). - -Vservers --------- - -If you are using [Linux-Vservers](http://linux-vserver.org/) there are some -special capabilities that different handlers have to make vserver -backups easier. - -Set the variable `vservers` to be `yes` in `/etc/backupninja.conf` and see the -example configuration files for each handler to configure the vserver specific -variables. - -Additional vserver variables that can be configured in `/etc/backupninja.conf`, -but they probably don't need to be changed: - - - `VSERVERINFO` (default: `/usr/sbin/vserver-info`) - - `VSERVER` (default: `/usr/sbin/vserver`) - - `VROOTDIR` (default: `$VSERVERINFO info SYSINFO |grep vserver-Rootdir | awk '{print $2}'`) - .sh configuration files ----------------------- diff --git a/TODO b/TODO index 97114f40dfb1610a62179ff4d6d1c9deae817f05..ab71ac518d2c95f8ace55dcb4ab4750676285990 100644 --- a/TODO +++ b/TODO @@ -6,15 +6,13 @@ you are working on it! http://bugs.debian.org/cgi-bin/pkgreport.cgi?which=pkg&data=backupninja&archive=no . Fix all bugs reported on our Gitlab instance: - https://0xacab.org/riseuplabs/backupninja/issues + https://0xacab.org/liberate/backupninja/issues . Make ninjahelper allow you to pick what type of backup you want (instead of just assuming you want local-to-remote, or push backups. Some people want local-to-local, or remote-to-local, or pull backups). This has been reported for the duplicity handler as Debian bug #346040. -. Allow vsnames "all" in the msyql handler. - . Factorize the rdiff.helper's connection-related functions into a lib, so that they can be used by dup.helper too. (NB: don't forget that the dup handler has a sshoptions configuration setting, that is often used to diff --git a/aclocal.m4 b/aclocal.m4 index 433d545f6791cd0b8a611fa8184f696028ddee7c..0740a8f2ca4269a94b640557d98783b2aded5688 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.15 -*- Autoconf -*- +# generated automatically by aclocal 1.16.1 -*- Autoconf -*- -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -20,7 +20,7 @@ You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# Copyright (C) 2002-2014 Free Software Foundation, Inc. +# Copyright (C) 2002-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -32,10 +32,10 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.]) # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.15' +[am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.15], [], +m4_if([$1], [1.16.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -51,14 +51,14 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.15])dnl +[AM_AUTOMAKE_VERSION([1.16.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -110,7 +110,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd` # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -197,8 +197,8 @@ AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: -# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html> -# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html> +# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html> +# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html> AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. @@ -265,7 +265,7 @@ END Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: <http://www.gnu.org/software/coreutils/>. +that behaves properly: <https://www.gnu.org/software/coreutils/>. If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM @@ -307,7 +307,7 @@ for _am_header in $config_headers :; do done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -328,7 +328,7 @@ if test x"${install_sh+set}" != xset; then fi AC_SUBST([install_sh])]) -# Copyright (C) 2003-2014 Free Software Foundation, Inc. +# Copyright (C) 2003-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -349,7 +349,7 @@ AC_SUBST([am__leading_dot])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997-2014 Free Software Foundation, Inc. +# Copyright (C) 1997-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -388,7 +388,7 @@ fi # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -419,7 +419,7 @@ AC_DEFUN([_AM_IF_OPTION], # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -500,7 +500,7 @@ AC_CONFIG_COMMANDS_PRE( rm -f conftest.file ]) -# Copyright (C) 2009-2014 Free Software Foundation, Inc. +# Copyright (C) 2009-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -560,7 +560,7 @@ AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -588,7 +588,7 @@ fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006-2014 Free Software Foundation, Inc. +# Copyright (C) 2006-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -607,7 +607,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004-2014 Free Software Foundation, Inc. +# Copyright (C) 2004-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, diff --git a/backupninja.spec b/backupninja.spec index 7f84d0cadffd69d87b2f3c41688d7e6341aeadbb..5b1b24a1c55a71e6fabb581af927fc59a1576fbc 100644 --- a/backupninja.spec +++ b/backupninja.spec @@ -1,5 +1,5 @@ %define name backupninja -%define version 1.1.0 +%define version 1.2.0 Summary: Backupninja backup tool Name: %{name} @@ -7,7 +7,7 @@ Version: %{version} Release: 1 License: GPL Group: Applications/System -URL: https://0xacab.org/riseuplabs/backupninja +URL: https://0xacab.org/liberate/backupninja Source: %{name}-%{version}.tar.gz Requires: bash, gawk, rdiff-backup, gzip Provides: %{name} @@ -50,7 +50,7 @@ rm -fr %{buildroot} %ghost %{_localstatedir}/log/backupninja.log -%doc AUTHORS COPYING ChangeLog INSTALL.md NEWS README.md +%doc AUTHORS COPYING CHANGELOG.md INSTALL.md NEWS README.md %{_mandir}/man1/* %{_mandir}/man5/* diff --git a/backupninja.spec.in b/backupninja.spec.in index 38891d1128f2015e5c689d992b98be171b4143e6..4b883804e966d7ef0fc765f511722cfb46f9696e 100644 --- a/backupninja.spec.in +++ b/backupninja.spec.in @@ -7,7 +7,7 @@ Version: %{version} Release: 1 License: GPL Group: Applications/System -URL: https://0xacab.org/riseuplabs/backupninja +URL: https://0xacab.org/liberate/backupninja Source: %{name}-%{version}.tar.gz Requires: bash, gawk, rdiff-backup, gzip Provides: %{name} @@ -50,7 +50,7 @@ rm -fr %{buildroot} %ghost %{_localstatedir}/log/backupninja.log -%doc AUTHORS COPYING ChangeLog INSTALL.md NEWS README.md +%doc AUTHORS COPYING CHANGELOG.md INSTALL.md NEWS README.md %{_mandir}/man1/* %{_mandir}/man5/* diff --git a/configure b/configure index 440228e5b5cfde831fbf977df762d7903d0adab9..f57fa524289b5c20e65d265e000efb3ad4c0e0a4 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for backupninja 1.1.0. +# Generated by GNU Autoconf 2.69 for backupninja 1.2.0. # # Report bugs to <backupninja@lists.riseup.net>. # @@ -579,8 +579,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='backupninja' PACKAGE_TARNAME='backupninja' -PACKAGE_VERSION='1.1.0' -PACKAGE_STRING='backupninja 1.1.0' +PACKAGE_VERSION='1.2.0' +PACKAGE_STRING='backupninja 1.2.0' PACKAGE_BUGREPORT='backupninja@lists.riseup.net' PACKAGE_URL='' @@ -1219,7 +1219,7 @@ 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 backupninja 1.1.0 to adapt to many kinds of systems. +\`configure' configures backupninja 1.2.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1286,7 +1286,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of backupninja 1.1.0:";; + short | recursive ) echo "Configuration of backupninja 1.2.0:";; esac cat <<\_ACEOF @@ -1360,7 +1360,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -backupninja configure 1.1.0 +backupninja configure 1.2.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1377,7 +1377,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by backupninja $as_me 1.1.0, which was +It was created by backupninja $as_me 1.2.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -1726,7 +1726,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -am__api_version='1.15' +am__api_version='1.16' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do @@ -2241,7 +2241,7 @@ fi # Define the identity of the package. PACKAGE='backupninja' - VERSION='1.1.0' + VERSION='1.2.0' cat >>confdefs.h <<_ACEOF @@ -2271,8 +2271,8 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: -# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html> -# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html> +# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html> +# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html> mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The @@ -2323,7 +2323,7 @@ END Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: <http://www.gnu.org/software/coreutils/>. +that behaves properly: <https://www.gnu.org/software/coreutils/>. If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM @@ -3276,7 +3276,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by backupninja $as_me 1.1.0, which was +This file was extended by backupninja $as_me 1.2.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -3329,7 +3329,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -backupninja config.status 1.1.0 +backupninja config.status 1.2.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 3b873a3579990c265795302768cc95eda40c3527..891bb0f47d853933604abc1e3cb259937880ec02 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ # The maintainer mode is causing me grief with newest versions of autotools #AM_MAINTAINER_MODE -AC_INIT([backupninja],[1.1.0],[backupninja@lists.riseup.net]) +AC_INIT([backupninja],[1.2.0],[backupninja@lists.riseup.net]) AC_CONFIG_SRCDIR([src/backupninja.in]) AM_INIT_AUTOMAKE([foreign]) diff --git a/etc/Makefile.in b/etc/Makefile.in index b18cc5e6b793b2ed23458280e9ae1de7fee796da..2ee4341058ae99f8556468cf7f23de938a8c5900 100644 --- a/etc/Makefile.in +++ b/etc/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -265,8 +265,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -308,7 +308,10 @@ ctags CTAGS: cscope cscopelist: -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ diff --git a/etc/backupninja.conf.in b/etc/backupninja.conf.in index 7e3d347d0c1f9b53dfc00fb7f3cfd5576dd82d68..a350fc849450e01a00ba9e3735ce1295bc6d6cef 100644 --- a/etc/backupninja.conf.in +++ b/etc/backupninja.conf.in @@ -21,7 +21,7 @@ reportemail = root # even if all modules reported success. (default = yes) reportsuccess = yes -# if set to 'yes', info messages from handlers will be +# if set to 'yes', info messages from handlers will be # sent into the email (default = no) reportinfo = no @@ -35,18 +35,18 @@ reportspace = no # where to rsync the backupninja.log to be aggregated in # a ninjareport -reporthost = +reporthost = # what user to connect to reporthost to sync the # backupninja.log reportuser = ninja # where on the reporthost should the report go -# NOTE: the name of the log will be used in the report, +# NOTE: the name of the log will be used in the report, # use a globally unique name, preferably the hostname reportdirectory = /var/lib/backupninja/reports -# set to the administration group that is allowed to +# set to the administration group that is allowed to # read/write configuration files in /etc/backup.d admingroup = root @@ -72,9 +72,6 @@ usecolors = yes # default value for 'when' when = everyday at 01:00 -# if running vservers, set to yes -vservers = no - # programs paths # SLAPCAT=/usr/sbin/slapcat # LDAPSEARCH=/usr/bin/ldapsearch @@ -89,6 +86,3 @@ vservers = no # GZIP=/bin/gzip # GZIP_OPTS='--rsyncable' # RSYNC=/usr/bin/rsync -# VSERVERINFO=/usr/sbin/vserver-info -# VSERVER=/usr/sbin/vserver -# VROOTDIR=/var/lib/vservers diff --git a/examples/Makefile.am b/examples/Makefile.am index c33a8fbe66d6f195f0f0258ef92e4efdce318c39..5a5c48261e53388b2a9230767e9ca06cf9514782 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -1,7 +1,7 @@ EXAMPLES = example.borg example.dup example.maildir example.makecd \ example.mysql example.pgsql example.rdiff example.rsync \ - example.sh example.svn example.sys example.trac + example.sh example.svn example.sys example.trac example.restic EXTRA_DIST = $(EXAMPLES) diff --git a/examples/Makefile.in b/examples/Makefile.in index 98ef9bc54b0eca8b645e7f78790476fab0dfc847..1c6a3940378dc136b04d7046e8d8f94f03b9d884 100644 --- a/examples/Makefile.in +++ b/examples/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -231,7 +231,7 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXAMPLES = example.borg example.dup example.maildir example.makecd \ example.mysql example.pgsql example.rdiff example.rsync \ - example.sh example.svn example.sys example.trac + example.sh example.svn example.sys example.trac example.restic EXTRA_DIST = $(EXAMPLES) dist_pkgdata_DATA = $(EXAMPLES) @@ -255,8 +255,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -295,7 +295,10 @@ ctags CTAGS: cscope cscopelist: -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ diff --git a/examples/example.borg b/examples/example.borg index b49598d0ab7f9a7bf3dc96cd36eb708412642eb6..b95ad73b7e64166d81209a4b8f91265602c4886a 100644 --- a/examples/example.borg +++ b/examples/example.borg @@ -18,6 +18,16 @@ ## Default # nicelevel = 0 +## ionicelevel is optional. If it is left undefined or empty, ionice will not +## be used at all. If it is set to to an integer value from 0 to 7, then ionice +## will be used with the best effort class (-c2) and with the ionicelevel as +## the class data (-n). +## +## See the ionice(1) man page for more details about available levels. +## +## Default: +# ionicelevel = + ## default is yes. set to no to skip the test if the remote host is alive ## ## Default: @@ -107,6 +117,16 @@ exclude = /var/lib/mysql ## Default: # prune_options = +## by default borg emits a warning when a source file or directory +## vanishes during the backup operations +## set to yes to ignore such warnings +## +## Example: +## ignore_missing = yes +## +## Default: +# ignore_missing = + ###################################################### ## destination section ## (where the files are copied to) @@ -180,3 +200,17 @@ exclude = /var/lib/mysql ## ## Default: # passphrase = + +## Path to the directory that will hold borg's cache files. By default this is +## empty, which will let borg use its default path of "~/.cache/borg". +## +## Default: +# cache_directory = + +## command-line options to use with ssh +## +## an example setting would be: +## sshoptions = -i /root/.ssh/id_rsa_borg +## +## Default: +# sshoptions = diff --git a/examples/example.dup b/examples/example.dup index bfeccc6e243f8e402452b45bf081a1162978b56e..6977636a636bd36b1f0684fa6183bcb71761f627 100644 --- a/examples/example.dup +++ b/examples/example.dup @@ -19,6 +19,16 @@ ## Default: # nicelevel = 0 +## ionicelevel is optional. If it is left undefined or empty, ionice will not +## be used at all. If it is set to to an integer value from 0 to 7, then ionice +## will be used with the best effort class (-c2) and with the ionicelevel as +## the class data (-n). +## +## See the ionice(1) man page for more details about available levels. +## +## Default: +# ionicelevel = + ## test the connection? set to no to skip the test if the remote host is alive. ## if 'desturl' is set below, 'testconnect' must be set to 'no' for now. ## @@ -101,7 +111,7 @@ [source] ## A few notes about includes and excludes: -## 1. include, exclude and vsinclude statements support globbing with '*' +## 1. include and exclude statements support globbing with '*' ## 2. Symlinks are not dereferenced. Moreover, an include line whose path ## contains, at any level, a symlink to a directory, will only have the ## symlink backed-up, not the target directory's content. Yes, you have to @@ -127,21 +137,6 @@ include = /usr/local/sbin include = /var/lib/dpkg/status include = /var/lib/dpkg/status-old -## If vservers = yes in /etc/backupninja.conf then the following variables can -## be used: -## vsnames = all | <vserver1> <vserver2> ... (default = all) -## vsinclude = <path> -## vsinclude = <path> -## ... -## Any path specified in vsinclude is added to the include list for each vserver -## listed in vsnames (or all if vsnames = all, which is the default). -## -## For example, vsinclude = /home will backup the /home directory in every -## vserver listed in vsnames. If you have 'vsnames = foo bar baz', this -## vsinclude will add to the include list /vservers/foo/home, /vservers/bar/home -## and /vservers/baz/home. -## Vservers paths are derived from $VROOTDIR. - # files to exclude from the backup exclude = /home/*/.gnupg exclude = /var/cache/backupninja/duplicity diff --git a/examples/example.makecd b/examples/example.makecd index b01094e462006278b09e84faf4fb81b78891c344..a564c8342e91196fba14cdc2a470229c62ff3268 100644 --- a/examples/example.makecd +++ b/examples/example.makecd @@ -1,4 +1,21 @@ +## default is 0, but set to 19 if you want to lower the priority. +## an example setting would be: +## nicelevel = 19 +## +## Default +# nicelevel = 0 + +## ionicelevel is optional. If it is left undefined or empty, ionice will not +## be used at all. If it is set to to an integer value from 0 to 7, then ionice +## will be used with the best effort class (-c2) and with the ionicelevel as +## the class data (-n). +## +## See the ionice(1) man page for more details about available levels. +## +## Default: +# ionicelevel = + # TYP is cd or dvd AS WELL AS the disk inside!! burnertype = cd diff --git a/examples/example.mysql b/examples/example.mysql index de9651fb5e1b6e6cda11855e98bbbbe214ce296a..a0e386b10d55074e5386cf4496e8b2da1504ce0c 100644 --- a/examples/example.mysql +++ b/examples/example.mysql @@ -79,11 +79,3 @@ compress = yes # # compress = < yes | no > (default = yes) # if yes, compress the sqldump output. -# -# vsname = <vserver> (no default) -# what vserver to operate on (only used if vserver = yes -# in /etc/backupninja.conf), if you do not specify a vsname the -# host will be operated on -# -# NB: databases = all doesn't seem to work with hotcopy = yes -# when vsname is specified, I would like to know how to fix this. diff --git a/examples/example.pgsql b/examples/example.pgsql index 5a4e02f05f657a4e41ee7ff0fadf65d777b3d15d..d36ec3807893f5ddb5b189303cffabf74a05d9f9 100644 --- a/examples/example.pgsql +++ b/examples/example.pgsql @@ -1,10 +1,5 @@ ### backupninja PostgreSQL config file ### -# vsname = <vserver> (no default) -# what vserver to operate on, only used if vserver = yes in /etc/backupninja.conf -# if you do not specify a vsname the host will be operated on -# Note: if operating on a vserver, $VROOTDIR will be prepended to backupdir. - # backupdir = <dir> (default: /var/backups/postgres) # where to dump the backups diff --git a/examples/example.rdiff b/examples/example.rdiff index 323b3ebec99e4a0c7c00b0bdf504670785ba0113..18940e6a4818178b6abc9032d24e1d0dd2ea4fab 100644 --- a/examples/example.rdiff +++ b/examples/example.rdiff @@ -25,6 +25,16 @@ ## Default # nicelevel = 0 +## ionicelevel is optional. If it is left undefined or empty, ionice will not +## be used at all. If it is set to to an integer value from 0 to 7, then ionice +## will be used with the best effort class (-c2) and with the ionicelevel as +## the class data (-n). +## +## See the ionice(1) man page for more details about available levels. +## +## Default: +# ionicelevel = + ## default is yes. set to no to skip the test if the remote host is alive ## ## Default: @@ -93,7 +103,7 @@ type = local # keep = 60 ## A few notes about includes and excludes: -## 1. include, exclude and vsinclude statements support globbing with '*' +## 1. include and exclude statements support globbing with '*' ## 2. Symlinks are not dereferenced. Moreover, an include line whose path ## contains, at any level, a symlink to a directory, will only have the ## symlink backed-up, not the target directory's content. Yes, you have to @@ -119,21 +129,6 @@ include = /usr/local/sbin include = /var/lib/dpkg/status include = /var/lib/dpkg/status-old -## If vservers = yes in /etc/backupninja.conf then the following variables can -## be used: -## vsnames = all | <vserver1> <vserver2> ... (default = all) -## vsinclude = <path> -## vsinclude = <path> -## ... -## Any path specified in vsinclude is added to the include list for each vserver -## listed in vsnames (or all if vsnames = all, which is the default). -## -## For example, vsinclude = /home will backup the /home directory in every -## vserver listed in vsnames. If you have 'vsnames = foo bar baz', this -## vsinclude will add to the include list /vservers/foo/home, /vservers/bar/home -## and /vservers/baz/home. -## Vservers paths are derived from $VROOTDIR. - ## files to exclude from the backup exclude = /home/*/.gnupg exclude = /var/cache/backupninja/duplicity diff --git a/examples/example.restic b/examples/example.restic new file mode 100644 index 0000000000000000000000000000000000000000..9fbb124d3eb5974f347858f04d5021aa7fbf6d85 --- /dev/null +++ b/examples/example.restic @@ -0,0 +1,244 @@ +# +# restic handler example file +# +# Mandatory options are un-commented with suggested values +# Other options are commented out with their default values +# + +# when = everyday at 01 + +[general] + +# Create a new backup of files and/or directories [yes/no] +run_backup = yes + +# Remove snapshots from the repository [yes/no] +#run_forget = no + +# Check the repository for errors [yes/no] +#run_check = no + +# Remove unneeded data from the repository [yes/no] +#run_prune = no + +# Retry to run the command [integer] +#retry_run = 1 + +# Seconds to wait between each retry attempts [integer] +#retry_wait = 5 + +# Repository to backup to or restore from [path] +repository = /mnt/backup + +# Repository password [string] +password = secret + +# File to load root certificates from (default: use system certificates) [path] +#cacert = + +# Set the cache directory [path] +#cache_dir = + +# Auto remove old cache directories [yes/no] +#cleanup_cache = + +# Set output mode to JSON for commands that support it [yes/no] +#json = + +# Limits downloads to a maximum rate in KiB/s. (default: unlimited) [integer] +#limit_download = + +# Limits uploads to a maximum rate in KiB/s. (default: unlimited) [integer] +#limit_upload = + +# Do not use a local cache [yes/no] +#no_cache = + +# Do not lock the repo, this allows some operations on read-only repos [yes/no] +#no_lock = + +# Set extended option (can be specified multiple times) [key=value] +#option = + +# Read the repository password from a file [path] +#password_file = + +# Do not output comprehensive progress report [yes/no] +#quiet = + +# Path to a file containing PEM encoded TLS client certificate and private key [path] +#tls_client_cert = + +## Adjust process scheduling priority. When set to to an integer value between +## -19 and 20, the backup command will be started with the desired scheduling +## priority. A positive integer indicates lower priority, the default priority +## being 0. [integer] +## +## Default: +# nicelevel = + +## Adjust I/O scheduling class and priority. When set to to an integer value +## between 0 and 7, the backup command will be started with the best-effort +## class and desired priority level. [integer] +## +## See the ionice(1) man page for more details about available levels. +## +## Default: +# ionicelevel = + +[s3] + +#aws_access_key_id = + +#aws_secret_access_key = + +#aws_session_token = + +[swift] + +#os_auth_url = + +#os_tenant_id = + +#os_tenant_name = + +#os_username = + +#os_password = + +#os_region_name = + +[b2] + +#b2_account_id = + +#b2_account_key = + +[azure] + +#azure_account_name = + +#azure_account_key = + +[gs] + +#google_project_id = + +#google_application_credentials = + +[backup] + +# Initialize the repository if it doesn't exist [yes/no] +#init = yes + +# Files adn directories to backup (can be specified multiple times) [path] +#include = / + +# Exclude a pattern (can be specified multiple times) [pattern] +#exclude = /dev +#exclude = /lost+found +#exclude = /media +#exclude = /mnt +#exclude = /proc +#exclude = /run +#exclude = /sys +#exclude = /tmp +#exclude = /var/cache +#exclude = /var/lock +#exclude = /var/spool +#exclude = /var/run +#exclude = /var/tmp + +# Excludes cache directories that are marked with a CACHEDIR.TAG file [yes/no] +#exclude_caches = + +# Read exclude patterns from a file (can be specified multiple times) [path] +#exclude_file = + +# Takes filename[:header], exclude contents of directories containing filename (except filename itself) if header of that file is as provided (can be specified multiple times) [stringArray] +#exclude_if_present = + +# Read the files to backup from file (can be combined with file args) [path] +#files_from = + +# Force re-reading the target files/directories (overrides the "parent" flag) [yes/no] +#force = + +# Set the hostname for the snapshot manually. To prevent an expensive rescan use the "parent" flag [string] +#hostname = + +# Exclude other file systems [yes/no] +#one_file_system = + +# Use this parent snapshot (default: last snapshot in the repo that has the same target files/directories) [string] +#parent = + +# Add a tag for the new snapshot (can be specified multiple times) [string] +#tag = + +# Time of the backup (ex. '2012-11-01 22:08:41') (default: now) [string] +#time = + +# Store the atime for all files and directories [yes/no] +#with_atime = + +[forget] + +# Keep the last n snapshots [integer] +#keep_last = 7 + +# Keep the last n hourly snapshots [integer] +#keep_hourly = + +# Keep the last n daily snapshots [integer] +#keep_daily = + +# Keep the last n weekly snapshots [integer] +#keep_weekly = + +# Keep the last n monthly snapshots [integer] +#keep_monthly = + +# Keep the last n yearly snapshots [integer] +#keep_yearly = + +# Keep snapshots that were created within duration before the newest (e.g. 1y5m7d) [string] +#keep_within = + +# Keep snapshots with this tag (can be specified multiple times) [string] +#keep_tag = + +# Only consider snapshots with the given host [string] +#host = + +# Only consider snapshots which include this tag (can be specified multiple times) [string] +#tag = + +# Only consider snapshots which include this (absolute) path (can be specified multiple times) [string] +#path = + +# Use compact format [yes/no] +#compact = + +# String for grouping snapshots by host,paths,tags (default "host,paths") [string] +#group_by = + +# Do not delete anything, just print what would be done [yes/no] +dry_run = + +# Automatically run the 'prune' command if snapshots have been removed [yes/no] +#prune = + +[check] + +# Find unused blobs [yes/no] +#check_unused = + +# Read all data blobs [yes/no] +#read_data = + +# Read subset of data packs [string] +#read_data_subset = + +# Use the cache [yes/no] +#with_cache = diff --git a/examples/example.rsync b/examples/example.rsync index e4cea15172fc33f0ebcf5e831df8c1501b8a80c0..9e1e1e90120be120dbc43b55301a55819eca9d43 100644 --- a/examples/example.rsync +++ b/examples/example.rsync @@ -4,8 +4,6 @@ # Mandatory options are uncommented with sugested values # Other options are commented out with their default values # -# Note: You dont need to manually specify vservers using "include = /vservers". -# They're automatically backuped if vserver is set to "yes" on you backupninja.conf. [general] @@ -77,6 +75,16 @@ days = 7 # rsync command nice level #nicelevel = 0 +## ionicelevel is optional. If it is left undefined or empty, ionice will not +## be used at all. If it is set to to an integer value from 0 to 7, then ionice +## will be used with the best effort class (-c2) and with the ionicelevel as +## the class data (-n). +## +## See the ionice(1) man page for more details about available levels. +## +## Default: +# ionicelevel = + # set to "yes" if your system isnt handling timestamps correctly #enable_mv_timestamp_bug = no @@ -111,14 +119,6 @@ include = /var exclude = exclude_folder1 exclude = exclude_folder2 -# exlude some vserver from backup -# this is used only if vservers = yes on backupninja.conf -exclude_vserver = excluded_vserver1 -exclude_vserver = excluded_vserver2 - -# ssh command line (remote only) -#ssh = ssh - # ssh or rsync (remote source only) #protocol = ssh @@ -127,7 +127,7 @@ exclude_vserver = excluded_vserver2 #rsync = $RSYNC # rsync command options -#rsync_options = "-av --delete --recursive" +#rsync_options = -av --delete --recursive # when set to 1, use numeric ids instead of user/group mappings on rsync #numericids = @@ -142,7 +142,7 @@ exclude_vserver = excluded_vserver2 #remote_rsync = rsync # ssh key file (remote source only) -#id_file = /root/.ssh/id_dsa +#id_file = /root/.ssh/id_rsa # set to "yes" to rsync use a batch file as source #batch = no @@ -164,9 +164,6 @@ exclude_vserver = excluded_vserver2 # when "yes", test the connection for a remote source before backup #testconnect = no -# ssh command line (remote dest only) -#ssh = ssh - # ssh or rsync (remote dest only) #protocol = ssh @@ -186,7 +183,7 @@ exclude_vserver = excluded_vserver2 #user = # ssh key file (remote destination only) -#id_file = /root/.ssh/id_dsa +#id_file = /root/.ssh/id_rsa # set a bandwidth limit in KB/s (remote destination only) #bandwidthlimit = diff --git a/examples/example.svn b/examples/example.svn index ea4360130e2687554ed9eef30a81c8035c6ff448..0a64f0908b1aa74978525de817c3e3568da5572f 100644 --- a/examples/example.svn +++ b/examples/example.svn @@ -21,6 +21,3 @@ ## in /usr/share/doc/subversion/examples now if you wish to use ## it instead # HOTBACKUP = /usr/lib/subversion/hot-backup.py - -## the name of the vserver containing svn, if using vservers -# vsname = diff --git a/examples/example.sys b/examples/example.sys index f1b59735ec68d4baa6de957d658f8039f350e9e9..85bc650e282b29403a5917f144481d39b0574f1f 100644 --- a/examples/example.sys +++ b/examples/example.sys @@ -79,7 +79,3 @@ # note: to backup your BIOS, you need the program 'flashrom' installed, and your # mainboard needs to be supported, see http://flashrom.org/Supported_hardware#Supported_mainboards # bios = no - -# If vservers = yes in /etc/backupninja.conf then the following variables can -# be used: -# vsnames = all | <vserver1> <vserver2> ... (default = all) diff --git a/handlers/Makefile.am b/handlers/Makefile.am index e9526450dbd9259055b097726b3ce7a9743c52b3..65275e5738c0605dd59e9788788d1b8c2d551337 100644 --- a/handlers/Makefile.am +++ b/handlers/Makefile.am @@ -1,11 +1,12 @@ HANDLERS = borg borg.helper dup dup.helper maildir makecd \ - makecd.helper mysql mysql.helper pgsql pgsql.helper rdiff \ - rdiff.helper rsync sh svn sys sys.helper trac tar tar.helper + makecd.helper mysql mysql.helper pgsql pgsql.helper restic \ + restic.helper rdiff rdiff.helper rsync sh svn sys sys.helper trac tar tar.helper DIST_HANDLERS = borg.in borg.helper.in dup.in dup.helper.in maildir.in makecd.in \ makecd.helper.in mysql.in mysql.helper.in pgsql.in pgsql.helper.in rdiff.in \ - rdiff.helper.in rsync.in sh.in svn.in sys.in sys.helper.in trac.in tar.in tar.helper.in wget + rdiff.helper.in restic.in restic.helper.in rsync.in sh.in svn.in sys.in sys.helper.in \ + trac.in tar.in tar.helper.in wget CLEANFILES = $(HANDLERS) @@ -14,7 +15,7 @@ EXTRA_DIST = Makefile.am $(DIST_HANDLERS) edit = sed \ -e "s,@BASH\@,$(BASH),g" \ -e "s,@AWK\@,$(AWK),g" \ - -e "s,@SED\@,$(SED),g" + -e "s,@SED\@,$(SED),g" pkgdata_DATA = $(HANDLERS) @@ -78,8 +79,16 @@ rdiff.helper: $(srcdir)/rdiff.helper.in rm -f rdiff.helper $(edit) $(srcdir)/rdiff.helper.in > rdiff.helper +restic: $(srcdir)/restic.in + rm -f restic + $(edit) $(srcdir)/restic.in > restic + +restic.helper: $(srcdir)/restic.helper.in + rm -f restic.helper + $(edit) $(srcdir)/restic.helper.in > restic.helper + rsync: $(srcdir)/rsync.in - rm -f rsync + rm -f rsync $(edit) $(srcdir)/rsync.in > rsync sh: $(srcdir)/sh.in diff --git a/handlers/Makefile.in b/handlers/Makefile.in index ddcd1d81a8f457c67f7b5cdf081213862d235996..c1391740300b04f8b79f6aa0fb8ddd2ae9f5722b 100644 --- a/handlers/Makefile.in +++ b/handlers/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -229,19 +229,20 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ HANDLERS = borg borg.helper dup dup.helper maildir makecd \ - makecd.helper mysql mysql.helper pgsql pgsql.helper rdiff \ - rdiff.helper rsync sh svn sys sys.helper trac tar tar.helper + makecd.helper mysql mysql.helper pgsql pgsql.helper restic \ + restic.helper rdiff rdiff.helper rsync sh svn sys sys.helper trac tar tar.helper DIST_HANDLERS = borg.in borg.helper.in dup.in dup.helper.in maildir.in makecd.in \ makecd.helper.in mysql.in mysql.helper.in pgsql.in pgsql.helper.in rdiff.in \ - rdiff.helper.in rsync.in sh.in svn.in sys.in sys.helper.in trac.in tar.in tar.helper.in wget + rdiff.helper.in restic.in restic.helper.in rsync.in sh.in svn.in sys.in sys.helper.in \ + trac.in tar.in tar.helper.in wget CLEANFILES = $(HANDLERS) EXTRA_DIST = Makefile.am $(DIST_HANDLERS) edit = sed \ -e "s,@BASH\@,$(BASH),g" \ -e "s,@AWK\@,$(AWK),g" \ - -e "s,@SED\@,$(SED),g" + -e "s,@SED\@,$(SED),g" pkgdata_DATA = $(HANDLERS) all: all-am @@ -264,8 +265,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -304,7 +305,10 @@ ctags CTAGS: cscope cscopelist: -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -515,8 +519,16 @@ rdiff.helper: $(srcdir)/rdiff.helper.in rm -f rdiff.helper $(edit) $(srcdir)/rdiff.helper.in > rdiff.helper +restic: $(srcdir)/restic.in + rm -f restic + $(edit) $(srcdir)/restic.in > restic + +restic.helper: $(srcdir)/restic.helper.in + rm -f restic.helper + $(edit) $(srcdir)/restic.helper.in > restic.helper + rsync: $(srcdir)/rsync.in - rm -f rsync + rm -f rsync $(edit) $(srcdir)/rsync.in > rsync sh: $(srcdir)/sh.in diff --git a/handlers/borg.helper.in b/handlers/borg.helper.in index d042198fe569397a83eaae0d0264ed787e783071..c995310c57057c2bdf2023128abe2f954e1a653e 100644 --- a/handlers/borg.helper.in +++ b/handlers/borg.helper.in @@ -79,11 +79,12 @@ do_borg_dest() { set -o noglob REPLY= - while [ -z "$REPLY" -o -z "$borg_directory" -o -z "$borg_host" -o -z "$borg_user" -o -z "$borg_archive" -o -z "$borg_compression" ] + while [ -z "$REPLY" -o -z "$borg_directory" -o -z "$borg_host" -o -z "$borg_port" -o -z "$borg_user" -o -z "$borg_archive" -o -z "$borg_compression" ] do formBegin "$borg_title - destination" formItem "directory" "$borg_directory" formItem "host" "$borg_host" + formItem "port" "$borg_port" formItem "user" "$borg_user" formItem "archive_name" "$borg_archive" formItem "compression" "$borg_compression" @@ -93,9 +94,10 @@ do_borg_dest() { tmp_array=($REPLY) borg_directory=${tmp_array[0]} borg_host=${tmp_array[1]} - borg_user=${tmp_array[2]} - borg_archive=${tmp_array[3]} - borg_compression=${tmp_array[4]} + borg_port=${tmp_array[2]} + borg_user=${tmp_array[3]} + borg_archive=${tmp_array[4]} + borg_compression=${tmp_array[5]} done set +o noglob @@ -179,13 +181,13 @@ do_borg_ssh_con() { read fi - ssh -o PreferredAuthentications=publickey $borg_host -l $borg_user "exit" 2> /dev/null + ssh -o PreferredAuthentications=publickey $borg_host -p $borg_port -l $borg_user "exit" 2> /dev/null if [ $? -ne 0 ]; then echo "Copying root's public ssh key to authorized_keys of $borg_user@$borg_host. When prompted, specify the password for user $borg_user@$borg_host." pubkeys=( /root/.ssh/id_[rd]sa.pub ) - if ! ssh-copy-id -i ${pubkeys[0]} $borg_user@$borg_host; then + if ! ssh-copy-id -i ${pubkeys[0]} -p $borg_port $borg_user@$borg_host; then echo "FAILED: Couldn't copy root's public ssh key to authorized_keys of $borg_user@$borg_host." - ssh $borg_user@$borg_host 'test -w .ssh || test -w .' + ssh -p $borg_port $borg_user@$borg_host 'test -w .ssh || test -w .' result=$? echo "Hit return to continue." read @@ -208,9 +210,9 @@ do_borg_ssh_con() { # test to see if the remote borg backup directory exists and is writable echo "Testing to see if remote borg backup directory exists and is writable" - ssh $borg_user@$borg_host "test -d ${borg_directory}" + ssh -p $borg_port $borg_user@$borg_host "test -d ${borg_directory}" if [ $? = 0 ]; then - ssh $borg_user@$borg_host "test -w $borg_directory" + ssh -p $borg_port $borg_user@$borg_host "test -w $borg_directory" if [ $? != 0 ]; then msgBox "destination directory is not writable!" "The remote destination directory is not writable by the user you specified. Please fix the permissions on the directory and then try again." remote_status=failed @@ -218,7 +220,7 @@ do_borg_ssh_con() { else booleanBox "Remote directory does not exist" "The destination backup directory does not exist, do you want me to create it for you?" if [ $? = 0 ]; then - ssh $borg_user@$borg_host "mkdir -p ${borg_directory}" + ssh -p $borg_port $borg_user@$borg_host "mkdir -p ${borg_directory}" result=$? case $result in 0) msgBox "$borg_title: success" "Creation of the remote destination directory was a success!";; @@ -316,6 +318,7 @@ keep = "${borg_keep}d" [dest] directory = $borg_directory host = $borg_host +port = $borg_port user = $borg_user archive = $borg_archive compression = $borg_compression @@ -373,6 +376,7 @@ borg_wizard() { borg_directory=/backup/`hostname` borg_user=root borg_host=localhost + borg_port=22 borg_archive='{now:%Y-%m-%dT%H:%M:%S}' borg_compression=lz4 borg_encryption=none diff --git a/handlers/borg.in b/handlers/borg.in index df500a80bacb6daf26c61625d01eca6d558e27db..582e0a617268d7765ffd4b6de5c8f0cd6699d714 100644 --- a/handlers/borg.in +++ b/handlers/borg.in @@ -14,13 +14,17 @@ # # +debug "export BORG_RELOCATED_REPO_ACCESS_IS_OK=yes" export BORG_RELOCATED_REPO_ACCESS_IS_OK=yes + +debug "export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes" export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes ### GET CONFIG ### getconf testconnect yes getconf nicelevel 0 +getconf ionicelevel getconf bwlimit setsection source @@ -31,10 +35,13 @@ getconf create_options getconf prune yes getconf keep 30d getconf prune_options +getconf cache_directory +getconf ignore_missing setsection dest getconf user getconf host +getconf port 22 getconf directory # strip trailing / directory=${directory%/} @@ -42,39 +49,76 @@ getconf archive {now:%Y-%m-%dT%H:%M:%S} getconf compression lz4 getconf encryption none getconf passphrase +getconf sshoptions +debug "export BORG_PASSPHRASE=\"<redacted>\"" export BORG_PASSPHRASE="$passphrase" +if [ -n "$sshoptions" ]; then + debug "export BORG_RSH=\"ssh $sshoptions\"" + export BORG_RSH="ssh $sshoptions" +fi + ### CHECK CONFIG ### +# source includes at least one path +[ -n "$include" ] || fatal "No source includes specified" + # destination specific checks -[ "$directory" != "" ] || fatal "Destination directory not set" +[ -n "$directory" ] || fatal "Destination directory not set" if [ "$host" != "localhost" ]; then - execstr_repository="ssh://${user}@${host}${directory}" + [ -n "$user" ] || fatal "Destination user not set" + [ -n "$host" ] || fatal "Destination host not set" + execstr_repository="ssh://${user}@${host}:${port}${directory}" else execstr_repository="$directory" fi execstr_archive="$archive" +if [ -n "$cache_directory" ]; then + cache_parent_dir=$(dirname "$(readlink -f "$cache_directory")") + [ -d "$cache_parent_dir" ] || fatal "Cache directory parent dir '$cache_parent_dir' is absent or is not a directory." + debug "export BORG_CACHE_DIR=\"${cache_directory}\"" + export BORG_CACHE_DIR="$cache_directory" +else + # Cache dir not set, let's clear out the environment variable to avoid + # having this directory be pointed to a random destination. + # Also apparently if we set the variable to an empty string, borg uses the + # empty string as though it was some path we specified and backup runs + # error out, so we need to unset the variable completely. + debug "unset BORG_CACHE_DIR" + unset BORG_CACHE_DIR +fi + +# Check that the ionicelevel is valid +if [ -n "$ionicelevel" ] && echo "$ionicelevel" | grep -vq "^[0-7]$"; then + fatal "The value of ionicelevel is expected to be either empty or an integer from 0 to 7. Got: $ionicelevel" +fi + +# Only use ionice if ionicelevel is not empty +nice="nice -n $nicelevel" +if [ -n "$ionicelevel" ]; then + nice="ionice -c2 -n $ionicelevel $nice" +fi + # check the connection at the source and destination [ -n "$test" ] || test=0 if [ "$host" != "localhost" ] && ([ "$testconnect" = "yes" ] || [ "${test}" -eq 1 ]); then - debug "ssh -o PasswordAuthentication=no $host -l $user 'echo -n 1'" - local ret=`ssh -o PasswordAuthentication=no $host -l $user 'echo -n 1'` + debug "ssh $sshoptions -o PasswordAuthentication=no $host -p $port -l $user 'echo -n 1'" + local ret=`ssh $sshoptions -o PasswordAuthentication=no $host -p $port -l $user 'echo -n 1'` if [ "$ret" = 1 ]; then debug "Connected to $host as $user successfully" else teststr="borg list --show-rc -v $execstr_repository" debug "$teststr" output=`su -c "$teststr" 2>&1` - if echo "$output" | grep "terminating with success status" ; then + if echo "$output" | grep "terminating with success status" \ + || echo "$output" | grep "^\S\+ is not a valid repository." \ + || echo "$output" | grep "^Repository \S\+ does not exist."; then debug "Connected to $host as $user successfully (forced command)" else - if echo "$output" | grep -E "Repository.+does not exist" ; then - debug "Connected to $host as $user successfully (forced command)" - else - fatal "Can't connect to $host as $user." - fi + error $output + fatal "Can't connect to $host as $user." fi fi fi @@ -83,6 +127,7 @@ fi if [ "$init" == "yes" ]; then initstr="borg init --encryption=$encryption $execstr_repository" + debug "executing borg init" debug "$initstr" if [ $test = 0 ]; then output="`su -c "$initstr" 2>&1`" @@ -124,22 +169,34 @@ if [ ! -z $bwlimit ]; then execstr="${execstr} --remote-ratelimit=${bwlimit}" fi -if [ ! -z $create_options ]; then +if [ ! -z "$create_options" ]; then execstr="${execstr} ${create_options}" fi # include client-part and server-part execstr="${execstr} ${excludes} $execstr_repository::$execstr_archive ${includes}" -debug "$execstr" + +debug "executing borg create" +debug "$nice $execstr" if [ $test = 0 ]; then - output=`nice -n $nicelevel su -c "$execstr" 2>&1` - if [ $? = 0 ]; then + output=`$nice su -c "$execstr" 2>&1` + ret=$? + if [ $ret = 0 ]; then debug $output - info "Successfully finished backing up source $label" + info "Successfully finished backing up source." + elif [ $ret = 1 ]; then + warnmsg=$(echo "$output" | @SED@ -n '1,/^-\+$/{x;p;d;}; x' | @SED@ '/^$/d') + if [ "$ignore_missing" = "yes" ] && ! echo "$warnmsg" | grep -qv '\[Errno 2\] No such file or directory:'; then + debug $output + info "Backing up source finished with missing file warnings." + else + warning $output + warning "Backing up source finished with warnings." + fi else error $output - fatal "Failed backuping up source $label" + fatal "Failed backing up source." fi fi @@ -151,19 +208,28 @@ if [ "$prune" == "yes" ]; then prune_options="${prune_options} --keep-within=${keep}" fi prunestr="borg prune $prune_options $execstr_repository" + debug "executing borg prune" debug "$prunestr" if [ $test = 0 ]; then output="`su -c "$prunestr" 2>&1`" - if [ $? = 0 ]; then + ret=$? + if [ $ret = 0 ]; then debug $output info "Removing old backups succeeded." - else + elif [ $ret = 1 ]; then warning $output - warning "Failed removing old backups." + warning "Removing old backups finished with warnings." + else + error $output + fatal "Failed removing old backups." fi fi fi +debug "unset BORG_PASSPHRASE" unset BORG_PASSPHRASE +debug "unset BORG_RSH" +unset BORG_RSH + return 0 diff --git a/handlers/dup.helper.in b/handlers/dup.helper.in index 7515623972edc24ef5e2b1df5479a2626da26070..775da64a1eae546031f84be147ffcef0b8f10ff3 100644 --- a/handlers/dup.helper.in +++ b/handlers/dup.helper.in @@ -30,35 +30,6 @@ do_dup_host_includes() { set +o noglob } -do_dup_vserver() { - # choose the vservers to backup (into $selected_vservers) - choose_one_or_more_vservers "$dup_title" - [ $? = 0 ] || return 1 - - set -o noglob - # choose the files to backup - REPLY= - while [ -z "$REPLY" ]; do - formBegin "$dup_title - vservers: vsincludes (backup these directories from every selected vserver)" - [ -z "$dup_vsincludes" ] && dup_vsincludes="$dup_default_includes" - for i in $dup_vsincludes; do - formItem include "$i" - done - formItem include "" - formItem include "" - formItem include "" - formItem include "" - formItem include "" - formItem include "" - formItem include "" - formItem include "" - formDisplay - [ $? = 0 ] || return 1 - dup_vsincludes="$REPLY" - done - set +o noglob -} - do_dup_excludes() { set -o noglob formBegin "$dup_title: excludes" @@ -80,35 +51,6 @@ do_dup_excludes() { set +o noglob } -do_dup_src() { - choose_host_or_vservers_or_both "$dup_title" - [ $? = 0 ] || return 1 - case $host_or_vservers in - 'host') - do_dup_host_includes - [ $? = 0 ] || return 1 - ;; - 'vservers') - do_dup_vserver - [ $? = 0 ] || return 1 - ;; - 'both') - do_dup_host_includes - [ $? = 0 ] || return 1 - do_dup_vserver - [ $? = 0 ] || return 1 - ;; - *) - return 1 - ;; - esac - do_dup_excludes - [ $? = 0 ] || return 1 - - _src_done="(DONE)" - setDefault dest -} - do_dup_dest() { local replyconverted @@ -259,6 +201,7 @@ do_dup_misc_options() { formBegin "$dup_title - misc. options" formItem "nicelevel" "$dup_nicelevel" + formItem "ionicelevel" "$dup_ionicelevel" formItem "testconnect" "$dup_testconnect" formItem "options" "$dup_options" formDisplay @@ -271,8 +214,9 @@ do_dup_misc_options() { IFS=$' \t\n' dup_nicelevel=${thereply[0]} - dup_testconnect=${thereply[1]} - dup_options=${thereply[2]} + dup_ionicelevel=${thereply[1]} + dup_testconnect=${thereply[2]} + dup_options=${thereply[3]} set +o noglob } @@ -294,6 +238,8 @@ options = $dup_options # default is 0, but set to 19 if you want to lower the priority. nicelevel = $dup_nicelevel +# by default (when value is empty), ionice will not be used. +ionicelevel = $dup_ionicelevel # default is yes. set to no to skip the test if the remote host is alive. # if 'desturl' is set below, 'testconnect' must be set to 'no' for now. @@ -362,7 +308,7 @@ signpassword = $dup_gpg_signpassword [source] # A few notes about includes and excludes: -# 1. include, exclude and vsinclude statements support globbing with '*' +# 1. include and exclude statements support globbing with '*' # 2. Symlinks are not dereferenced. Moreover, an include line whose path # contains, at any level, a symlink to a directory, will only have the # symlink backed-up, not the target directory's content. Yes, you have to @@ -380,43 +326,12 @@ signpassword = $dup_gpg_signpassword # files to include in the backup EOF - if [ "$host_or_vservers" == host -o "$host_or_vservers" == both ]; then - set -o noglob - for i in $dup_includes; do - echo "include = $i" >> $next_filename - done - set +o noglob - fi - - cat >> $next_filename <<EOF - -# If vservers = yes in /etc/backupninja.conf then the following variables can -# be used: -# vsnames = all | <vserver1> <vserver2> ... (default = all) -# vsinclude = <path> -# vsinclude = <path> -# ... -# Any path specified in vsinclude is added to the include list for each vserver -# listed in vsnames (or all if vsnames = all, which is the default). -# -# For example, vsinclude = /home will backup the /home directory in every -# vserver listed in vsnames. If you have 'vsnames = foo bar baz', this -# vsinclude will add to the include list /vservers/foo/home, /vservers/bar/home -# and /vservers/baz/home. -# Vservers paths are derived from $VROOTDIR. - -EOF - - if [ "$host_or_vservers" == vservers -o "$host_or_vservers" == both ]; then - set -o noglob - echo -e "vsnames = $selected_vservers\n" >> $next_filename - for i in $dup_vsincludes; do - echo "vsinclude = $i" >> $next_filename - done - set +o noglob - fi + set -o noglob + for i in $dup_includes; do + echo "include = $i" >> $next_filename + done + set +o noglob - # excludes cat >> $next_filename <<EOF # files to exclude from the backup @@ -522,6 +437,7 @@ bandwidthlimit = $dup_bandwidth ## ## Default: # sshoptions = +sshoptions = $dup_sshoptions # put the backups under this destination directory # if using 'desturl' above, this must not be set @@ -601,7 +517,6 @@ dup_wizard() { _adv_done= dup_includes= dup_excludes= - dup_vsincludes= dup_incremental=yes dup_increments=30 dup_keep=60 @@ -619,6 +534,7 @@ dup_wizard() { dup_gpg_password="" dup_gpg_signpassword="" dup_nicelevel=19 + dup_ionicelevel= dup_testconnect=yes dup_options= diff --git a/handlers/dup.in b/handlers/dup.in index d304ed16580c52a4df6cd0700280cb1507b6f245..88b9185f7680217dcf175d29d0c5f630ecfdd156 100644 --- a/handlers/dup.in +++ b/handlers/dup.in @@ -8,6 +8,7 @@ getconf options getconf testconnect yes getconf nicelevel 0 +getconf ionicelevel getconf tmpdir setsection gpg @@ -19,8 +20,6 @@ getconf signkey setsection source getconf include -getconf vsnames all -getconf vsinclude getconf exclude setsection dest @@ -47,18 +46,34 @@ destdir=${destdir%/} ### SANITY CHECKS ############################################################## -[ -n "$desturl" -o -n "$destdir" ] || fatal "The destination directory (destdir) must be set when desturl is not used." -[ -n "$include" -o -n "$vsinclude" ] || fatal "No source includes specified" +if [ -z "$desturl" ]; then + # desturl undefined, ensure desthost, destuser and destdir are set + [ -n "$desthost" ] || fatal "The destination host (desthost) must be set when desturl is not used." + [ -n "$destuser" ] || fatal "The destination user (destuser) must be set when desturl is not used." + [ -n "$destdir" ] || fatal "The destination directory (destdir) must be set when desturl is not used." +else + # desturl overrides other destination specifiers, warn if they are used + [ -z "$destuser" ] || warning 'the configured destuser is ignored since desturl is set' + [ -z "$desthost" ] || warning 'the configured desthost is ignored since desturl is set' + [ -z "$destdir" ] || warning 'the configured destdir is ignored since desturl is set' +fi + +[ -n "$include" ] || fatal "No source includes specified." + [ -n "$password" ] || fatal "The password option must be set." + if [ -n "$signkey" -a -n "$encryptkey" -a "$signkey" != "$encryptkey" ]; then [ -n "$signpassword" ] || fatal "The signpassword option must be set because signkey is different from encryptkey." fi + if [ "`echo $desturl | @AWK@ -F ':' '{print $1}'`" == "s3+http" ]; then [ -n "$awsaccesskeyid" -a -n "$awssecretaccesskey" ] || fatal "AWS access keys must be set for S3 backups." fi + if [ "`echo $desturl | @AWK@ -F ':' '{print $1}'`" == "cf+http" ]; then [ -n "$cfusername" -a -n "$cfapikey" ] || fatal "Cloudfiles access keys must be set for S3 backups." fi + if [ "`echo $desturl | @AWK@ -F ':' '{print $1}'`" == "dpbx" ]; then [ -n "$dropboxappkey" -a -n "$dropboxappsecret" ] || fatal "Dropbox app ID and secret must be set for Dropbox backups." @@ -69,49 +84,34 @@ if [ "`echo $desturl | @AWK@ -F ':' '{print $1}'`" == "dpbx" ]; then fi fi +# Ensure ftp_password is defined if needed if [ "`echo $desturl | @AWK@ -F ':' '{print $1}'`" == "ftp" ]; then [ -n "$ftp_password" ] || fatal "ftp_password must be set for FTP backups." fi -if [ "`echo $desturl | @AWK@ -F ':' '{print $1}'`" == "file" ]; then - if [ ! -e "`echo $desturl | @AWK@ -F '://' '{print $2}'`" ]; then - fatal "The destination directory ($desturl) does not exist." - elif [ ! -d "`echo $desturl | @AWK@ -F '://' '{print $2}'`" ]; then - fatal "The destination ($desturl) is not a directory." - fi + +# Check that the ionicelevel is valid +if [ -n "$ionicelevel" ] && echo "$ionicelevel" | grep -vq "^[0-7]$"; then + fatal "The value of ionicelevel is expected to be either empty or an integer from 0 to 7. Got: $ionicelevel" fi -### VServers -# If vservers are configured, check that the ones listed in $vsnames do exist. -usevserver=no -if [ $vservers_are_available = yes ]; then - if [ "$vsnames" = all ]; then - vsnames="$found_vservers" - else - if ! vservers_exist "$vsnames" ; then - fatal "At least one of the vservers listed in vsnames ($vsnames) does not exist." - fi - fi - if [ -n "$vsinclude" ]; then - info "Using vservers '$vsnames'" - usevserver=yes - fi -else - [ -z "$vsinclude" ] || warning 'vservers support disabled in backupninja.conf, vsincludes configuration lines will be ignored' +# Only use ionice if ionicelevel is not empty +nice="nice -n $nicelevel" +if [ -n "$ionicelevel" ]; then + nice="ionice -c2 -n $ionicelevel $nice" fi ### See if we can login on $desthost -if [ "$testconnect" == "yes" ]; then +[ -n "$test" ] || test=0 +if [ "$testconnect" == "yes" ] || [ "${test}" -eq 1 ]; then if [ -n "$desturl" ]; then warning 'testconnect can not be used when desturl is set' else debug "ssh $sshoptions -o PasswordAuthentication=no $desthost -l $destuser 'echo -n 1'" - if [ ! $test ]; then - result=`ssh $sshoptions -o PasswordAuthentication=no $desthost -l $destuser 'echo -n 1'` - if [ "$result" != "1" ]; then - fatal "Can't connect to $desthost as $destuser." - else - debug "Connected to $desthost as $destuser successfully" - fi + result=`ssh $sshoptions -o PasswordAuthentication=no $desthost -l $destuser 'echo -n 1'` + if [ "$result" != "1" ]; then + fatal "Can't connect to $desthost as $destuser." + else + debug "Connected to $desthost as $destuser successfully" fi fi fi @@ -124,9 +124,6 @@ execstr_command= execstr_options="$options --no-print-statistics" execstr_source= if [ -n "$desturl" ]; then - [ -z "$destuser" ] || warning 'the configured destuser is ignored since desturl is set' - [ -z "$desthost" ] || warning 'the configured desthost is ignored since desturl is set' - [ -z "$destdir" ] || warning 'the configured destdir is ignored since desturl is set' execstr_serverpart="$desturl" else execstr_serverpart="scp://$destuser@$desthost/$destdir" @@ -152,8 +149,11 @@ if version_ge "$duplicity_version" '0.6.17'; then fi execstr_options="${execstr_options} --ssh-options '$sshoptions'" if [ "$bandwidthlimit" != 0 ]; then - [ -z "$desturl" ] || warning 'The bandwidthlimit option is not used when desturl is set.' - execstr_precmd="trickle -s -d $bandwidthlimit -u $bandwidthlimit" + if [ "`echo $desturl | @AWK@ -F ':' '{print $1}'`" == "file" ]; then + warning 'The bandwidthlimit option is not used with a local file path destination.' + else + execstr_precmd="trickle -s -d $bandwidthlimit -u $bandwidthlimit" + fi fi ## duplicity < 0.6.17 : scp/sftp backend else @@ -166,24 +166,29 @@ else execstr_options="${execstr_options} --scp-command 'scp $scpoptions' --sftp-command 'sftp $sftpoptions'" fi -### Symmetric or asymmetric (public/private key pair) encryption +### Encryption and signing if [ -n "$encryptkey" ]; then - execstr_options="${execstr_options} --encrypt-key $encryptkey" - debug "Data will be encrypted with the GnuPG key $encryptkey." -else - debug "Data will be encrypted using symmetric encryption." -fi - -### Data signing (or not) -if [ "$sign" == yes ]; then + if [ "$sign" = yes ]; then + if [ -n "$signkey" -a "$encryptkey" != "$signkey" ]; then + # encryptkey and signkey are different + debug "Data will be encrypted with the GnuPG key $encryptkey." + debug "Data will be signed with the GnuPG key $signkey." + execstr_options="${execstr_options} --encrypt-key $encryptkey --sign-key $signkey" + else + # encryptkey and signkey identical + debug "Data will be encrypted ang signed with the GnuPG key $encryptkey." + execstr_options="${execstr_options} --encrypt-sign-key $encryptkey" + fi + else + execstr_options="${execstr_options} --encrypt-key $encryptkey" + debug "Data will be encrypted with the GnuPG key $encryptkey." + debug "Data won't be signed." + fi +elif [ "$sign" == yes ]; then # duplicity is not able to sign data when using symmetric encryption - [ -n "$encryptkey" ] || fatal "The encryptkey option must be set when signing." - # if needed, initialize signkey to a value that is not empty (checked above) - [ -n "$signkey" ] || signkey="$encryptkey" - execstr_options="${execstr_options} --sign-key $signkey" - debug "Data will be signed will the GnuPG key $signkey." + fatal "The encryptkey option must be set when signing." else - debug "Data won't be signed." + debug "Data will be encrypted using symmetric encryption." fi ### Incremental or full backup mode @@ -259,20 +264,6 @@ for i in $include; do done IFS=$SAVEIFS -# vsincludes -if [ $usevserver = yes ]; then - for vserver in $vsnames; do - SAVEIFS=$IFS - IFS=$(echo -en "\n\b") - for vi in $vsinclude; do - str="${vi//__star__/*}" - str="$VROOTDIR/$vserver$str" - execstr_source="${execstr_source} --include '$str'" - done - IFS=$SAVEIFS - done -fi - set +o noglob ### EXECUTE #################################################################### @@ -305,13 +296,13 @@ fi ### Cleanup commands (duplicity >= 0.4.4) # cleanup -debug "$execstr_precmd duplicity cleanup --force $execstr_options $execstr_serverpart" -if [ ! $test ]; then +debug "executing duplicity cleanup" +debug "$nice $execstr_precmd duplicity cleanup --force $execstr_options $execstr_serverpart" +if [ $test = 0 ]; then export PASSPHRASE=$password export SIGN_PASSPHRASE=$signpassword export FTP_PASSWORD=$ftp_password - output=`nice -n $nicelevel \ - su -c \ + output=`$nice su -c \ "$execstr_precmd duplicity cleanup --force $execstr_options $execstr_serverpart 2>&1"` exit_code=$? if [ $exit_code -eq 0 ]; then @@ -325,13 +316,13 @@ fi # remove-older-than if [ "$keep" != "yes" ]; then - debug "$execstr_precmd duplicity remove-older-than $keep --force $execstr_options $execstr_serverpart" + debug "executing duplicity remove-older-than" + debug "$nice $execstr_precmd duplicity remove-older-than $keep --force $execstr_options $execstr_serverpart" if [ ! $test ]; then export PASSPHRASE=$password export SIGN_PASSPHRASE=$signpassword export FTP_PASSWORD=$ftp_password - output=`nice -n $nicelevel \ - su -c \ + output=`$nice su -c \ "$execstr_precmd duplicity remove-older-than $keep --force $execstr_options $execstr_serverpart 2>&1"` exit_code=$? if [ $exit_code -eq 0 ]; then @@ -348,13 +339,13 @@ fi if [ "$keep" != "yes" ]; then if [ "$keepincroffulls" != "all" ]; then if version_ge "$duplicity_version" '0.6.10'; then - debug "$execstr_precmd duplicity remove-all-inc-of-but-n-full $keepincroffulls --force $execstr_options $execstr_serverpart" - if [ ! $test ]; then + debug "executing duplicity remove-all-inc-of-but-n-full" + debug "$nice $execstr_precmd duplicity remove-all-inc-of-but-n-full $keepincroffulls --force $execstr_options $execstr_serverpart" + if [ $test = 0 ]; then export PASSPHRASE=$password export SIGN_PASSPHRASE=$signpassword export FTP_PASSWORD=$ftp_password - output=`nice -n $nicelevel \ - su -c \ + output=`$nice su -c \ "$execstr_precmd duplicity remove-all-inc-of-but-n-full $keepincroffulls --force $execstr_options $execstr_serverpart 2>&1"` exit_code=$? if [ $exit_code -eq 0 ]; then @@ -370,14 +361,14 @@ if [ "$keep" != "yes" ]; then fi ### Backup command -debug "$execstr_precmd duplicity $execstr_command $execstr_options $execstr_source --exclude '**' / $execstr_serverpart" -if [ ! $test ]; then +debug "executing duplicity" +debug "$nice $execstr_precmd duplicity $execstr_command $execstr_options $execstr_source --exclude '**' / $execstr_serverpart" +if [ $test = 0 ]; then outputfile=`maketemp backupout` export PASSPHRASE=$password export SIGN_PASSPHRASE=$signpassword export FTP_PASSWORD=$ftp_password - output=`nice -n $nicelevel \ - su -c \ + output=`$nice su -c \ "$execstr_precmd duplicity $execstr_command $execstr_options $execstr_source --exclude '**' / $execstr_serverpart >$outputfile 2>&1"` exit_code=$? debug "$output" diff --git a/handlers/makecd.in b/handlers/makecd.in index a45259e81e68fbc386d7833be260550d1b7ab49e..38311d5e6c340af92543658668af9a33ed7f20b3 100644 --- a/handlers/makecd.in +++ b/handlers/makecd.in @@ -12,6 +12,20 @@ getconf isoonly yes getconf imagefile backup.iso getconf device getconf nicelevel 0 +getconf ionicelevel + +## Check config + +# Check that the ionicelevel is valid +if [ -n "$ionicelevel" ] && echo "$ionicelevel" | grep -vq "^[0-7]$"; then + fatal "The value of ionicelevel is expected to be either empty or an integer from 0 to 7. Got: $ionicelevel" +fi + +# Only use ionice if ionicelevel is not empty +nice="nice -n $nicelevel" +if [ -n "$ionicelevel" ]; then + nice="ionice -c2 -n $ionicelevel $nice" +fi # define needed executables: MKISOFS="/usr/bin/genisoimage" @@ -36,7 +50,7 @@ if [ "$isoonly" == "no" ]; then fi outputfile="$backupdir/$imagefile" -execstr="nice -n $nicelevel $MKISOFS --quiet -R -o $outputfile " +execstr="$nice $MKISOFS --quiet -R -o $outputfile " str="" # excludes diff --git a/handlers/mysql.helper.in b/handlers/mysql.helper.in index 997f73c0a8ebe4bf40c0e02f5de6e6859a818901..d17a747c53c982823b614fa8241852df2a840b8f 100644 --- a/handlers/mysql.helper.in +++ b/handlers/mysql.helper.in @@ -3,12 +3,6 @@ HELPERS="$HELPERS mysql:mysql_database_backup" -do_mysql_vserver() { - choose_one_vserver "$mysql_title" - [ $? = 0 ] || return 1 - mysql_vsname="vsname = $REPLY" -} - do_mysql_databases() { REPLY= while [ -z "$REPLY" ]; do @@ -56,15 +50,15 @@ do_mysql_user() { do_mysql_final() { if [ -z "$_DISABLE_HOTCOPY" ]; then checkBox "$mysql_title" "check options" \ - "sqldump" "create a backup using mysqldump (more compat)." no \ - "hotcopy" "create a backup using mysqlhotcopy (faster)." yes \ - "compress" "compress the sql output files" yes + "sqldump" "create a backup using mysqldump (more compat)." off \ + "hotcopy" "create a backup using mysqlhotcopy (faster)." on \ + "compress" "compress the sql output files" on status=$? sqldump="sqldump = no" hotcopy="hotcopy = no" else checkBox "$mysql_title" "check options" \ - "compress" "compress the sql output files" yes + "compress" "compress the sql output files" on status=$? sqldump="sqldump = yes" hotcopy="hotcopy = no" @@ -75,9 +69,9 @@ do_mysql_final() { compress="compress = no" for opt in $result; do case $opt in - '"sqldump"') sqldump="sqldump = yes";; - '"hotcopy"') hotcopy="hotcopy = yes";; - '"compress"') compress="compress = yes";; + 'sqldump') sqldump="sqldump = yes";; + 'hotcopy') hotcopy="hotcopy = yes";; + 'compress') compress="compress = yes";; esac done get_next_filename $configdirectory/20.mysql @@ -121,20 +115,6 @@ $mysql_databases EOF -if [ $host_or_vservers == vservers ] - then - cat >> $next_filename <<EOF -# -# vsname = <vserver> (no default) -# vsname indicates which vserver to operate on, this is only used if -# vserver is set to yes in /etc/backupninja.conf -# NOTE: if you do not specify a vsname the host will be operated on -# alsoNOTE: if operating on a vserver, $VROOTDIR will be -# prepended to backupdir. -EOF - echo -e "$mysql_vsname\n" >> $next_filename -fi - echo -e $@ >> $next_filename chmod 600 $next_filename @@ -145,22 +125,8 @@ mysql_wizard() { # Global variables mysql_title="MySQL action wizard" - # backup the host system or a Vserver? - choose_host_or_one_vserver "$mysql_title" - [ $? = 0 ] || return 1 - if [ $host_or_vservers == vservers ] - then - do_mysql_vserver - [ $? = 0 ] || return 1 - fi - # backupdir - if [ $host_or_vservers == vservers ] - then - inputBox "$mysql_title" "Directory where to store the backups:`echo \"\n(Relative to chosen vserver's root directory)\"`" "/var/backups/mysql" - else - inputBox "$mysql_title" "Directory where to store the backups" "/var/backups/mysql" - fi + inputBox "$mysql_title" "Directory where to store the backups" "/var/backups/mysql" [ $? = 1 ] && return mysql_backupdir="backupdir = $REPLY" diff --git a/handlers/mysql.in b/handlers/mysql.in index e7931518e79c936ad3081ade414410fb361ee547..f57b315f377690e34ef65d1295fed8928863bb78 100644 --- a/handlers/mysql.in +++ b/handlers/mysql.in @@ -13,7 +13,6 @@ getconf hotcopy no getconf sqldump no getconf sqldumpoptions "--lock-tables --complete-insert --add-drop-table --quick --quote-names" getconf compress yes -getconf vsname # authentication: getconf user @@ -22,27 +21,6 @@ getconf dbpassword getconf configfile /etc/mysql/debian.cnf -# Decide if the handler should operate on a vserver or on the host. -# In the former case, check that $vsname exists and is running. -usevserver=no -vroot='' -if [ $vservers_are_available = yes ]; then - if [ -n "$vsname" ]; then - # does it exist ? - if ! vservers_exist "$vsname" ; then - fatal "The vserver given in vsname ($vsname) does not exist." - fi - # is it running ? - vservers_running $vsname || fatal "The vserver $vsname is not running." - # everything ok - info "Using vserver '$vsname'." - usevserver=yes - vroot="$VROOTDIR/$vsname" - else - info "No vserver name specified, actions will be performed on the host." - fi -fi - ## Prepare ignore part of the command ## This only works for mysqldump at the moment @@ -51,21 +29,15 @@ for i in $ignores $nodata; do ignore="$ignore --ignore-table=$i" done -# create backup dirs, $vroot will be empty if no vsname was specified +# create backup dirs # and we will instead proceed to operate on the host -[ -d $vroot$backupdir ] || mkdir -p $vroot$backupdir -[ -d $vroot$backupdir ] || fatal "Backup directory '$vroot$backupdir'" +[ -d $backupdir ] || mkdir -p $backupdir +[ -d $backupdir ] || fatal "Backup directory '$backupdir'" hotdir="$backupdir/hotcopy" dumpdir="$backupdir/sqldump" -if [ $usevserver = yes ] -then - [ "$sqldump" == "no" -o -d $vroot$dumpdir ] || $VSERVER $vsname exec mkdir -p $dumpdir - [ "$hotcopy" == "no" -o -d $vroot$hotdir ] || $VSERVER $vsname exec mkdir -p $hotdir -else - [ "$sqldump" == "no" -o -d $dumpdir ] || mkdir -p $dumpdir - [ "$hotcopy" == "no" -o -d $hotdir ] || mkdir -p $hotdir -fi +[ "$sqldump" == "no" -o -d $dumpdir ] || mkdir -p $dumpdir +[ "$hotcopy" == "no" -o -d $hotdir ] || mkdir -p $hotdir ####################################################################### ## AUTHENTICATION @@ -88,23 +60,13 @@ defaultsfile="" if [ -n "$dbusername" -a -n "$dbpassword" ] then - if [ $usevserver = yes ] - then - home=`$VSERVER $vsname exec getent passwd "root" | @AWK@ -F: '{print $6}'` - else - home=`getent passwd "root" | @AWK@ -F: '{print $6}'` - fi + home=`getent passwd "root" | @AWK@ -F: '{print $6}'` [ -d $home ] || fatal "Can't find root's home directory ($home)." mycnf="$home/.my.cnf" - if [ $usevserver = yes ] - then - workcnf="$vroot$mycnf" - else - workcnf="$mycnf" - fi + workcnf="$mycnf" if [ -f $workcnf ] then @@ -145,28 +107,18 @@ EOF elif [ -n "$user" ] then userset=true; - if [ $usevserver = yes ] + + userhome=`getent passwd "$user" | @AWK@ -F: '{print $6}'` + if [ $? -eq 2 ] then - userhome=`$VSERVER $vsname exec getent passwd "$user" | @AWK@ -F: '{print $6}'` - if [ $? -eq 2 ] - then - fatal "User $user not found in /etc/passwd" - fi - debug "User home set to: $vroot$userhome" - [ -f $vroot$userhome/.my.cnf ] || fatal "Can't find config file in $userhome/.my.cnf" - else - userhome=`getent passwd "$user" | @AWK@ -F: '{print $6}'` - if [ $? -eq 2 ] - then - fatal "User $user not found in /etc/passwd" - fi - debug "User home set to: $userhome" - [ -f $userhome/.my.cnf ] || fatal "Can't find config file in $userhome/.my.cnf" + fatal "User $user not found in /etc/passwd" fi - + debug "User home set to: $userhome" + [ -f $userhome/.my.cnf ] || fatal "Can't find config file in $userhome/.my.cnf" + defaultsfile="--defaults-extra-file=$userhome/.my.cnf" debug "using $defaultsfile" -# otherwise use $configfile + # otherwise use $configfile else user=root defaultsfile="--defaults-extra-file=$configfile" @@ -180,13 +132,7 @@ then info "Initializing hotcopy method" if [ "$databases" == "all" ] then - if [ $usevserver = yes ] - then - info "dbhost: $dbhost" - execstr="$VSERVER $vsname exec $MYSQLHOTCOPY -h $dbhost --quiet --allowold --regexp /.\*/./.\*/ $hotdir" - else - execstr="$MYSQLHOTCOPY --quiet --allowold --regexp /.\*/./.\*/ $hotdir" - fi + execstr="$MYSQLHOTCOPY --quiet --allowold --regexp /.\*/./.\*/ $hotdir" debug "su $user -c \"$execstr\"" if [ ! $test ] then @@ -204,12 +150,7 @@ then else for db in $databases do - if [ $usevserver = yes ] - then - execstr="$VSERVER $vsname exec $MYSQLHOTCOPY --allowold $db $hotdir" - else - execstr="$MYSQLHOTCOPY --allowold $db $hotdir" - fi + execstr="$MYSQLHOTCOPY --allowold $db $hotdir" debug 'su $user -c \"$execstr\"' if [ ! $test ] then @@ -236,20 +177,10 @@ then info "Initializing SQL dump method" if [ "$databases" == "all" ] then - if [ $usevserver = yes ] + databases=$(set -o pipefail ; su $user -c "$MYSQL $defaultsfile -N -B -e 'show databases'" | sed 's/|//g;/\+----/d;/^\(information\|performance\)_schema$/d') + if [ $? -ne 0 ] then - debug 'set -o pipefail ; echo show databases | $VSERVER $vsname exec su $user -c \"$MYSQL $defaultsfile\" | grep -v Database | grep -v '"'"'^\(information\|performance\)_schema$'"'" - databases=`set -o pipefail ; echo 'show databases' | $VSERVER $vsname exec su $user -c "$MYSQL $defaultsfile" | grep -v Database | grep -v '^\(information\|performance\)_schema$'` - if [ $? -ne 0 ] - then - fatal "Authentication problem, maybe user/password is wrong or mysqld is not running?" - fi - else - databases=$(set -o pipefail ; su $user -c "$MYSQL $defaultsfile -N -B -e 'show databases'" | sed 's/|//g;/\+----/d;/^\(information\|performance\)_schema$/d') - if [ $? -ne 0 ] - then - fatal "Authentication problem, maybe user/password is wrong or mysqld is not running?" - fi + fatal "Authentication problem, maybe user/password is wrong or mysqld is not running?" fi fi @@ -275,31 +206,19 @@ then done DUMP="( $DUMP; $DUMP_STRUCT )" fi - if [ $usevserver = yes ] - then - # Test to make sure mysqld is running, if it is not sqldump will not work - $VSERVER $vsname exec su $user -c "$MYSQLADMIN $defaultsfile ping 2>&1 >/dev/null" - if [ $? -ne 0 ]; then - fatal "mysqld doesn't appear to be running!" - fi - if [ "$compress" == "yes" ]; then - execstr="$VSERVER $vsname exec $DUMP | $GZIP $GZIP_OPTS > '$vroot$dumpdir/${db}.sql.gz'" - else - execstr="$VSERVER $vsname exec $DUMP -r '$vroot$dumpdir/${db}.sql'" - fi + + # Test to make sure mysqld is running, if it is not sqldump will not work + su $user -c "$MYSQLADMIN $defaultsfile ping 2>&1 >/dev/null" + if [ $? -ne 0 ]; then + fatal "mysqld doesn't appear to be running!" + fi + if [ "$compress" == "yes" ]; then + execstr="$DUMP | $GZIP $GZIP_OPTS > '$dumpdir/${db}.sql.gz'" else - # Test to make sure mysqld is running, if it is not sqldump will not work - su $user -c "$MYSQLADMIN $defaultsfile ping 2>&1 >/dev/null" - if [ $? -ne 0 ]; then - fatal "mysqld doesn't appear to be running!" - fi - if [ "$compress" == "yes" ]; then - execstr="$DUMP | $GZIP $GZIP_OPTS > '$dumpdir/${db}.sql.gz'" - else - execstr="$DUMP > '$dumpdir/${db}.sql'" - fi + execstr="$DUMP > '$dumpdir/${db}.sql'" fi debug "su $user -c \"$execstr\"" + if [ ! $test ] then output=`su $user -s /bin/bash -c "set -o pipefail ; $execstr" 2>&1` diff --git a/handlers/pgsql.helper.in b/handlers/pgsql.helper.in index 82e6b485d660b5fe2fa800aa67624b5d79a90961..89a8c77a0ae7e81e3e0b68d24254a879765881b5 100644 --- a/handlers/pgsql.helper.in +++ b/handlers/pgsql.helper.in @@ -3,12 +3,6 @@ HELPERS="$HELPERS pgsql:postgresql_database_backup" -do_pgsql_vserver() { - choose_one_vserver "$pgsql_title" - [ $? = 0 ] || return 1 - pgsql_vsname="vsname = $REPLY" -} - do_pgsql_databases() { REPLY= while [ -z "$REPLY" ]; do @@ -37,16 +31,8 @@ pgsql_wizard() { # constants pgsql_title="PostgreSQL action wizard" - # backup the host system or a Vserver? - choose_host_or_one_vserver "$pgsql_title" - [ $? = 0 ] || return 1 - if [ $host_or_vservers == vservers ]; then - do_pgsql_vserver - [ $? = 0 ] || return 1 - fi - # backupdir - inputBox "$pgsql_title" "Directory where to store the backups:`[ -z \"$pgsql_vsname\" ] || echo \"\n(In respect to chosen vserver's root directory)\"`" "/var/backups/postgres" + inputBox "$pgsql_title" "Directory where to store the backups:" "/var/backups/postgres" [ $? = 1 ] && return pgsql_backupdir="backupdir = $REPLY" @@ -87,16 +73,6 @@ pgsql_wizard() { cat >> $next_filename <<EOF ### backupninja PostgreSQL config file ### -# vsname = <vserver> (no default) -# what vserver to operate on, only used if vserver = yes in /etc/backupninja.conf -# if you do not specify a vsname the host will be operated on -# Note: if operating on a vserver, $VROOTDIR will be prepended to backupdir. -EOF - if [ $host_or_vservers == vservers ]; then - echo -e "$pgsql_vsname\n" >> $next_filename - fi - - cat >> $next_filename <<EOF # backupdir = <dir> (default: /var/backups/postgres) # where to dump the backups $pgsql_backupdir diff --git a/handlers/pgsql.in b/handlers/pgsql.in index 31a2168b66011ff9150c598859079c9aea2f196a..7669a3c4e9a248b5116d801fd1662117dacca184 100644 --- a/handlers/pgsql.in +++ b/handlers/pgsql.in @@ -7,85 +7,39 @@ getconf backupdir /var/backups/postgres getconf databases all getconf compress yes -getconf vsname # format maps to pg_dump --format= option, old/default was plain getconf format plain localhost=`hostname` -# Decide if the handler should operate on a vserver or on the host. -# In the former case, check that $vsname exists and is running. -usevserver=no -vroot='' -if [ $vservers_are_available = yes ]; then - if [ -n "$vsname" ]; then - # does it exist ? - if ! vservers_exist "$vsname" ; then - fatal "The vserver given in vsname ($vsname) does not exist." - fi - # is it running ? - vservers_running $vsname || fatal "The vserver $vsname is not running." - # everything ok - info "Using vserver '$vsname'." - usevserver=yes - vroot="$VROOTDIR/$vsname" - else - info "No vserver name specified, actions will be performed on the host." - fi -fi - # Make sure that the system to backup has the needed executables -if [ $usevserver = yes ]; then - debug "Examining vserver '$vsname'." - if [ "$databases" == "all" ] && [ "$format" = "plain" ]; then - [ -x "$vroot`$VSERVER $vsname exec which $PGSQLDUMPALL`" ] || \ - fatal "Can't find $PGSQLDUMPALL in vserver $vsname." - elif [ "$format" != "plain" ]; then - [ -x "$vroot`$VSERVER $vsname exec which $PGSQLDUMPALL`" ] || \ - fatal "Can't find $PGSQLDUMPALL in vserver $vsname." - [ -x "$vroot`$VSERVER $vsname exec which $PGSQLDUMP`" ] || \ - fatal "Can't find $PGSQLDUMP in vserver $vsname." - [ -x "$vroot`$VSERVER $vsname exec which $PSQL`" ] || \ - fatal "Can't find $PSQL in vserver $vsname." - else - [ -x "$vroot`$VSERVER $vsname exec which $PGSQLDUMP`" ] || \ - fatal "Can't find $PGSQLDUMP in vserver $vsname." - fi +if [ "$databases" == "all" ] && [ "$format" = "plain" ]; then + [ -x "`which $PGSQLDUMPALL`" ] || \ + fatal "Can't find $PGSQLDUMPALL." +elif [ "$format" != "plain" ]; then + [ -x "`which $PGSQLDUMPALL`" ] || \ + fatal "Can't find $PGSQLDUMPALL." + [ -x "`which $PGSQLDUMP`" ] || \ + fatal "Can't find $PGSQLDUMP." + [ -x "`which $PSQL`" ] || \ + fatal "Can't find $PSQL." else - if [ "$databases" == "all" ] && [ "$format" = "plain" ]; then - [ -x "`which $PGSQLDUMPALL`" ] || \ - fatal "Can't find $PGSQLDUMPALL." - elif [ "$format" != "plain" ]; then - [ -x "`which $PGSQLDUMPALL`" ] || \ - fatal "Can't find $PGSQLDUMPALL." - [ -x "`which $PGSQLDUMP`" ] || \ - fatal "Can't find $PGSQLDUMP." - [ -x "`which $PSQL`" ] || \ - fatal "Can't find $PSQL." - else - [ -x "`which $PGSQLDUMP`" ] || \ - fatal "Can't find $PGSQLDUMP." - fi + [ -x "`which $PGSQLDUMP`" ] || \ + fatal "Can't find $PGSQLDUMP." fi -# create backup dir, the vroot variable will be empty if no vsname was specified -# and will proceed to operate on the host -[ -d $vroot$backupdir ] || (debug "mkdir -p $vroot$backupdir"; mkdir -p $vroot$backupdir) -[ -d $vroot$backupdir ] || fatal "Backup directory '$vroot$backupdir' does not exist, and could not be created." +# create backup dir +[ -d $backupdir ] || (debug "mkdir -p $backupdir"; mkdir -p $backupdir) +[ -d $backupdir ] || fatal "Backup directory '$backupdir' does not exist, and could not be created." # give backup dir the good uid and permissions -# (in respect to the vserver, if $usevserver = yes) -if [ $usevserver = yes ]; then - pguid=`$VSERVER $vsname exec getent passwd $PGSQLUSER | @AWK@ -F: '{print $3}'` -else - pguid=`getent passwd $PGSQLUSER | @AWK@ -F: '{print $3}'` -fi -[ -n "$pguid" ] || \ - fatal "No user called $PGSQLUSER`[ $usevserver = no ] || echo \" on vserver $vsname\"`." -debug "chown $pguid $vroot$backupdir" -chown $pguid $vroot$backupdir -debug "chmod 700 $vroot$backupdir" -chmod 700 $vroot$backupdir +pguid=`getent passwd $PGSQLUSER | @AWK@ -F: '{print $3}'` +[ -n "$pguid" ] || fatal "No user called $PGSQLUSER." + +debug "chown $pguid $backupdir" +chown $pguid $backupdir +debug "chmod 700 $backupdir" +chmod 700 $backupdir # If we are using the custom (best) or tar pg_dump format, and @@ -93,11 +47,7 @@ chmod 700 $vroot$backupdir # of all non-template databases to avoid the use of pg_dumpall. dumpglobals="no" if [ "$databases" = "all" ] && [ "$format" != "plain" ]; then - cmdprefix="" - if [ "$usevserver" = "yes" ]; then - cmdprefix="$VSERVER $vsname exec " - fi - execstr="${cmdprefix} su - $PGSQLUSER -c 'psql -AtU $PGSQLUSER -c \"SELECT datname FROM pg_database WHERE NOT datistemplate\"'" + execstr="su - $PGSQLUSER -c 'psql -AtU $PGSQLUSER -c \"SELECT datname FROM pg_database WHERE NOT datistemplate\"'" debug execstr dblist="" for db in $(eval $execstr 2>&1); do @@ -113,18 +63,10 @@ fi # if $databases = all, use pg_dumpall if [ "$databases" == "all" ]; then - if [ $usevserver = yes ]; then - if [ "$compress" == "yes" ]; then - execstr="$VSERVER $vsname exec su - $PGSQLUSER -s /bin/bash -c \"set -o pipefail ; $PGSQLDUMPALL | $GZIP $GZIP_OPTS > '$backupdir/${vsname}.sql.gz'\"" - else - execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$PGSQLDUMPALL > '$backupdir/${vsname}.sql'\"" - fi + if [ "$compress" == "yes" ]; then + execstr="su - $PGSQLUSER -s /bin/bash -c \"set -o pipefail ; $PGSQLDUMPALL | $GZIP $GZIP_OPTS > '$backupdir/${localhost}-all.sql.gz'\"" else - if [ "$compress" == "yes" ]; then - execstr="su - $PGSQLUSER -s /bin/bash -c \"set -o pipefail ; $PGSQLDUMPALL | $GZIP $GZIP_OPTS > '$backupdir/${localhost}-all.sql.gz'\"" - else - execstr="su - $PGSQLUSER -c \"$PGSQLDUMPALL > '$backupdir/${localhost}-all.sql'\"" - fi + execstr="su - $PGSQLUSER -c \"$PGSQLDUMPALL > '$backupdir/${localhost}-all.sql'\"" fi debug "$execstr" if [ ! $test ]; then @@ -151,11 +93,7 @@ else else globalscmd="$PGSQLDUMPALL -g > '$backupdir/globals.sql'" fi - if [ $usevserver = yes ]; then - execstr="$VSERVER $vsname exec su - $PGSQLUSER -s /bin/bash -c \"$globalscmd\"" - else - execstr="su - $PGSQLUSER -s /bin/bash -c \"$globalscmd\"" - fi + execstr="su - $PGSQLUSER -s /bin/bash -c \"$globalscmd\"" debug "$execstr" if [ ! $test ]; then output=`eval $execstr 2>&1` @@ -188,11 +126,7 @@ else else dumpcmd="$PGSQLDUMP --format=$format ${disablecustomcompress} $db > '$backupdir/${db}.${dumpext}'" fi - if [ $usevserver = yes ]; then - execstr="$VSERVER $vsname exec su - $PGSQLUSER -s /bin/bash -c \"$dumpcmd\"" - else - execstr="su - $PGSQLUSER -s /bin/bash -c \"$dumpcmd\"" - fi + execstr="su - $PGSQLUSER -s /bin/bash -c \"$dumpcmd\"" debug "$execstr" if [ ! $test ]; then output=`eval $execstr 2>&1` diff --git a/handlers/rdiff.helper.in b/handlers/rdiff.helper.in index e2ddc46a0545a416a61e904026a5452790b6c6f8..324915b6eb2f672b6898050ba74b0cb278f4face 100644 --- a/handlers/rdiff.helper.in +++ b/handlers/rdiff.helper.in @@ -5,8 +5,6 @@ HELPERS="$HELPERS rdiff:incremental_remote_filesystem_backup" declare -a rdiff_includes declare -a rdiff_excludes -declare -a rdiff_vsincludes -declare -a rdiff_vsexcludes # FUNCTIONS @@ -35,38 +33,6 @@ do_rdiff_host_includes() { set +o noglob } -do_rdiff_vserver() { - # choose the vservers to backup (into $selected_vservers) - choose_one_or_more_vservers "$rdiff_title" - [ $? = 0 ] || return 1 - - set -o noglob - # choose the files to backup - REPLY= - - while [ -z "$REPLY" ]; do - formBegin "$rdiff_title - vsincludes (backup these directories from every vserver)" - [ -z "$rdiff_vsincludes" ] && rdiff_vsincludes="$rdiff_default_includes" - - for i in $rdiff_vsincludes; do - formItem include "$i" - done - formItem include "" - formItem include "" - formItem include "" - formItem include "" - formItem include "" - formItem include "" - formItem include "" - formItem include "" - formDisplay - [ $? = 0 ] || return 1 - rdiff_vsincludes=($REPLY) - done - - set +o noglob -} - do_rdiff_excludes() { set -o noglob formBegin "$rdiff_title: excludes" @@ -90,27 +56,8 @@ do_rdiff_excludes() { } do_rdiff_src() { - choose_host_or_vservers_or_both "$rdiff_title" + do_rdiff_host_includes [ $? = 0 ] || return 1 - case $host_or_vservers in - 'host') - do_rdiff_host_includes - [ $? = 0 ] || return 1 - ;; - 'vservers') - do_rdiff_vserver - [ $? = 0 ] || return 1 - ;; - 'both') - do_rdiff_host_includes - [ $? = 0 ] || return 1 - do_rdiff_vserver - [ $? = 0 ] || return 1 - ;; - *) - return 1 - ;; - esac do_rdiff_excludes [ $? = 0 ] || return 1 _src_done="(DONE)" @@ -314,7 +261,7 @@ type = local keep = $rdiff_keep # A few notes about includes and excludes: -# 1. include, exclude and vsinclude statements support globbing with '*' +# 1. include and exclude statements support globbing with '*' # 2. Symlinks are not dereferenced. Moreover, an include line whose path # contains, at any level, a symlink to a directory, will only have the # symlink backed-up, not the target directory's content. Yes, you have to @@ -332,40 +279,11 @@ keep = $rdiff_keep # files to include in the backup EOF ## includes ## - if [ "$host_or_vservers" == host -o "$host_or_vservers" == both ]; then - set -o noglob - for ((i=0; i < ${#rdiff_includes[@]} ; i++)); do - echo "include = ${rdiff_includes[$i]}" >> $next_filename - done - set +o noglob - fi - - if [ "$host_or_vservers" == vservers -o "$host_or_vservers" == both ]; then - cat >> $next_filename <<EOF -# -# If vservers = yes in /etc/backupninja.conf then the following variables can -# be used: -# vsnames = all | <vserver1> <vserver2> ... (default = all) -# vsinclude = <path> -# vsinclude = <path> -# ... -# Any path specified in vsinclude is added to the include list for each vserver -# listed in vsnames (or all if vsnames = all, which is the default). -# -# For example, vsinclude = /home will backup the /home directory in every -# vserver listed in vsnames. If you have 'vsnames = foo bar baz', this -# vsinclude will add to the include list /vservers/foo/home, /vservers/bar/home -# and /vservers/baz/home. -# Vservers paths are derived from $VROOTDIR. - -EOF - set -o noglob - echo -e "vsnames = $selected_vservers\n" >> $next_filename - for i in $rdiff_vsincludes; do - echo "vsinclude = $i" >> $next_filename - done - set +o noglob - fi + set -o noglob + for ((i=0; i < ${#rdiff_includes[@]} ; i++)); do + echo "include = ${rdiff_includes[$i]}" >> $next_filename + done + set +o noglob ## excludes ## set -o noglob @@ -439,7 +357,6 @@ rdiff_wizard() { set -o noglob rdiff_includes=(/var/spool/cron/crontabs /var/backups /etc /root /home /usr/local/*bin /var/lib/dpkg/status*) rdiff_excludes=(/home/*/.gnupg /home/*/.local/share/Trash /home/*/.Trash /home/*/.thumbnails /home/*/.beagle /home/*/.aMule /home/*/gtk-gnutella-downloads /var/cache/backupninja/duplicity) - rdiff_vsincludes= set +o noglob rdiff_main_menu diff --git a/handlers/rdiff.in b/handlers/rdiff.in index 2a06d2ec8cecd0dd13aa8fd32d83f8c41ae6e847..96b02e708a565daf8eb7ebe4da4f38b3b9346a5a 100644 --- a/handlers/rdiff.in +++ b/handlers/rdiff.in @@ -66,7 +66,7 @@ function check_consistency() { fatal "User must be specified for remote $section." fi if [ "$host" == "" ]; then - fatal "Host must be specifed for remote $section." + fatal "Host must be specified for remote $section." fi fi } @@ -83,6 +83,7 @@ function check_cstream() { getconf options getconf testconnect yes getconf nicelevel 0 +getconf ionicelevel getconf bwlimit getconf ignore_version no getconf output_as_info no @@ -95,10 +96,9 @@ check_consistency "source" "$type" "$user" "$host" getconf label getconf keep 60 getconf include -getconf vsnames all -getconf vsinclude getconf exclude + setsection dest getconf directory; destdir=$directory # strip trailing / @@ -115,22 +115,15 @@ fi ### CHECK CONFIG ### -# If vservers are configured, check that the ones listed in $vsnames do exist. -usevserver=no -if [ $vservers_are_available = yes ]; then - if [ "$vsnames" = all ]; then - vsnames="$found_vservers" - else - if ! vservers_exist "$vsnames" ; then - fatal "At least one of the vservers listed in vsnames ($vsnames) does not exist." - fi - fi - if [ -n "$vsinclude" ]; then - info "Using vservers '$vsnames'" - usevserver=yes - fi -else - [ -z "$vsinclude" ] || warning 'vservers support disabled in backupninja.conf, vsincludes configuration lines will be ignored' +# Check that the ionicelevel is valid +if [ -n "$ionicelevel" ] && echo "$ionicelevel" | grep -vq "^[0-7]$"; then + fatal "The value of ionicelevel is expected to be either empty or an integer from 0 to 7. Got: $ionicelevel" +fi + +# Only use ionice if ionicelevel is not empty +nice="nice -n $nicelevel" +if [ -n "$ionicelevel" ]; then + nice="ionice -c2 -n $ionicelevel $nice" fi # check the connection at the source and destination @@ -142,8 +135,11 @@ fi if [ "$ignore_version" != "yes" ]; then # see that rdiff-backup has the same version at the source and destination + debug "executing rdiff-backup version checks" sourceversion=`get_version $sourceuser $sourcehost` destversion=`get_version $destuser $desthost` + debug "source version: $sourceversion" + debug "destination version: $destversion" if [ "$sourceversion" != "$destversion" ]; then fatal "rdiff-backup does not have the same version at the source and at the destination." fi @@ -164,6 +160,11 @@ case $desttype in * ) fatal "desttype '$desttype' is neither local nor remote" ;; esac +# check keep parameter format +if [ "$keep" != "yes" ] && ! echo "$keep" | grep -qe '^[0-9]\+[smhDWMY]\?$'; then + fatal "Keep parameter contains an invalid value ($keep)." +fi + ### REMOVE OLD BACKUPS ### if [ "$keep" != yes ]; then @@ -179,6 +180,7 @@ if [ "$keep" != yes ]; then fi removestr="${removestr}${destdir}/${label}"; + debug "executing rdiff-backup --remove-older-than" debug "$removestr" if [ $test = 0 ]; then output="`su -c "$removestr" 2>&1`" @@ -243,35 +245,18 @@ for i in $include; do done IFS=$SAVEIFS -# vsinclude -if [ $usevserver = yes ]; then - for vserver in $vsnames; do - SAVEIFS=$IFS - IFS=$(echo -en "\n\b") - for vi in $vsinclude; do - str="${vi//__star__/*}" - str="$VROOTDIR/$vserver$str" - if [ -n "$str" ]; then - execstr="${execstr}--include '$str' " - else - warning "vsinclude statement '${vi//__star__/*}' will be ignored for VServer $vserver. $symlinks_warning" - fi - done - IFS=$SAVEIFS - done -fi - set +o noglob # exclude everything else -[ "$include" != "" -o "$vsinclude" != "" ] && execstr="${execstr}--exclude '/*' " +[ "$include" != "" ] && execstr="${execstr}--exclude '/*' " # include client-part and server-part execstr="${execstr}$execstr_sourcepart $execstr_destpart" -debug "$execstr" +debug "executing rdiff-backup" +debug "$nice $execstr" if [ $test = 0 ]; then - output=`nice -n $nicelevel su -c "$execstr" 2>&1` + output=`$nice su -c "$execstr" 2>&1` if [ $? = 0 ]; then if [ "$output_as_info" == "yes" ]; then info "$output" diff --git a/handlers/restic.helper.in b/handlers/restic.helper.in new file mode 100644 index 0000000000000000000000000000000000000000..d98439fa2ebef1864d5e0b062985099560a1ec76 --- /dev/null +++ b/handlers/restic.helper.in @@ -0,0 +1,176 @@ +# -*- mode: sh; sh-basic-offset: 2; indent-tabs-mode: nil; -*- +# vim: set filetype=sh sw=2 sts=2 expandtab autoindent: +# +# restic helper for backupninja +# + +HELPERS="$HELPERS restic:fast_secure_efficient_backup" + +declare -a restic_includes +declare -a restic_excludes + +# FUNCTIONS + +function do_restic_repository() { + REPLY= + while [ -z "$REPLY" -o -z "$restic_repository" ]; do + inputBox "$restic_title - Repository" "Enter Repository (eg. rclone:remote:bucket):" "$restic_repository" + [ $? = 0 ] || return 1 + restic_repository="$REPLY" + done +} + +function do_restic_password_file() { + REPLY= + while [ -z "$REPLY" -o -z "$restic_password_file" ]; do + inputBox "$restic_title - Password File" "Enter password-file (eg. /etc/restic.passwd) containing repository password:" "$restic_password_file" + [ $? = 0 ] || return 1 + restic_password_file="$REPLY" + done +} + +function do_restic_general() { + # set restic_repository + do_restic_repository ; [ $? = 0 ] || return 1 + + # set restic_password_file + do_restic_password_file ; [ $? = 0 ] || return 1 + + _gen_done="(DONE)" + setDefault back +} + +function do_restic_includes() { + set -o noglob + # choose the files to backup + REPLY= + while [ -z "$REPLY" ]; do + formBegin "$restic_title - host system: includes" + for ((i=0; i < ${#restic_includes[@]} ; i++)); do + formItem include ${restic_includes[$i]} + done + formItem include + formItem include + formItem include + formItem include + formItem include + formItem include + formItem include + formItem include + formDisplay + [ $? = 0 ] || return + unset restic_includes + restic_includes=($REPLY) + done + set +o noglob +} + +function do_restic_excludes() { + set -o noglob + formBegin "$restic_title: host system: excludes" + for ((i=0; i < ${#restic_excludes[@]} ; i++)) + do + formItem exclude ${restic_excludes[$i]} + done + formItem exclude + formItem exclude + formItem exclude + formItem exclude + formItem exclude + formItem exclude + formItem exclude + formItem exclude + formDisplay + [ $? = 0 ] || return + unset restic_excludes + restic_excludes=($REPLY) + set +o noglob +} + +function do_restic_backup() { + do_restic_includes + [ $? = 0 ] || return 1 + + do_restic_excludes + [ $? = 0 ] || return 1 + + _back_done="(DONE)" + setDefault finish +} + + +function do_restic_finish() { + get_next_filename $configdirectory/90.restic + + cat > $next_filename <<EOF +## for more options see +## - example.restic +## - $restic_docs + +# Minimal output +[general] +run_backup = yes +EOF + + echo "repository = $restic_repository" >> $next_filename + echo "password_file = $restic_password_file" >> $next_filename + + cat >> $next_filename <<EOF + +[backup] +EOF + + ## includes ## + set -o noglob + for ((i=0; i < ${#restic_includes[@]} ; i++)); do + echo "include = ${restic_includes[$i]}" >> $next_filename + done + set +o noglob + + ## excludes ## + set -o noglob + for ((i=0; i < ${#restic_excludes[@]} ; i++)); do + echo exclude = ${restic_excludes[$i]} >> $next_filename + done + set +o noglob + + chmod 600 $next_filename +} + +function restic_main_menu() { + while true; do + genitem="General Restic settings $_gen_done" + backitem="Backup settings $_back_done" + menuBox "$restic_title" "choose a step:" \ + gen "$genitem" \ + back "$backitem" \ + finish "finish and create config file" + [ $? = 0 ] || return + result="$REPLY" + case "$result" in + "gen") do_restic_general;; + "back") do_restic_backup;; + "finish") + if [[ "$_gen_done$_back_done" != "(DONE)(DONE)" ]]; then + msgBox "$restic_title" "You cannot create the config file until all steps are completed." + else + do_restic_finish + return + fi + ;; + esac + done +} + +function restic_wizard { + require_packages rclone + + # global variables + restic_title="restic action wizard" + restic_docs="https://restic.readthedocs.io/en/latest" + + _gen_done= + _back_done= + + restic_main_menu +} diff --git a/handlers/restic.in b/handlers/restic.in new file mode 100644 index 0000000000000000000000000000000000000000..664547cd3e990c839b94d127b85497453e4682e9 --- /dev/null +++ b/handlers/restic.in @@ -0,0 +1,583 @@ +# -*- mode: sh; sh-basic-offset: 2; indent-tabs-mode: nil; -*- +# vim: set filetype=sh sw=2 sts=2 expandtab autoindent: +# +# restic script for backupninja +# + +### GETCONF ################################################################### + +setsection general + +getconf nicelevel +getconf ionicelevel + +getconf run_backup "no" +getconf run_forget "no" +getconf run_check "no" +getconf run_prune "no" + +getconf cacert +getconf cache_dir +getconf cleanup_cache +getconf json +getconf limit_download +getconf limit_upload +getconf no_cache +getconf no_lock +getconf option +getconf password +getconf password_file +getconf quiet +getconf repository +getconf tls_client_cert + +setsection s3 + +getconf aws_access_key_id +getconf aws_secret_access_key +getconf aws_session_token + +setsection swift + +getconf os_auth_url +getconf os_tenant_id +getconf os_tenant_name +getconf os_username +getconf os_password +getconf os_region_name + +setsection b2 + +getconf b2_account_id +getconf b2_account_key + +setsection azure + +getconf azure_account_name +getconf azure_account_key + +setsection gs + +getconf google_project_id +getconf google_application_credentials + +# Check that the ionicelevel is valid +if [ -n "$nicelevel" ] && { [ "$nicelevel" -lt -20 ] || [ "$nicelevel" -gt 19 ]; }; then + fatal "The value of nicelevel is expected to be either empty or an integer from -20 to 19. Got: $nicelevel" +fi + +# Check that the ionicelevel is valid +if [ -n "$ionicelevel" ] && echo "$ionicelevel" | grep -vq "^[0-7]$"; then + fatal "The value of ionicelevel is expected to be either empty or an integer from 0 to 7. Got: $ionicelevel" +fi + +### HELPERS ################################################################### + +function export_debug { + export "$1"="$2" + debug "$1=${!1}" +} + +### PRE-COMMANDS ############################################################## + +[ -n "$nicelevel" ] && \ + precmd+="nice -n $nicelevel " + +[ -n "$ionicelevel" ] && \ + precmd+="ionice -c2 -n $ionicelevel " + +### GLOBAL OPTIONS ############################################################ + +[ -z "$repository" ] && \ + fatal "The repository option must be set." + +[ -z "$password" ] && [ -z "$password_file" ] && \ + fatal "The password must be set by option 'password' or 'password_file'." + +[ -n "$repository" ] && \ + cmd_global_options+="--repo $repository " + +[ -n "$password" ] && \ + export_debug RESTIC_PASSWORD "$password" + +[ -n "$password_file" ] && \ + cmd_global_options+="--password-file $password_file " + +[ -n "$cacert" ] && \ + cmd_global_options+="--cacert $cacert " + +[ -n "$cache_dir" ] && \ + cmd_global_options+="--cache-dir $cache_dir " + +[ -n "$cleanup_cache" ] && \ + cmd_global_options+="--cleanup-cache " + +[ -n "$json" ] && \ + cmd_global_options+="--json " + +[ -n "$limit_download" ] && \ + cmd_global_options+="--limit-download $limit_download " + +[ -n "$limit_upload" ] && \ + cmd_global_options+="--limit-upload $limit_upload " + +[ -n "$no_cache" ] && \ + cmd_global_options+="--no-cache " + +[ -n "$no_lock" ] && \ + cmd_global_options+="--no-lock " + +[ -n "$option" ] && \ + cmd_global_options+="$(for i in "${option[@]}"; do echo "--option $i "; done)" + +[ -n "$quiet" ] && \ + cmd_global_options+="--quiet " + +[ -n "$tls_client_cert" ] && \ + cmd_global_options+="--tls-client-cert $tls_client_cert " + +### REPOSITORY ################################################################ + +# Amazon S3 repository +if [ "$(echo "$repository" | @AWK@ -F ':' '{print $1}')" == "s3" ]; then + + ( [ -z "$aws_access_key_id" ] || [ -z "$aws_secret_access_key" ] ) && \ + fatal "Missing some S3 credentials." + + export_debug AWS_ACCESS_KEY_ID "$aws_access_key_id" + export_debug AWS_SECRET_ACCESS_KEY "$aws_secret_access_key" + [ -n "$aws_session_token" ] && \ + export_debug AWS_SESSION_TOKEN "$aws_session_token" + +fi + +# OpenStack Swift repository +if [ "$(echo "$repository" | @AWK@ -F ':' '{print $1}')" == "swift" ]; then + + ( + [ -z "$os_auth_url" ] || [ -z "$os_tenant_id" ] || [ -z "$os_tenant_name" ] || \ + [ -z "$os_username" ] || [ -z "$os_password" ] || [ -z "$os_region_name" ] + ) && \ + fatal "Missing some Swift credentials." + + export_debug OS_AUTH_URL "$os_auth_url" + export_debug OS_TENANT_ID "$os_tenant_id" + export_debug OS_TENANT_NAME "$os_tenant_name" + export_debug OS_USERNAME "$os_username" + export_debug OS_PASSWORD "$os_password" + export_debug OS_REGION_NAME "$os_region_name" + +fi + +# Backblaze B2 repository +if [ "$(echo "$repository" | @AWK@ -F ':' '{print $1}')" == "b2" ]; then + + ( [ -z "$b2_account_id" ] || [ -z "$b2_account_key" ] ) && \ + fatal "Missing some B2 credentials." + + export_debug B2_ACCOUNT_ID "$b2_account_id" + export_debug B2_ACCOUNT_KEY "$b2_account_key" + +fi + +# Microsoft Azure Blob Storage repository +if [ "$(echo "$repository" | @AWK@ -F ':' '{print $1}')" == "azure" ]; then + + ( [ -z "$azure_account_name" ] || [ -z "$azure_account_key" ] ) && \ + fatal "Missing some Azure credentials." + + export_debug AZURE_ACCOUNT_NAME "$azure_account_name" + export_debug AZURE_ACCOUNT_KEY "$azure_account_key" + +fi + +# Google Cloud Storage repository +if [ "$(echo "$repository" | @AWK@ -F ':' '{print $1}')" == "gs" ]; then + + ( [ -z "$google_project_id" ] || [ -z "$google_application_credentials" ] ) && \ + fatal "Missing some Google credentials." + + export_debug GOOGLE_PROJECT_ID "$google_project_id" + export_debug GOOGLE_APPLICATION_CREDENTIALS "$google_application_credentials" + +fi + +### TEST ####################################################################### + +info "Attempting to connect to repository at ${repository}" + +cmd="restic snapshots" +execstr="${cmd} ${cmd_global_options//$'\n'}" + +debug "executing restic snapshots" +debug "$execstr" +output=$(eval $execstr 2>&1) +ret=$? + +if [ $ret -eq 0 ]; then + debug $output + info "Connected successfully." +else + setsection backup + getconf init yes + if [ "$init" = "yes" ]; then + debug $output + info "Unable to find a repository at ${repository}, will attempt to create one." + need_init="yes" + else + error $output + fatal "The specified repository is absent or unusable!" + fi +fi + +### INIT ####################################################################### + +if [ "$need_init" = "yes" ]; then + + cmd="restic init" + execstr="${cmd} ${cmd_global_options//$'\n'}" + + debug "executing restic init" + debug "$execstr" + + if [ $test -eq 1 ]; then + info "Test mode enabled, skipping restic init." + else + info "Initializing repository at $repository" + + output=$(eval $execstr 2>&1) + ret=$? + + if [ $ret -eq 0 ]; then + warning $output + warning "Repository has been initialized." + else + error $output + fatal "Unable to initialize repository, aborting!" + fi + fi + +fi + +### BACKUP ##################################################################### + +if [ "$run_backup" == "yes" ]; then + + setsection backup + + getconf include + getconf exclude + getconf exclude_caches + getconf exclude_file + getconf exclude_if_present + getconf files_from + getconf force + getconf hostname + getconf one_file_system + getconf parent + getconf tag + getconf time + getconf with_atime + + set -o noglob + SAVEIFS=$IFS + IFS=$(echo -en "\n\b") + + [ -z "$include" ] && [ -z "$files_from" ] && \ + fatal "No files or directories specified for backup." + + [ -n "$include" ] && \ + cmd_options+="$(for i in $include; do echo "'$i' "; done)" + + [ -n "$files_from" ] && \ + cmd_options+="$(for i in $files_from; do echo "--files-from '$i' "; done)" + + [ -d "$repository" ] && \ + cmd_options+="--exclude $repository " + + [ -n "$exclude" ] && \ + cmd_options+="$(for i in $exclude; do echo "--exclude '$i' "; done)" + + [ "$exclude_caches" == "yes" ] && \ + cmd_options+="--exclude-caches " + + [ -n "$exclude_file" ] && \ + cmd_options+="$(for i in $exclude_file; do echo "--exclude-file '$i' "; done)" + + [ -n "$exclude_if_present" ] && \ + cmd_options+="$(for i in $exclude_if_present; do echo "--exclude-if-present '$i' "; done)" + + [ "$force" == "yes" ] && \ + cmd_options+="--force " + + [ -n "$hostname" ] && \ + cmd_options+="--hostname $hostname " + + [ -n "$one_file_system" ] && \ + cmd_options+="--one-file-system " + + [ -n "$parent" ] && \ + cmd_options+="--parent $parent " + + [ -n "$tag" ] && \ + cmd_options+="$(for i in $tag; do echo "--tag='$i' "; done)" + + [ -n "$time" ] && \ + cmd_options+="--time $time " + + [ "$with_atime" == "yes" ] && \ + cmd_options+="--with_atime " + + IFS=$SAVEIFS + set +o noglob + + # format command + cmd="restic backup" + execstr="${precmd}${cmd} ${cmd_global_options//$'\n'}${cmd_options//$'\n'}" + + # debug + debug "executing restic backup" + debug "$execstr" + + # execute + if [ $test -eq 1 ]; then + info "Test mode enabled, skipping restic backup." + else + info "Creating new backup snapshot." + output=$(eval $execstr 2>&1) + ret=$? + if [ $ret -eq 0 ]; then + debug $output + info "Restic backup successful." + else + error $output + fatal "Restic backup failed." + fi + fi + + debug "Unsetting variables" + unset cmd_options + unset execstr + unset output + unset ret + +fi + +### FORGET ##################################################################### + +if [[ "$run_forget" == "yes" ]]; then + + setsection forget + + getconf keep_last "7" + getconf keep_hourly + getconf keep_daily + getconf keep_weekly + getconf keep_monthly + getconf keep_yearly + getconf keep_within + getconf keep_tag + getconf host + getconf tag + getconf path + getconf compact + getconf group_by + getconf dry_run + getconf prune + + set -o noglob + SAVEIFS=$IFS + IFS=$(echo -en "\n\b") + + [ -n "$keep_last" ] && \ + cmd_options+="--keep-last $keep_last " + + [ -n "$keep_hourly" ] && \ + cmd_options+="--keep-hourly $keep_hourly " + + [ -n "$keep_daily" ] && \ + cmd_options+="--keep-daily $keep_daily " + + [ -n "$keep_weekly" ] && \ + cmd_options+="--keep-weekly $keep_weekly " + + [ -n "$keep_monthly" ] && \ + cmd_options+="--keep-monthly $keep_monthly " + + [ -n "$keep_yearly" ] && \ + cmd_options+="--keep-yearly $keep_yearly " + + [ -n "$keep_within" ] && \ + cmd_options+="--keep-within $keep_within " + + [ -n "$keep_tag" ] && \ + cmd_options+="$(for i in $keep_tag; do echo "--keep-tag=$i "; done)" + + [ -n "$host" ] && \ + cmd_options+="--host $host " + + [ -n "$tag" ] && \ + cmd_options+="$(for i in $tag; do echo "--tag=$i "; done)" + + [ -n "$path" ] && \ + cmd_options+="$(for i in $path; do echo "--path=$i "; done)" + + [ -n "$compact" ] && \ + cmd_options+="--compact " + + [ -n "$group_by" ] && \ + cmd_options+="--group-by $group_by " + + [ -n "$dry_run" ] && \ + cmd_options+="--dry-run " + + [ -n "$prune" ] && \ + cmd_options+="--prune " + + IFS=$SAVEIFS + set +o noglob + + # format command + cmd="restic forget" + execstr="${precmd}${cmd} ${cmd_global_options//$'\n'}${cmd_options//$'\n'}" + + # debug + debug "executing restic forget" + debug "$execstr" + + # execute + if [ $test -eq 1 ]; then + info "Test mode enabled, skipping restic forget." + else + info "Removing old snapshots based on defined retention policy." + output=$(eval $execstr 2>&1) + ret=$? + if [ $ret -eq 0 ]; then + debug $output + info "Restic forget successful." + else + error $output + fatal "Restic forget failed." + fi + fi + + debug "Unsetting variables" + unset cmd_options + unset execstr + unset output + unset ret + +fi + +### PRUNE ###################################################################### + +if [ "$run_prune" == "yes" ]; then + + # format command + cmd="restic prune" + execstr="${precmd}${cmd} ${cmd_global_options//$'\n'}" + + # debug + debug "executing restic prune" + debug "$execstr" + + # execute + if [ $test -eq 1 ]; then + info "Test mode enabled, skipping restic prune." + else + info "Removing unreferenced data from repository." + output=$(eval $execstr 2>&1) + ret=$? + if [ $ret -eq 0 ]; then + debug $output + info "Restic prune successful." + else + error $output + fatal "Restic prune failed." + fi + fi + + debug "Unsetting variables" + unset execstr + unset output + unset ret + +fi + +### CHECK ###################################################################### + +if [ "$run_check" == "yes" ]; then + + setsection check + + getconf check_unused + getconf read_data + getconf read_data_subset + getconf with_cache + + [ -n "$check_unused" ] && \ + cmd_options+="--check-unused " + + [ -n "$read_data" ] && \ + cmd_options+="--read-data " + + [ -n "$read_data_subset" ] && \ + cmd_options+="--read-data-subset $read_data_subset " + + [ -n "$with_cache" ] && \ + cmd_options+="--with-cache " + + # format command + cmd="restic check" + execstr="${precmd}${cmd} ${cmd_global_options//$'\n'}${cmd_options//$'\n'}" + + # debug + debug "executing restic check" + debug "$execstr" + + # execute + if [ $test -eq 1 ]; then + info "Test mode enabled, skipping restic check." + else + info "Checking repository integrity and consistency." + output=$(eval $execstr 2>&1) + ret=$? + if [ $ret -eq 0 ]; then + debug $output + info "Restic check successful." + else + error $output + fatal "Restic check failed." + fi + fi + + debug "Unsetting variables" + unset cmd_options + unset execstr + unset output + unset ret + +fi + +### CLEAN UP ################################################################### + +debug "Unsetting environment variables" +unset RESTIC_PASSWORD +unset AWS_ACCESS_KEY_ID +unset AWS_SECRET_ACCESS_KEY +unset AWS_SESSION_TOKEN +unset OS_AUTH_URL +unset OS_TENANT_ID +unset OS_TENANT_NAME +unset OS_USERNAME +unset OS_PASSWORD +unset OS_REGION_NAME +unset B2_ACCOUNT_ID +unset B2_ACCOUNT_KEY +unset AZURE_ACCOUNT_NAME +unset AZURE_ACCOUNT_KEY +unset GOOGLE_PROJECT_ID +unset GOOGLE_APPLICATION_CREDENTIALS +unset cmd_global_options + +return 0 diff --git a/handlers/rsync.in b/handlers/rsync.in index 8cad073b50fcf9d1c44fb69776da041fd2ac3c23..571b6cecba99b096ad5ae887fdf0a00fcf454d32 100644 --- a/handlers/rsync.in +++ b/handlers/rsync.in @@ -40,6 +40,7 @@ # keepweekly = for long storage format, specify the number of weekly backup increments # keepmonthly = for long storage format, specify the number of monthly backup increments # nicelevel = rsync command nice level +# ionicelevel = best-effort nice level applied to rsync and other commands # enable_mv_timestamp_bug = set to "yes" if your system isnt handling timestamps correctly # tmp = temp folder # multiconnection = set to "yes" if you want to use multiconnection ssh support @@ -56,7 +57,6 @@ # protocol = ssh or rsync (remote source only) # rsync = rsync program # rsync_options = rsync command options -# exclude_vserver = vserver-name (valid only if vservers = yes on backupninja.conf) # numericids = when set to 1, use numeric ids instead of user/group mappings on rsync # compress = if set to 1, compress data on rsync (remote source only) # bandwidthlimit = set a bandwidth limit in KB/s (remote source only) @@ -97,9 +97,6 @@ # mv = mv command # fsck = fsck command # -# You dont need to manually specify vservers using "include = /vservers". -# They are automatically backuped if vserver is set to "yes" on you backupninja.conf. -# # function definitions @@ -129,6 +126,7 @@ function eval_config { getconf keepweekly 3 getconf keepmonthly 1 getconf nicelevel 0 + getconf ionicelevel getconf enable_mv_timestamp_bug no getconf tmp /tmp getconf multiconnection no @@ -143,7 +141,6 @@ function eval_config { if [ "$from" == "remote" ]; then getconf testconnect no getconf protocol ssh - getconf ssh ssh getconf host if [ "$protocol" == "ssh" ]; then @@ -157,7 +154,7 @@ function eval_config { getconf user getconf bandwidthlimit getconf remote_rsync rsync - getconf id_file /root/.ssh/id_dsa + getconf id_file /root/.ssh/id_rsa fi getconf batch no @@ -173,7 +170,6 @@ function eval_config { getconf filelistbase getconf include getconf exclude - getconf exclude_vserver getconf numericids 0 getconf compress 0 @@ -186,7 +182,6 @@ function eval_config { if [ "$dest" == "remote" ]; then getconf testconnect no getconf protocol ssh - getconf ssh ssh getconf host if [ "$protocol" == "ssh" ]; then @@ -200,7 +195,7 @@ function eval_config { getconf user getconf bandwidthlimit getconf remote_rsync rsync - getconf id_file /root/.ssh/id_dsa + getconf id_file /root/.ssh/id_rsa fi getconf batch no @@ -258,6 +253,10 @@ function eval_config { nice="" fi + if [ -n "$ionicelevel" ]; then + nice="ionice -c2 -n $ionicelevel $nice" + fi + ssh_cmd_base="ssh -T -o PasswordAuthentication=no -p $port -i $id_file" ssh_cmd="$ssh_cmd_base $user@$host" @@ -378,6 +377,11 @@ function rotate_short_remote { rm -rf $metadata/\$file fi done + + # Create first directory if needed + if [ -d $backupdir ]; then + [ -d $folder.0 ] || mkdir -p $folder.0 + fi ##### END REMOTE SCRIPT ####### EOF ) | (while read a; do passthru $a; done) @@ -795,7 +799,34 @@ function prepare_storage { fi elif [ "$format" == "mirror" ]; then - suffix="" + + # create $SECTION directories, but not $backupdir + if [ "$dest" == "local" ]; then + if [ -d "$backupdir" ]; then + mkdir --parents $backupdir/$SECTION + else + fatal "The destination $backupdir does not exist" + exit 1 + fi + else + debug "$ssh_cmd" + debug "$backupdir/$SECTION" +( + $ssh_cmd <<EOF + ##### BEGIN REMOTE SCRIPT ##### + if [ -d "$backupdir" ]; then + mkdir --parents $backupdir/$SECTION + else + echo "FATAL: The destination $backupdir does not exist" + exit 1 + fi + ##### END REMOTE SCRIPT ####### +EOF +) | (while read a; do passthru $a; done) + fi + + suffix="" + else fatal "Invalid backup format $format" fi @@ -901,7 +932,7 @@ function test_connect { if [ "$result" != "1" ]; then fatal "Can't connect to $host as $user." else - debug "Connected to $host successfully" + debug "Connected to $host successfully." fi } @@ -957,7 +988,7 @@ function set_rsync_options { if [ "$protocol" == "ssh" ]; then if [ ! -e "$id_file" ]; then - fatal "SSH Identity file $id_file not found" + fatal "SSH identity file $id_file not found." else debug RSYNC_RSH=\"$ssh_cmd_base\" echo RSYNC_RSH=\"$ssh_cmd_base\" >> $log @@ -975,8 +1006,6 @@ function set_rsync_options { rsync_options=($rsync_options --rsync-path="$remote_rsync") fi - include_vservers - } function stop_services { @@ -1050,33 +1079,6 @@ function run_fsck { } -function include_vservers { - - # add vservers to included folders - - if [ "$vservers_are_available" == "yes" ]; then - - # sane permission on backup - mkdir -p $backupdir/$VROOTDIR - chmod 000 $backupdir/$VROOTDIR - - for candidate in $found_vservers; do - candidate="`basename $candidate`" - found_excluded_vserver="0" - for excluded_vserver in $exclude_vserver; do - if [ "$excluded_vserver" == "$candidate" ]; then - found_excluded_vserver="1" - break - fi - done - if [ "$found_excluded_vserver" == "0" ]; then - include="$include $VROOTDIR/$candidate" - fi - done - fi - -} - function start_mux { if [ "$multiconnection" == "yes" ]; then @@ -1126,6 +1128,7 @@ function check_rsync_exit_status { case $1 in 0) + debug "Rsync transfer of $SECTION finished successfully." return ;; 1|2|3|4|5|6|10|11|12|13|14|21) @@ -1174,5 +1177,5 @@ run_fsck start_services end_mux -echo "Finnishing backup at `date`" >> $log +echo "Finished backup at `date`" >> $log diff --git a/handlers/svn.in b/handlers/svn.in index bb70eee14fd1b608300659173631ab59f696bfa2..564a273e59c65df3cbf577e89bc0cec181074c7a 100644 --- a/handlers/svn.in +++ b/handlers/svn.in @@ -8,70 +8,43 @@ getconf src /var/lib/svn getconf dest /var/backups/svn getconf tmp /var/backups/svn.tmp getconf HOTBACKUP "/usr/bin/svnadmin hotcopy" -getconf vsname error=0 -# Decide if the handler should operate on a vserver or on the host. -# In the former case, check that $vsname exists and is running. -usevserver=no -vroot='' -if [ $vservers_are_available = yes ]; then - if [ -n "$vsname" ]; then - # does it exist ? - if ! vservers_exist "$vsname" ; then - fatal "The vserver given in vsname ($vsname) does not exist." - fi - # is it running ? - vservers_running $vsname || fatal "The vserver $vsname is not running." - # everything ok - info "Using vserver '$vsname'." - usevserver=yes - vroot="$VROOTDIR/$vsname" - else - info "No vserver name specified, actions will be performed on the host." - fi -fi - -cd $vroot$src +cd $src for repo in `find . -name svnserve.conf` do repo=`dirname $repo` repo=`dirname $repo` - ret=`mkdir -p $vroot$tmp/$repo 2>&1` + ret=`mkdir -p $tmp/$repo 2>&1` code=$? if [ "$ret" ]; then debug "$ret" fi if [ $code != 0 ]; then - error "command failed mkdir -p $vroot$tmp/$repo" + error "command failed mkdir -p $tmp/$repo" fi - if [ $usevserver = yes ] - then - ret=`$VSERVER $vsname exec $HOTBACKUP $src/$repo $tmp/$repo 2>&1` - else - ret=`$HOTBACKUP $src/$repo $tmp/$repo 2>&1` - fi + ret=`$HOTBACKUP $src/$repo $tmp/$repo 2>&1` code=$? if [ "$ret" ]; then debug "$ret" fi if [ $code != 0 ]; then - error "command failed -- $HOTBACKUP $vroot$src/$repo $vroot$tmp/$repo" + error "command failed -- $HOTBACKUP $src/$repo $tmp/$repo" error=1 fi done if [ $error -eq 1 ]; then - echo "Error: because of earlier errors, we are leaving svn backups in $vroot$tmp instead of $vroot$dest" + echo "Error: because of earlier errors, we are leaving svn backups in $tmp instead of $dest" else - if [ -d $vroot$dest -a -d $vroot$tmp ]; then - rm -rf $vroot$dest + if [ -d $dest -a -d $tmp ]; then + rm -rf $dest fi - if [ -d $vroot$tmp ]; then - mv $vroot$tmp $vroot$dest + if [ -d $tmp ]; then + mv $tmp $dest fi fi diff --git a/handlers/sys.helper.in b/handlers/sys.helper.in index c584dfb51d698d6b10b58b39d04bfc47418901c3..339079282447151e1af1a4f70894caa58f9d3978 100644 --- a/handlers/sys.helper.in +++ b/handlers/sys.helper.in @@ -50,10 +50,6 @@ $bios # partitionsfile = /var/backups/partitions.__star__.txt # hardwarefile = /var/backups/hardware.txt # luksheadersfile = /var/backups/luksheader.__star__.bin - -# If vservers = yes in /etc/backupninja.conf then the following variables can -# be used: -# vsnames = all | <vserver1> <vserver2> ... (default = all) EOF chmod 600 $next_filename } diff --git a/handlers/sys.in b/handlers/sys.in index e037b2fafd4cadbebdc60466a02a145c5893cf65..375a86460fa4efa7e9b8430f9a93de5769f3386e 100644 --- a/handlers/sys.in +++ b/handlers/sys.in @@ -126,21 +126,6 @@ getconf mbrfile $parentdir/mbr.__star__.bin getconf FLASHROM `which flashrom` getconf bios no -getconf vsnames all - -# If vservers are configured, check that the ones listed in $vsnames are running. -usevserver=no -if [ $vservers_are_available = yes ]; then - if [ "$vsnames" = all ]; then - vsnames="$found_vservers" - fi - if ! vservers_running "$vsnames" ; then - fatal "At least one of the vservers listed in vsnames ($vsnames) is not running." - fi - info "Using vservers '$vsnames'" - usevserver=yes -fi - ## SANITY CHECKS ######################### if [ "$luksheaders" == "yes" ]; then @@ -186,47 +171,6 @@ fi # if [ "$packages" == "yes" ]; then - - if [ $usevserver = yes ]; then - info "vserver root directory set to: $VROOTDIR" - for vserver in $vsnames; do - info "examining vserver: $vserver" - # is it running ? - vservers_running $vserver - if [ $? -ne 0 ]; then - warning "The vserver $vserver is not running." - continue - fi - # is $packagemgr available inside $vserver ? - if [ ! -x "${VROOTDIR}/${vserver}${packagemgr}" ]; then - warning "can't find $packagemgr in vserver $vserver, skipping installed packages report." - else - # don't expand * since it can be used in $packagemgroptions - set -o noglob - debug "$VSERVER $vserver exec $packagemgr $packagemgroptions > $VROOTDIR/$vserver$packagesfile" - $VSERVER $vserver exec $packagemgr $packagemgroptions > $VROOTDIR/$vserver$packagesfile || fatal "can not save $packagemgr info to $packagesfile" - set +o noglob - fi - # is $debconfgetselections available inside $vserver ? - found=no - # case #1: it is available on the host, is it available inside $vserver ? - if [ -n "$debconfgetselections" ]; then - [ -x "${VROOTDIR}/${vserver}${debconfgetselections}" ] && found=yes - # case #2: it is not available on the host, is it available inside $vserver ? - else - [ -n "`$VSERVER $vserver exec which debconf-get-selections`" ] && found=yes - fi - if [ "$found" != yes ]; then - warning "can't find debconf-get-selections in vserver $vserver, skipping package selection states. You may want to install the debconf-utils package." - else - debug "$VSERVER $vserver exec $debconfgetselections > $VROOTDIR/$vserver$selectionsfile" - $VSERVER $vserver exec $debconfgetselections > $VROOTDIR/$vserver$selectionsfile || fatal "can not save debconf-get-selections info to $selectionsfile" - fi - unset found - done - fi - - # We want to perform this on the host as well if [ -z "$packagemgr" -o ! -x "$packagemgr" ]; then warning "can't find ${packagemgr}, skipping installed packages report." else @@ -236,11 +180,13 @@ if [ "$packages" == "yes" ]; then $packagemgr $packagemgroptions > $packagesfile || fatal "can not save $packagemgr info to $packagesfile" set +o noglob fi - if [ -z "$debconfgetselections" ]; then - warning "can't find debconf-get-selections, skipping package selection states. You might want to install the debconf-utils package." - else - debug "$debconfgetselections > $selectionsfile" - $debconfgetselections > $selectionsfile || fatal "can not save $debconfgetselections info to $selectionsfile" + if [ "$os" = "debian" ]; then + if [ -z "$debconfgetselections" ]; then + warning "can't find debconf-get-selections, skipping package selection states. You might want to install the debconf-utils package." + else + debug "$debconfgetselections > $selectionsfile" + $debconfgetselections > $selectionsfile || fatal "can not save $debconfgetselections info to $selectionsfile" + fi fi fi @@ -257,11 +203,14 @@ DASHES="-----------------------------------------------------------------" cat /dev/null > $sysreportfile || fatal "can not write to $sysreportfile" - -catiffile () { +catstatus () { echo $HASHES >> $sysreportfile echo "# $STATUS" >> $sysreportfile echo $HASHES >> $sysreportfile +} + +catiffile () { + catstatus if [ -f $1 ]; then echo "file: $1" >> $sysreportfile echo $DASHES >> $sysreportfile @@ -280,9 +229,7 @@ catiffile () { catifexec () { if [ -x $1 ]; then - echo $HASHES >> $sysreportfile - echo "# $STATUS" >> $sysreportfile - echo $HASHES >> $sysreportfile + catstatus $* >> $sysreportfile 2>&1 || info "executing of $1 failed" fi } @@ -306,26 +253,35 @@ catifexec "/usr/bin/free" STATUS="Checking free disk space:" catifexec "/bin/df" "-al --exclude-type=tmpfs" -STATUS="Collecting what services run at what run level:" -if [ $os = "redhat" ]; then - catifexec "/sbin/chkconfig" "--list" +if [ -d /run/systemd/system ]; then + STATUS="Collecting information about systemd units" + catifexec "/usr/bin/systemctl" "list-units --all" + STATUS="Collecting information about systemd timers" + catifexec "/usr/bin/systemctl" "list-timers --all" +else STATUS="Collecting information about /etc/rc.d:" - catiffile "/bin/ls /etc/rc.d/rc*.d/" - -elif [ $os = "debian" ]; then - for level in 0 1 2 3 4 5 6 S; do - echo "Level: $level" >> $sysreportfile - for f in /etc/rc${level}.d/*; do - # Remove /etc/Knn or Snn from beginning - ff=$(echo $f | @SED@ 's_/etc/rc..d/[KS][0-9][0-9]__') - if [ $f != $ff ]; then - echo $ff >> $sysreportfile - fi + if [ -x /usr/sbin/chkconfig ]; then + catifexec "/usr/sbin/chkconfig" "--list" + else + catstatus + for level in 0 1 2 3 4 5 6 S; do + echo "Level: $level" >> $sysreportfile + for f in /etc/rc${level}.d/*; do + # Remove /etc/Knn or Snn from beginning + ff=$(echo $f | @SED@ 's_/etc/rc..d/[KS][0-9][0-9]__') + if [ $f != $ff ]; then + echo $ff >> $sysreportfile + fi + done + echo "" >> $sysreportfile done - echo "" >> $sysreportfile - done + fi fi +STATUS="Getting EFI variables information:" +catifexec "/bin/efibootmgr" +catifexec "/usr/sbin/efibootmgr" + STATUS="Getting bootloader information:" catifexec "/bin/ls" "-alR /boot" @@ -363,7 +319,7 @@ if [ -f /etc/cluster.conf -o -f /etc/cluster.xml ] ; then fi STATUS="Gathering sysctl information (sysctl -a):" -catiffile "sysctl -a 2>/dev/null" +catifexec "/sbin/sysctl" "-a" STATUS="Gathering sysctl information (/etc/sysctl.conf):" catiffile "/etc/sysctl.conf" @@ -551,11 +507,6 @@ if [ $os = "redhat" ]; then catifexec "rpm" "-q -V selinux-policy-strict" fi -if [ $usevserver = yes ]; then - STATUS="Gathering vserver information" - catiffile "/proc/virtual" -fi - if [ "$partitions" == "yes" ]; then if [ "$dosfdisk" == "yes" ]; then if [ ! -x "$SFDISK" ]; then @@ -594,7 +545,7 @@ if [ "$hardware" == "yes" ]; then echo -e "\n\n====================== summary ======================\n" >> $hardwarefile debug "$HWINFO --short --cpu --network --disk --pci >> $hardwarefile" $HWINFO --short --cpu --network --disk --pci >> $hardwarefile - for flag in cpu network bios pci; do + for flag in cpu network disk bios pci; do echo -e "\n\n====================== $flag ======================\n" >> $hardwarefile $HWINFO --$flag >> $hardwarefile done @@ -609,12 +560,18 @@ fi if [ "$partitions" == "yes" ]; then if [ "$dosfdisk" == "yes" ]; then devices=`LC_ALL=C $LSBLK --output NAME,TYPE --list --paths 2>/dev/null | grep "disk$" | grep -v '^/dev/zram' | @AWK@ '{print $1}'` + partitions=`LC_ALL=C $SFDISK -l 2>/dev/null |grep "^/dev" | @AWK@ '{print $1}'` if [ "$devices" == "" ]; then warning "No harddisks found" fi for dev in $devices; do debug "$SFDISK will try to backup partition tables for device $dev" [ -b $dev ] || continue + echo "${partitions}" | grep -q "${dev}" + if [ $? -ne 0 ] ; then + info "The device $dev does not appear to have any partitions" + continue + fi label=${dev#/dev/} label=${label//\//-} outputfile=${partitionsfile//__star__/$label} @@ -633,8 +590,10 @@ if [ "$partitions" == "yes" ]; then fi if [ "$luksheaders" == "yes" ]; then - devices=`LC_ALL=C $SFDISK -l 2>/dev/null | grep -E '^(Disk )?/dev/' | @SED@ -e 's/Disk //' -re 's/:? +.*//g'` - [ -n "$devices" ] || warning "No block device found" + devices=`LC_ALL=C $LSBLK --output NAME,TYPE --list --paths 2>/dev/null | grep "disk$" | grep -v '^/dev/zram' | @AWK@ '{print $1}'` + if [ "$devices" == "" ]; then + warning "No harddisks found" + fi partitions=`LC_ALL=C $SFDISK -l 2>/dev/null |grep "^/dev" | @AWK@ '{print $1}'` [ -n "$partitions" ] || warning "No partitions found" targetdevices="" @@ -648,20 +607,9 @@ if [ "$luksheaders" == "yes" ]; then label=${dev#/dev/} label=${label//\//-} outputfile=${luksheadersfile//__star__/$label} - # the following sizes are expressed in terms of 512-byte sectors - debug "Let us find out the LUKS header size for $dev" - debug "$CRYPTSETUP luksDump \"$dev\" | grep '^Payload offset:' | @AWK@ '{print $3}'" - headersize=`$CRYPTSETUP luksDump "$dev" | grep '^Payload offset:' | @AWK@ '{print $3}'` - if [ $? -ne 0 ]; then - warning "Could not compute the size of LUKS header, skipping $dev" - continue - elif [ -z "$headersize" -o -n "`echo \"$headersize\" | @SED@ 's/[0-9]*//g'`" ]; then - warning "The computed size of LUKS header is not an integer, skipping $dev" - continue - fi debug "Let us backup the LUKS header of $dev" - debug "$DD if=\"${dev}\" of=\"${outputfile}\" bs=512 count=\"${headersize}\"" - output=`$DD if="${dev}" of="${outputfile}" bs=512 count="${headersize}" 2>&1` + debug "$CRYPTSETUP luksHeaderBackup \"${dev}\" --header-backup-file \"${outputfile}\"" + output=`$CRYPTSETUP luksHeaderBackup "${dev}" --header-backup-file "${outputfile}" 2>&1` exit_code=$? if [ $exit_code -eq 0 ]; then debug "$output" diff --git a/handlers/tar.in b/handlers/tar.in index 7497306c8bb88d19e4e999f611320bd2db757a1c..991d665be5a3c9519b1f4910c62ddb09153a6e1c 100644 --- a/handlers/tar.in +++ b/handlers/tar.in @@ -14,12 +14,6 @@ getconf EXTENSION tar getconf DATE `which date` getconf DATEFORMAT "%Y.%m.%d-%H%M" -# See if vservers are configured -if [ "$vservers" = "yes" ] -then - warning "vservers enabled, but tar does not support it!" -fi - if [ ! -d "$backupdir" ] then mkdir -p "$backupdir" || fatal "Can not make directory $backupdir" @@ -52,12 +46,16 @@ case $compress in compress_option="-J" EXTENSION="tar.xz" ;; + "zstd") + compress_option="--zstd" + EXTENSION="tar.zst" + ;; "none") compress_option="" ;; *) - warning "Unknown compress filter ($tar_compress)" - compress_option="" + warning "Unknown compress filter ($compress), defaulting to gzip" + compress_option="-z" EXTENSION="tgz" ;; esac diff --git a/handlers/wget b/handlers/wget index 79aa22c7280e432d3675b8ed9c48d177b0423509..9046b4642c109d5c6dd408cbf871c12a742a6979 100644 --- a/handlers/wget +++ b/handlers/wget @@ -19,6 +19,7 @@ # days = number of backup increments (min = 5) # lockfile = lockfile to be kept during backup execution # nicelevel = wget command nice level +# ionicelevel = ionice best-effort level applied to wget command # enable_mv_timestamp_bug = set to "yes" if your system isnt handling timestamps correctly # tmp = temp folder # @@ -63,6 +64,7 @@ getconf rotate getconf days getconf lockfile getconf nicelevel 0 +getconf ionicelevel getconf enable_mv_timestamp_bug no getconf tmp /tmp @@ -145,6 +147,10 @@ else nice="" fi +if [ -n "$ionicelevel" ]; then + nice="ionice -c2 -n $ionicelevel $nice" +fi + # set mv procedure if [ $enable_mv_timestamp_bug == "yes" ]; then diff --git a/install-sh b/install-sh index 59990a10492675f2e87d5e5df17b566d145d9aee..8175c640fe6288a75cc846567ea5506086f326f4 100755 --- a/install-sh +++ b/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2014-09-12.12; # UTC +scriptversion=2018-03-11.20; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -271,15 +271,18 @@ do fi dst=$dst_arg - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. + # If destination is a directory, append the input filename. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst - dst=$dstdir/`basename "$src"` + dstbase=`basename "$src"` + case $dst in + */) dst=$dst$dstbase;; + *) dst=$dst/$dstbase;; + esac dstdir_status=0 else dstdir=`dirname "$dst"` @@ -288,6 +291,11 @@ do fi fi + case $dstdir in + */) dstdirslash=$dstdir;; + *) dstdirslash=$dstdir/;; + esac + obsolete_mkdir_used=false if test $dstdir_status != 0; then @@ -324,14 +332,16 @@ do # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) - # $RANDOM is not portable (e.g. dash); use it when possible to - # lower collision chance + # Note that $RANDOM variable is not portable (e.g. dash); Use it + # here however when possible just to lower collision chance. tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 - # As "mkdir -p" follows symlinks and we work in /tmp possibly; so - # create the $tmpdir first (and fail if unsuccessful) to make sure - # that nobody tries to guess the $tmpdir name. + # Because "mkdir -p" follows existing symlinks and we likely work + # directly in world-writeable /tmp, make sure that the '$tmpdir' + # directory is successfully created first before we actually test + # 'mkdir -p' feature. if (umask $mkdir_umask && $mkdirprog $mkdir_mode "$tmpdir" && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 @@ -434,8 +444,8 @@ do else # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ + dsttmp=${dstdirslash}_inst.$$_ + rmtmp=${dstdirslash}_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 @@ -500,9 +510,9 @@ do done # Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: diff --git a/lib/Makefile.am b/lib/Makefile.am index 9a54736a2353906a139c38141a8c59fad313e42e..2180adc6e43e0fc8a5bbe08dfff1c1b9bffcc226 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,9 +1,9 @@ my_execbindir = $(pkglibdir) -my_execbin_SCRIPTS = easydialog parseini tools vserver +my_execbin_SCRIPTS = easydialog parseini tools CLEANFILES = $(my_execbin_SCRIPTS) -EXTRA_DIST = easydialog.in parseini.in tools.in vserver.in +EXTRA_DIST = easydialog.in parseini.in tools.in edit = sed \ -e "s,@CFGDIR\@,$(CFGDIR),g" \ @@ -24,7 +24,3 @@ parseini: $(srcdir)/parseini.in tools: $(srcdir)/tools.in rm -f tools $(edit) tools.in > tools - -vserver: $(srcdir)/vserver.in - rm -f vserver - $(edit) vserver.in > vserver diff --git a/lib/Makefile.in b/lib/Makefile.in index f269ef720278571af8193c0412d72a6eb40b958e..e87df6cc7676083313ba80feb5202a2e884a12b5 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -229,9 +229,9 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ my_execbindir = $(pkglibdir) -my_execbin_SCRIPTS = easydialog parseini tools vserver +my_execbin_SCRIPTS = easydialog parseini tools CLEANFILES = $(my_execbin_SCRIPTS) -EXTRA_DIST = easydialog.in parseini.in tools.in vserver.in +EXTRA_DIST = easydialog.in parseini.in tools.in edit = sed \ -e "s,@CFGDIR\@,$(CFGDIR),g" \ -e "s,@BASH\@,$(BASH),g" \ @@ -260,8 +260,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -314,7 +314,10 @@ ctags CTAGS: cscope cscopelist: -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -477,10 +480,6 @@ tools: $(srcdir)/tools.in rm -f tools $(edit) tools.in > tools -vserver: $(srcdir)/vserver.in - rm -f vserver - $(edit) vserver.in > vserver - # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/lib/vserver.in b/lib/vserver.in deleted file mode 100644 index b356b2b42697449a739e3e0f654c9d7d46f2f391..0000000000000000000000000000000000000000 --- a/lib/vserver.in +++ /dev/null @@ -1,251 +0,0 @@ -# -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- -# vim: set filetype=sh sw=3 sts=3 expandtab autoindent: - -##################################################### -## VSERVERS RELATED FUNCTIONS FOR NINJAHELPER -## -## Depends on: -## - easydialog library -## - $conffile -## -## Global variables used and modified here: -## - $vservers_are_available (yes/no) -## - $found_vservers (list) -## - $selected_vservers (list) -## - $host_or_vservers (host/vservers/both) -## - -## -## Get vservers-related variables. -## Then, if Vservers are enabled, check that: -## - VROOTDIR is valid; -## - at least one vserver can be found. -## If, and only if, the above conditions are all true: -## - set $vservers_are_available to 'yes'; -## - set $found_vservers to the list of all vservers found on the system. -## This function has to be run once before a new helper is run. -## If the argument is "nodialog", use the backupninja's message functions -## instead of easydialog. -## -init_vservers() { - local arg=$1 - # get global variables from the conffile - setfile $conffile - getconf vservers no - getconf VSERVERINFO /usr/sbin/vserver-info - getconf VSERVER /usr/sbin/vserver - getconf VROOTDIR `if [ -x "$VSERVERINFO" ]; then $VSERVERINFO info SYSINFO | grep '^ *vserver-Rootdir' | @AWK@ '{print $2}'; fi` - # canonicalize VROOTDIR - [ -z "$VROOTDIR" ] || VROOTDIR=`readlink --canonicalize $VROOTDIR` - # init this library's global variables - vservers_are_available=no - found_vservers= - selected_vservers= - host_or_vservers=host - # check vservers real availability - if [ $vservers = yes ]; then - if [ ! -x "$VSERVERINFO" ]; then - `if [ "$arg" = nodialog ]; then echo fatal; else echo "msgBox warning"; fi` \ - "vservers enabled in $conffile, but vserver-info command was not found. Please set the VSERVERINFO configuration variable to its full path." - return - fi - if [ ! -x "$VSERVER" ]; then - `if [ "$arg" = nodialog ]; then echo fatal; else echo "msgBox warning"; fi` \ - "vservers enabled in $conffile, but vserver command was not found. Please set the VSERVER configuration variable to its full path." - return - fi - if [ -z "$VROOTDIR" ]; then - `if [ "$arg" = nodialog ]; then echo fatal; else echo "msgBox warning"; fi` \ - "vservers enabled in $conffile, but VROOTDIR is not set and could not be guessed." - return - fi - if [ ! -d "$VROOTDIR" ]; then - `if [ "$arg" = nodialog ]; then echo fatal; else echo "msgBox warning"; fi` \ - "vservers enabled in $conffile, but VROOTDIR ($VROOTDIR) does not exist."; - return - fi - found_vservers=`ls $VROOTDIR | grep -E -v "lost\+found|ARCHIVES" | tr "\n" " "` - if [ -z "$found_vservers" ]; then - `if [ "$arg" = nodialog ]; then echo warning; else echo "msgBox warning"; fi` \ - "vservers enabled in $conffile, but no vserver was found in $VROOTDIR."; - return - fi - vservers_are_available=yes - fi -} - -## -## If all the arguments are existing vservers names, returns 0. -## Else, returns 1. Also returns 1 if no argument is given. -## -vservers_exist() { - [ $# -ge 1 ] || return 1 - local args="$1" - local vserver i found - for vserver in $args ; do - found=no - for i in $found_vservers ; do - if [ $vserver = $i ]; then - found=yes - break - fi - done - [ $found = yes ] || return 1 - done - return 0 -} - -## -## If all the arguments are running vservers names, returns 0. -## Else, returns 1. Also returns 1 if no argument is given. -## -vservers_running() { - [ $# -ge 1 ] || return 1 - local args="$1" - local vserver - for vserver in $args ; do - $VSERVERINFO -q $vserver RUNNING || return 1 - done - return 0 -} - -## -## If the argument is the name of a vserver selected by the current helper, -## echoes 'on' and returns 0. -## Else, echoes 'off' and returns 1. -## -vserver_is_selected() { - local vserver=$1 - local vserver_is_selected=1 - local i - for i in $selected_vservers ; do - [ "$vserver" == "$i" ] && vserver_is_selected=0 - done - if [ $vserver_is_selected = 0 ]; then - echo on - else - echo off - fi - return $vserver_is_selected -} - -## -## Have the user choose one Vserver among the existing ones. -## Set $selected_vservers to the chosen one's name. -## Returns 1 if cancelled or if Vservers are not available. -## -choose_one_vserver() { - [ "$vservers_are_available" == "yes" ] || return 1 - local title=$1 - local i= - local vserver= - REPLY= - while [ -z "$REPLY" ]; do - [ -n "$selected_vservers" ] && setDefault $selected_vservers - listBegin "$title" "Choose at least one Linux-Vserver to backup:" - for vserver in $found_vservers; do - listItem "$vserver" "Backup $vserver vserver" - done - listDisplay menu - [ $? = 0 ] || return 1 - done - selected_vservers=$REPLY -} - -## -## If Vservers are not enabled, set host_or_vservers='host' and then return -## Else, have the user choose if he/she wants to perform the backup on the host -## system or on one Vserver. -## Set, respectively, $host_or_vservers to 'host' or 'vservers'. -## Returns 1 if cancelled. -## -choose_host_or_one_vserver() { - if [ "$vservers_are_available" != "yes" ] - then - host_or_vservers='host' - return - fi - local title=$1 - # if there is one, set the previously chosen item as the default - [ -n "$host_or_vservers" ] && setDefault $host_or_vservers - menuBox "$title - src" "Do you want to operate on the host system and/or on vservers?" \ - "host" "Host system" \ - "vserver" "One Vserver" - [ $? = 0 ] || return 1 - case $REPLY in - "host") - host_or_vservers='host' - ;; - "vserver") - host_or_vservers='vservers' - ;; - esac -} - -## -## If Vservers are not enabled, set host_or_vservers='host' and then return -## Else, have the user choose the target he/she wants to perform the backup on: -## - host system only; -## - some vservers only; -## - both the host system and some vservers. -## Set, respectively, $host_or_vservers to 'host', 'vservers', or 'both' -## Returns 1 if cancelled. -## -choose_host_or_vservers_or_both() { - if [ "$vservers_are_available" != "yes" ] - then - host_or_vservers='host' - return - fi - local title=$1 - # if there is one, set the previously chosen item as the default - [ -n "$host_or_vservers" ] && setDefault $host_or_vservers - menuBox "$title - src" "Do you want to operate on the host system and/or on vservers?" \ - "host" "Host system only" \ - "vservers" "Vservers only" \ - "both" "Host system and Vservers" - [ $? = 0 ] || return 1 - case $REPLY in - "host") - host_or_vservers='host' - ;; - "vservers") - host_or_vservers='vservers' - ;; - "both") - host_or_vservers='both' - ;; - esac -} - -## -## Have the user choose among "all vservers" and a not-empty subset of these. -## Set $selected_vservers to 'all' or to a space-separated name list. -## Returns 1 if cancelled or if Vservers are not available. -## -choose_one_or_more_vservers() { - [ "$vservers_are_available" == "yes" ] || return 1 - local title=$1 - local i= - # UI - booleanBox "$title" "Do you want to backup all vservers?" ` [ -z "$selected_vservers" -o "$selected_vservers" == "all" ] || echo no` - if [ $? = 0 ]; then - selected_vservers="all" - else - # choose among the existing vservers - local vserver= - local vserver_was_selected= - REPLY= - while [ -z "$REPLY" ]; do - listBegin "$title" "Choose at least one Linux-Vserver to backup:" - # list existing vservers, preselecting the previously selected ones - for vserver in $found_vservers; do - listItem "$vserver" "Backup $vserver vserver" `vserver_is_selected $vserver` - done - listDisplay checklist - [ $? = 0 ] || return 1 - done - # remove quotes around each vserver name - selected_vservers=`echo $REPLY | tr -d '"'` - fi -} diff --git a/man/Makefile.in b/man/Makefile.in index b5d94385edc76285af8f86fa58277d22bb4c56c0..ad0a151d982804332940fa12119d07128f7a1356 100644 --- a/man/Makefile.in +++ b/man/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -252,8 +252,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -357,7 +357,10 @@ ctags CTAGS: cscope cscopelist: -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ diff --git a/man/backup.d.5 b/man/backup.d.5 index 5b7a62625641b2c6ca146943848a567ebbcf064c..5178067178d7dc1e574f60cc69f82b0758d81e1d 100644 --- a/man/backup.d.5 +++ b/man/backup.d.5 @@ -3,7 +3,7 @@ .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .TH BACKUP.D 5 "October 10, 2005" "riseup" "backupninja package" -.SH NAME +.SH NAME BACKUP.D \- Action configuration files for \fBbackupninja(1)\fP. .\" Please adjust this date whenever revising the manpage. @@ -31,6 +31,8 @@ To preform the actual backup actions, backupninja processes each action configur run this file as a shell script. .IP .rdiff backup action for rdiff-backup. +.IP .restic +backup action for restic. .IP .dup backup action for duplicity. .IP .borg @@ -51,9 +53,9 @@ backup action for safe backups of trac repositories. backup action for burning backups to CD/DVD or creating ISOs. .TP -These files must be owned by root and must not be world or group readable/writable. Support for additional configuration types can be added by dropping bash scripts with the name of the suffix into /usr/share/backupninja. +These files must be owned by root and must not be world or group readable/writable. Support for additional configuration types can be added by dropping bash scripts with the name of the suffix into /usr/share/backupninja. .TP -The configuration files are processed in alphabetical order. However, it is suggested that you name the config files in "sysvinit style." +The configuration files are processed in alphabetical order. However, it is suggested that you name the config files in "sysvinit style." .TP For example: 10-local.pgsql.disabled @@ -83,7 +85,7 @@ These values for "when" are invalid: when = tuesday at 2 when = tues at 02 -A configuration file will be processed at the time(s) specified by the "when" option. If multiple "when" options are present, then they all apply. If two configurations files are scheduled to run in the same hour, then we fall back on the alphabetical ordering specified above. The "when" must occur before any sections in the action configuration file. +A configuration file will be processed at the time(s) specified by the "when" option. If multiple "when" options are present, then they all apply. If two configurations files are scheduled to run in the same hour, then we fall back on the alphabetical ordering specified above. The "when" must occur before any sections in the action configuration file. .SH FILE FORMAT @@ -99,9 +101,9 @@ The file format of the action configuration files is "ini style." Sections are c i will not have a pear. .SH SEE ALSO -.BR backupninja (1), -.BR ninjahelper (1), -.BR backupninja.conf (5), +.BR backupninja (1), +.BR ninjahelper (1), +.BR backupninja.conf (5), .br .SH AUTHOR BACKUPNINJA was written by the riseup.net collective. diff --git a/man/backupninja.1 b/man/backupninja.1 index 84508f6dd01433c18c6303fe60452ea1a5e76d06..fa4fcd017fb01d27f079dd4c99737baafc7c42e7 100644 --- a/man/backupninja.1 +++ b/man/backupninja.1 @@ -21,10 +21,10 @@ BACKUPNINJA \- A lightweight, extensible meta-backup system .I "a silent flower blossom death strike to lost data." .SH SYNOPSIS -.B "backupninja [ \-h ] [ \-d ] [ \-n ] [ \-t ] [ \-f filename ] [ \-\-run filename ]" +.B "backupninja [ \-h ] [ \-v ] [ \-d ] [ \-n ] [ \-t ] [ \-f filename ] [ \-\-run filename ]" .br .SH DESCRIPTION -.B Backupninja +.B Backupninja allows you to coordinate system backups by dropping a few simple configuration files into /etc/backup.d/. Most programs you might use for making backups don't have their own configuration file @@ -47,8 +47,6 @@ console-based wizard (ninjahelper) makes it easy to create backup action configu passwords are never sent via the command line to helper programs. .IP - in order to backup a db or sql database, you cannot simply copy database files. backupninja helps you safely export the data to a format which you can backup. -.IP - -works with Linux-Vservers. .B Backup types include: .IP - 2 @@ -60,27 +58,30 @@ encrypted remote backups (via duplicity). .IP - safe backup of MySQL, PostgreSQL, OpenLDAP, and subversion databases. .IP - -burn CD/DVDs or create ISOs. - +burn CD/DVDs or create ISOs. + .\" TeX users may be more comfortable with the \fB<whatever>\fP and -.\" \fI<whatever>\fP escape sequences to invoke bold face and italics, +.\" \fI<whatever>\fP escape sequences to invoke bold face and italics, .\" respectively. .SH OPTIONS .TP -.B \-h, \-\-help +.B \-h, \-\-help Show summary of options .TP -.B \-d, \-\-debug +.B \-V, \-\-version +Show backupninja version number +.TP +.B \-d, \-\-debug Run in debug mode, where all log messages are output to the current shell. .TP -.B \-f, \-\-conffile CONF_FILE +.B \-f, \-\-conffile CONF_FILE Use CONF_FILE for the main configuration instead of /etc/backupninja.conf .TP -.B \-t, \-\-test +.B \-t, \-\-test Run in test mode, no actions are actually taken. .TP -.B \-n, \-\-now +.B \-n, \-\-now Perform actions now, instead of when they might be scheduled. .TP .B \-\-run ACTION_FILE @@ -110,6 +111,18 @@ root@srchost# ssh-copy-id \-i /root/.ssh/id_dsa.pub backup@desthost .TP Now, you should be able to ssh from user 'root' on srchost to user 'backup' on desthost without specifying a password. When prompted for a password by ssh-keygen, just leave it blank by hitting return. The "wizard" \fBninjahelper(1)\fP will walk you through these steps. +.SH EXIT VALUES +.PD 0 +\fB0\fP success +.br +\fB1\fP errors or warnings emitted during backup +.br +\fB2\fP one or more backup actions failed +.br +\fB3\fP syntax or usage error +.br +.PD + .SH FILES .PD 0 \fB/usr/sbin/backupninja\fP main script @@ -129,9 +142,9 @@ Now, you should be able to ssh from user 'root' on srchost to user 'backup' on d .PD .SH SEE ALSO -.BR ninjahelper (1), -.BR backupninja.conf (5), -.BR backup.d (5), +.BR ninjahelper (1), +.BR backupninja.conf (5), +.BR backup.d (5), .br .SH AUTHOR BACKUPNINJA was written by the riseup.net collective. diff --git a/man/backupninja.conf.5 b/man/backupninja.conf.5 index a87bab7aeb8b353e0ad5818aa9f26040db6df453..72de35af9532a7d7b96b4eb92bb9adec8356076f 100644 --- a/man/backupninja.conf.5 +++ b/man/backupninja.conf.5 @@ -3,7 +3,7 @@ .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .TH BACKUPNINJA.CONF 5 "November 19, 2005" "riseup" "backupninja package" -.SH NAME +.SH NAME BACKUPNINJA.CONF \- Configuration file(s) for \fBbackupninja (1)\fP. .\" Please adjust this date whenever revising the manpage. @@ -30,7 +30,7 @@ is the general configuration file. In this file you can set the log level and ch .TP .B loglevel -How verbose to make the logs. +How verbose to make the logs. .br 5 = Debugging messages .br @@ -40,7 +40,7 @@ How verbose to make the logs. .br 2 = Errors .br -1 = Fatal errors +1 = Fatal errors .TP .B reportemail @@ -62,8 +62,8 @@ The path of the logfile. .B configdirectory The directory where all the backup action configuration files live. -.TP -.B scriptdirectory +.TP +.B scriptdirectory Where backupninja handler scripts are found .TP @@ -91,18 +91,12 @@ These values for 'when' are equivalent: when = TUESDAYS at 05 These values for 'when' are invalid: - + when = tuesday at 2am when = tuesday at 2 when = tues at 02 .TP -.B vservers -If you are using Linux-Vservers (http://linux-vserver.org), there are some -special capabilities that different handlers have to make vserver backups easier. -See the example configuration files for each handler to configure the vserver specific -variables. - .SH DEFAULTS loglevel = 4 @@ -119,16 +113,14 @@ configdirectory = /etc/backup.d .br scriptdirectory = /usr/share/backupninja .br -usecolors = yes +usecolors = yes .br when = everyday at 01:00 -.br -vservers = no .SH SEE ALSO -.BR backupninja (1), -.BR ninjahelper (1), -.BR backup.d (5), +.BR backupninja (1), +.BR ninjahelper (1), +.BR backup.d (5), .br .SH AUTHOR BACKUPNINJA was written by the riseup.net collective. diff --git a/man/ninjahelper.1 b/man/ninjahelper.1 index 0135f693fa73145d3125d7cbfb7a5fc14306d588..41f70cc6aaea35af1c488fc4cee8cdd0a41054ca 100644 --- a/man/ninjahelper.1 +++ b/man/ninjahelper.1 @@ -25,7 +25,7 @@ backupninja configuration. .SH DESCRIPTION .B Ninjahelper is an helper script to walk you through configuration of the backup -tasks for backupninja. It is a curses based "wizard" with an intuitive +tasks for backupninja. It is a curses based "wizard" with an intuitive menu-driven interface. .PP .SH ADDING NEW HELPERS @@ -38,15 +38,14 @@ handler "blue", create the file /usr/share/backupninja/blue.helper. .IP (2) next, add your helper to the global HELPERS variable and define the main function for your helper (the function name is always <helper>_wizard). To -use the blue.helper as an example: +use the blue.helper as an example: HELPERS="$HELPERS blue:description_of_this_helper" blue_wizard() { ... do work here ... } .IP (3) look at the existing helpers to see how they are written. Try to re-use -functions, such as the dialog functions that are defined in easydialog.sh, -or the vserver functions defined in lib/vserver. +functions, such as the dialog functions that are defined in easydialog.sh. .IP (4) test, re-test, and test again. Try to break the helper by going backwards, try to think like someone who has no idea how to configure your handler @@ -54,9 +53,9 @@ would think, try to make your helper as simple as possible. Walk like a cat, become your shadow, don't let your senses betray you. .SH SEE ALSO -.BR backupninja (1), -.BR backupninja.conf (5), -.BR backup.d (5), +.BR backupninja (1), +.BR backupninja.conf (5), +.BR backup.d (5), .br .SH AUTHOR BACKUPNINJA was written by the riseup.net collective. diff --git a/missing b/missing index f62bbae306c7e1bc28896aab8fe7bfb700a9a33e..625aeb11897a2221d5cda1d55b6866d61d21f660 100755 --- a/missing +++ b/missing @@ -1,9 +1,9 @@ #! /bin/sh # Common wrapper for a few potentially missing GNU programs. -scriptversion=2013-10-28.13; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. # This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ scriptversion=2013-10-28.13; # UTC # 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, see <http://www.gnu.org/licenses/>. +# along with this program. If not, see <https://www.gnu.org/licenses/>. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -101,9 +101,9 @@ else exit $st fi -perl_URL=http://www.perl.org/ -flex_URL=http://flex.sourceforge.net/ -gnu_software_URL=http://www.gnu.org/software +perl_URL=https://www.perl.org/ +flex_URL=https://github.com/westes/flex +gnu_software_URL=https://www.gnu.org/software program_details () { @@ -207,9 +207,9 @@ give_advice "$1" | sed -e '1s/^/WARNING: /' \ exit $st # Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: diff --git a/src/Makefile.am b/src/Makefile.am index 5694e9af651c76509ddfe8ec97686a98830abf1d..4f4680af12a52c975a6e07023a0222bc2ec296c9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -15,7 +15,8 @@ edit = sed \ -e 's,@datadir\@,$(pkgdatadir),g' \ -e "s,@libdir\@,$(pkglibdir),g" \ -e 's,@localstatedir\@,$(localstatedir),g' \ - -e 's,@prefix\@,$(prefix),g' + -e 's,@prefix\@,$(prefix),g' \ + -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' #install-exec-hook: diff --git a/src/Makefile.in b/src/Makefile.in index f0b56b2b245e8a21489613596081d743e8e23e73..e8a8394c3e45a7ec722f4471b7e298c8cb1b383e 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -244,7 +244,8 @@ edit = sed \ -e 's,@datadir\@,$(pkgdatadir),g' \ -e "s,@libdir\@,$(pkglibdir),g" \ -e 's,@localstatedir\@,$(localstatedir),g' \ - -e 's,@prefix\@,$(prefix),g' + -e 's,@prefix\@,$(prefix),g' \ + -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' all: all-am @@ -266,8 +267,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -320,7 +321,10 @@ ctags CTAGS: cscope cscopelist: -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ diff --git a/src/backupninja.in b/src/backupninja.in index 756c67816c7d8df45414105ff761a1ca87275e58..5157efc04267d5d00a6a4fc96495f3c4cf67b639 100755 --- a/src/backupninja.in +++ b/src/backupninja.in @@ -186,7 +186,7 @@ function tolower() { # simple to integer function function toint() { - echo "$1" | tr -d '[:alpha:]' + echo "$1" | @SED@ 's/[^0-9]//g;s/^0\+//' } # @@ -202,7 +202,7 @@ function toint() { # we grab the current time once, since processing # all the configs might take more than an hour. nowtime=`LC_ALL=C date +%H` -nowday=`LC_ALL=C date +%d` +nowday=`LC_ALL=C date +%-d` nowdayofweek=`LC_ALL=C date +%A` nowdayofweek=`tolower "$nowdayofweek"` @@ -226,7 +226,7 @@ function isnow() { if [ "$whendayofweek" != "$nowdayofweek" ]; then whendayofweek=${whendayofweek%s} if [ "$whendayofweek" != "$nowdayofweek" ]; then - if [ "$whendayofweek" != "mondays" -a "$whendayofweek" != "tuesdays" -a "$whendayofweek" != "wednesdays" -a "$whendayofweek" != "thursdays" -a "$whendayofweek" != "fridays" -a "$whendayofweek" != "saturdays" -a "$whendayofweek" != "sundays" ]; then + if [ "$whendayofweek" != "monday" -a "$whendayofweek" != "tuesday" -a "$whendayofweek" != "wednesday" -a "$whendayofweek" != "thursday" -a "$whendayofweek" != "friday" -a "$whendayofweek" != "saturday" -a "$whendayofweek" != "sunday" ]; then warning "The day in the 'when' option in the configuration is malformed. Please read the README for examples." fi if [ "$at" != "at" ]; then @@ -234,13 +234,13 @@ function isnow() { fi if [[ "$whentimeoriginal" != @([0-9][0-9])?(:[0-9][0-9]) ]]; then warning "The time in the 'when' option in the configuration is malformed or does not exist. Please read the README for examples." - fi + fi return 0 fi fi elif [ "$whenday" != "$nowday" ]; then if [ "$whenday" -lt 1 -o "$whenday" -gt 31 ]; then - warning "The numeric value of the day in the 'when' option in the configuration does not match a day. Please read the README for examples." + warning "The numeric value of the day in the 'when' option in the configuration does not match a day. Please read the README for examples." fi if [ -z "$whentime" ]; then warning "The 'when' variable in the configuration file is malformed. You either didn't specify the day or the time. Please read the README for eamples." @@ -278,6 +278,7 @@ script is run hourly from cron. The following options are available: -h, --help This usage message +-V, --version Show backupninja version number -d, --debug Run in debug mode, where all log messages are output to the current shell. -f, --conffile FILE Use FILE for the main configuration instead @@ -374,8 +375,8 @@ function process_action() { [ $debug ] && colorize "$a" done ) - retcode=$? - # ^^^^^^^^ we have a problem! we can't grab the return code "$?". grrr. + retcode=${PIPESTATUS[0]} + debug "handler returned exit code $retcode" echo_debug_msg=0 else @@ -431,12 +432,14 @@ function process_action() { setupcolors conffile="@CFGDIR@/backupninja.conf" loglevel=3 +version="@PACKAGE_VERSION@" ## process command line options while [ $# -ge 1 ]; do case $1 in -h|--help) usage;; + -V|--version) echo "backupninja $version";; -d|--debug) debug=1; export BACKUPNINJA_DEBUG=yes;; -t|--test) test=1;debug=1;; -n|--now) processnow=1;; @@ -465,10 +468,9 @@ while [ $# -ge 1 ]; do ;; *) debug=1 - echo "Unknown option $1" - fatal "Unknown option $1" + error "Unknown option $1" usage - exit + exit 3 ;; esac shift @@ -504,7 +506,6 @@ fi # include shared functions . $libdirectory/tools -. $libdirectory/vserver setfile $conffile @@ -543,10 +544,6 @@ getconf DSYNC /usr/bin/dsync getconf DOVEADM /usr/bin/doveadm getconf admingroup root -# initialize vservers support -# (get config variables and check real vservers availability) -init_vservers nodialog - if [ ! -d "$configdirectory" ]; then echo "Configuration directory '$configdirectory' not found." fatal "Configuration directory '$configdirectory' not found." @@ -556,7 +553,7 @@ fi if [ "$UID" != "0" ]; then echo "`basename $0` can only be run as root" - exit 1 + exit 3 fi ## Process each configuration file @@ -650,3 +647,11 @@ if [ -n "$reporthost" ]; then debug "send $logfile to $reportuser@$reporthost:$reportdirectory" rsync -qt $logfile $reportuser@$reporthost:$reportdirectory fi + +# return exit code +[ $halts == 0 ] || exit 2 +[ $fatals == 0 ] || exit 2 +[ $errors == 0 ] || exit 1 +[ "$reportwarning" == "yes" -a $warnings != 0 ] && exit 1 + +exit 0 diff --git a/src/ninjahelper.in b/src/ninjahelper.in index 4b4dceb555659b26d3b693f3116c2db4f2699607..1ab727a1726de3c00c88713e3bc741cea04755cf 100755 --- a/src/ninjahelper.in +++ b/src/ninjahelper.in @@ -43,8 +43,6 @@ require_packages() { ## menu for the wizards ## donew() { - # (re-)initialize vservers support - init_vservers # menu listBegin "new action menu" "select an action to create" listItem return "return to main menu" @@ -202,7 +200,6 @@ fi # include shared functions . $libdirectory/easydialog . $libdirectory/tools -. $libdirectory/vserver # am I running as root? if [ "$UID" != "0" ]; then