12345678910111213141516171819202122232425262728 |
- #! /usr/bin/env sh
-
- configFile=/etc/git-backup.conf
-
- initPath()
- {
- cd "$1" && git init && git remote add origin git:backup/$(hostname)$(pwd | tr '/' '-')
- }
-
- if [ $# -eq 1 ] && [ "$1" = "--init" ]
- then
- while read path
- do
- initPath "${path}"
- done < "${configFile}"
- exit
- fi
-
- while read path
- do
- echo "Backing up ${path}..."
- cd ${path} &&
- (
- git add -A
- git commit -m "[GIT-BACKUP] $(date)"
- git push origin master --quiet
- )
- done < "${configFile}"
|