|
@@ -1,5 +1,21 @@
|
1
|
1
|
#! /usr/bin/env sh
|
2
|
2
|
|
|
3
|
+configFile=/etc/git-backup.conf
|
|
4
|
+
|
|
5
|
+initPath()
|
|
6
|
+{
|
|
7
|
+ cd "$1" && git init && git remote add git:backup/$(hostname)$(pwd)
|
|
8
|
+}
|
|
9
|
+
|
|
10
|
+if [ $# -eq 1 ] && [ "$1" = "--init" ]
|
|
11
|
+then
|
|
12
|
+ while read path
|
|
13
|
+ do
|
|
14
|
+ initPath "${path}"
|
|
15
|
+ done < "${configFile}"
|
|
16
|
+ exit
|
|
17
|
+fi
|
|
18
|
+
|
3
|
19
|
while read path
|
4
|
20
|
do
|
5
|
21
|
echo "Backing up ${path}..."
|
|
@@ -9,4 +25,4 @@ do
|
9
|
25
|
git commit -m "[GIT-BACKUP] $(date)"
|
10
|
26
|
git push origin master
|
11
|
27
|
)
|
12
|
|
-done < /etc/git-backup.conf
|
|
28
|
+done < "${configFile}"
|