{"id":20174030,"url":"https://github.com/xor-gate/svn-backup2","last_synced_at":"2025-06-15T07:03:05.485Z","repository":{"id":219071069,"uuid":"748079262","full_name":"xor-gate/svn-backup2","owner":"xor-gate","description":"Frugal and efficient Subversion backup solution","archived":false,"fork":false,"pushed_at":"2024-07-01T11:44:48.000Z","size":75,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-15T07:02:37.494Z","etag":null,"topics":["backup","backup-cli","backup-script","backup-solution","subversion","subversion-backup"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xor-gate.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-01-25T08:25:09.000Z","updated_at":"2024-07-13T19:47:33.000Z","dependencies_parsed_at":"2024-01-29T13:09:37.614Z","dependency_job_id":"655265cf-135c-44c3-ad2c-fcae063c504d","html_url":"https://github.com/xor-gate/svn-backup2","commit_stats":null,"previous_names":["xor-gate/svn-backup2"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/xor-gate/svn-backup2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xor-gate%2Fsvn-backup2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xor-gate%2Fsvn-backup2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xor-gate%2Fsvn-backup2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xor-gate%2Fsvn-backup2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xor-gate","download_url":"https://codeload.github.com/xor-gate/svn-backup2/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xor-gate%2Fsvn-backup2/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259935589,"owners_count":22934384,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backup","backup-cli","backup-script","backup-solution","subversion","subversion-backup"],"created_at":"2024-11-14T01:41:07.758Z","updated_at":"2025-06-15T07:03:05.450Z","avatar_url":"https://github.com/xor-gate.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# svn-backup2\n\nThe `svn-backup2` application is a frugal Subversion backup solution inspired by [adamonduty/svn-backup](https://github.com/adamonduty/svn-backup).\nOrignally written and tested for Debian 12 in Bash but could be adapted to other systems.\n\nAt first run it generates a full-backup and runs `svnadmin verify`.\n\nThis script is designed to be run as root. But it is possible when correct permissions are given to run as non-root user.\n\n## Features and limitations\n\n### Single file mode\n\nIt creates and updates a single file per repository and consists of multiple gzip compressed archives. It is sha256 checksumed to\ndetect bit-rot before appending a new incremental backup. This is possible because `svnadmin load` is able to load from a stream of multiple dumps. \nThis is not rsync efficient.\n\n * Set `SVNBACKUP2_CFG_USE_SINGLE_FILE=1` (and `SVNBACKUP2_CFG_BACKUP_NR_DATASETS=0`)\n * Only supports one subversion root path which can contain multiple repositories\n * Single repository backup file for simplicity of restoration\n * Can only restore the whole backup file into an empty repository\n * `${SVNBACKUP2_CFG_BACKUP_PATH}/\u003crepository name\u003e.svnbackup2`: Backup file (multiple concatinated gzip files) (configurable)\n\n### Dataset mode\n\nIn dataset mode a full backup is written and per incremental run a new file is created. This is rsync efficient.\n\n * Set `SVNBACKUP2_CFG_BACKUP_NR_DATASETS=1` or higher (and `SVNBACKUP2_CFG_USE_SINGLE_FILE=0`) \n * `${SVNBACKUP2_CFG_BACKUP_PATH}/\u003crepository name\u003e/dataset_\u003cn\u003e/\u003crepository name\u003e_full.svnbackup2`: Full backup in dataset n\n * `${SVNBACKUP2_CFG_BACKUP_PATH}/\u003crepository name\u003e/dataset_\u003cn\u003e/\u003crepository name\u003e_incr_rev\u003cx\u003e-rev\u003cy\u003e.svnbackup2`: Incremental backup in dataset n\n\n## Installation\n\nInstall dependencies on Debian Linux 12:\n\n`apt install subversion curl`\n\nDownload and install version `0.2.2` to `/usr/local/bin/svn-backup2` in a oneliner with curl:\n\n```\nFILE=/usr/local/bin/svn-backup2 \u0026\u0026\ncurl -o ${FILE} https://raw.githubusercontent.com/xor-gate/svn-backup2/v0.2.2/svn-backup2 \u0026\u0026\nchmod -v 755 ${FILE} \u0026\u0026\nchown -v root:root ${FILE}\n```\n\n## Paths\n\n* `/etc/svn-backup2.conf`: Configuration file\n* `/var/log/svn-backup2.log`: Logfile\n* `/srv/svn`: Subversion repositories root path (configurable)\n* `/var/tmp/svn-backup2/\u003crepository name\u003e.state`: State of a single repository backup\n\n## Configuration file (`/etc/svn-backup2.conf`)\n\nThe file is a set of shell environment variables. It will be created on first run\nwith the following defaults:\n\n```\nSVNBACKUP2_CFG_VERSION=1\nSVNBACKUP2_CFG_REPOSITORIES_PATH=\"/srv/svn\"\nSVNBACKUP2_CFG_BACKUP_PATH=\"/srv/svn-backup2\"\nSVNBACKUP2_CFG_USE_SINGLE_FILE=1\nSVNBACKUP2_CFG_BACKUP_NR_DATASETS=0\n```\n\n## Repository backup state file\n\nA single repository backup state file is a dump of `SVNBACKUP2_REPO_STATE_*` environment variables\n\nExample:\n\n```\nSVNBACKUP2_REPO_STATE_CHECKSUM=a911966efe3b069c970ae5511e4a3e6c169bf993e9a3443d841d5d9002447388\nSVNBACKUP2_REPO_STATE_LAST_BACKUP_DURATION=1\nSVNBACKUP2_REPO_STATE_LAST_BACKUP_END_TIME=1706279396\nSVNBACKUP2_REPO_STATE_LAST_BACKUP_START_TIME=1706279396\nSVNBACKUP2_REPO_STATE_YOUNGEST=0\n```\n\n## Usage\n\n```\nUsage: svn-backup2 [operation] \u003cargs\u003e\n  none                            All repositories are checked and backuped\n  version                         Print the version\n  full [\u003crepository name\u003e | all]  Force full backup on given repository or \"all\"\n```\n\n## Cron in dataset mode\n\nWe use cron to cycle between the different datasets. As an example we generate a full\nbackup once a month. And the other days an incremental:\n\n```\n5 2 1 * * /usr/local/bin/svn-backup2 full all\n5 2 2-31 * * /usr/local/bin/svn-backup2\n```\n\n## Restoration of single file\n\nsvn-backup2 generates simple subversion dumpfiles that can be stream loaded into\n`svnadmin load`.\n\nStep 1: Create an empty repository\n\n```\nsvnadmin create /srv/svn/repository_1\n```\n\nStep 2: Uncompress the dumpfile as stream and load into svnadmin\n\n```\nzcat /srv/svn-backup2/repository_1.svnbackup2 | svnadmin load /srv/svn/repository_1\n```\n\nStep 3: There is no step 3!\n\nA simple shell command can load all repositories at once:\n\n```\nfind . -type f -name \"*.svnbackup2\" | while read i; do repository_name=`basename \"$i\" .svnbackup2`; svnadmin create \"$repository_name\" \u0026\u0026 zcat \"$i\" | svnadmin load \"$repository_name\"; done\n```\n\n## Restoration of dataset\n\nWith `ls` you can sort on creation date and load it with `svnadmin`\n\n```\n$ svnadmin create /tmp/testrepo\n$ for backup in `ls -1 -r -t --time=creation /srv/svn-backup2/testrepo2/dataset_1/*`; do zcat $backup | svnadmin load /tmp/testrepo; done\n```\n\n# License\n\nsvn-backup2 is copyright 2024 by Jerry Jacobs and distributed under the terms of the MIT License. See the [LICENSE](LICENSE) file for further information.\n\n## Alternatives\n\n* [adamonduty/svn-backup](https://github.com/adamonduty/svn-backup) written in Ruby (defunc on Debian 12)\n* [loresoft/SvnTools](https://github.com/loresoft/SvnTools) written in C#\n* [ghstwhl/SVNBackup](https://github.com/ghstwhl/SVNBackup) written in Perl\n* [gcraig/SVNBackup](https://github.com/gcraig/SVNBackup) written in Python\n* [subversion-tools](https://packages.debian.org/sid/subversion-tools) multiple tools written in C/Perl\n* [avalax/svnbackup](https://github.com/avalax/svnbackup) shell script using svn-hot-backup\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxor-gate%2Fsvn-backup2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxor-gate%2Fsvn-backup2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxor-gate%2Fsvn-backup2/lists"}