diff options
| author | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-06-03 13:21:53 +0300 |
|---|---|---|
| committer | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-06-03 13:21:53 +0300 |
| commit | 79b8cb05f82248c204950ac38d73794d7a8ff3a4 (patch) | |
| tree | 2152be33631279d8d1394f5c566701bf42b7e86c | |
| parent | 3a05d416ea96d6a2e711a554d1824d9d72533a3b (diff) | |
| download | RepoSync-79b8cb05f82248c204950ac38d73794d7a8ff3a4.tar RepoSync-79b8cb05f82248c204950ac38d73794d7a8ff3a4.tar.gz RepoSync-79b8cb05f82248c204950ac38d73794d7a8ff3a4.zip | |
| -rw-r--r-- | README.md | 35 |
1 files changed, 34 insertions, 1 deletions
@@ -1,3 +1,36 @@ # RepoSync -A script (and some config files) with which you can automatically synchronize a git repository on a server
\ No newline at end of file +A simple Python script with which you can synchronize chosen git repositories. + +### Dependencies + +1. `Python`: you need to install Python, version **3.6** or later + - Debian and Ubuntu: `sudo apt install python3-pip` +2. `Pip3`: it should come with you install of Python, but check if you have it, just in case +3. `GitPython`: this is the git module via which the script executes git commands + - You install it with pip: `sudo -H pip3 install GitPython` + +## reposync.py + +This is the main script, it looks at the repositories inside `repositories.txt`, fetches them and if there are any updates to the **active branch**'s remote: it pulls. + +It is really meant to be used with some sort of [job scheduler](https://en.wikipedia.org/wiki/Job_scheduler), since it runs only once through each and every repo inside `repositories.txt`. + +**Note:** the script checks for the `repositories.txt` file inside the same directory and extracts repository locations from that. If you want to change the file location or name, just change `Line 6` inside the file (replace "repositories.txt" with your path of choice, for example "/home/admin/repositories-to-update.txt"). + +## repositories.txt + +This is the file in which all repository locations are listed. On each line, you should have a relative or absolute path of a git repository and that's it. + +Each time the script is ran, it opens this file, gets every line and tries to fetch from the directory (specified by each line). To remove a repository, just delete the line with it's path. + +## systemd-service-create.py + +A helper script that creates a sample systemd service and timer inside `/etc/systemd/system/`. The service just executes the script (and finishes after the script has went through all repositories), while the timer executes the service over a given interval. + +You wouldn't need to run it more than once. Don't worry if you see a message along the lines of `WARNING: if you use SELinux, you'll need to ...`, it's just a note that always gets shown. + +After it finishes, remember to read the final output! It states that you'll need to execute the following command: +```bash +# systemctl daemon-reload && systemctl start reposync.timer +``` |
