Browse Source

init command

master
Robin Thoni 9 years ago
parent
commit
7c5cb21da4
1 changed files with 17 additions and 1 deletions
  1. 17
    1
      git-backup

+ 17
- 1
git-backup View File

1
 #! /usr/bin/env sh
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
 while read path
19
 while read path
4
 do
20
 do
5
   echo "Backing up ${path}..."
21
   echo "Backing up ${path}..."
9
       git commit -m "[GIT-BACKUP] $(date)"
25
       git commit -m "[GIT-BACKUP] $(date)"
10
       git push origin master
26
       git push origin master
11
     )
27
     )
12
-done < /etc/git-backup.conf
28
+done < "${configFile}"

Loading…
Cancel
Save