Browse Source

improved install script

master
Robin Thoni 7 years ago
parent
commit
99ee12178f
1 changed files with 17 additions and 5 deletions
  1. 17
    5
      install

+ 17
- 5
install View File

@@ -1,9 +1,21 @@
1 1
 #! /usr/bin/env sh
2 2
 
3
-cp git-backup /usr/local/bin
4
-cp git-backup.conf /etc
5
-sed -i '/git-backup/c\' /etc/crontab
6
-echo "00 2    * * *   root    git-backup > /dev/null" >> /etc/crontab
7
-service cron reload
3
+dir="$(dirname $(readlink -f "${0}"))"
4
+
5
+cp "${dir}/git-backup" /usr/local/bin &&
6
+
7
+if [ ! -x /etc/cron.d/git-backup ]
8
+then
9
+  if [ ! -x /etc/git-backup.conf ]
10
+  then
11
+    cp "${dir}/git-backup.conf" /etc/git-backup.conf
12
+  fi &&
13
+
14
+  if [ ! -x /etc/cron.d/git-backup ]
15
+  then
16
+    echo "00 2    * * *   root    git-backup > /dev/null" > /etc/cron.d/git-backup
17
+  fi &&
18
+  service cron reload
19
+fi &&
8 20
 
9 21
 git-backup --init

Loading…
Cancel
Save