summaryrefslogtreecommitdiff
path: root/roles/git-daemon/files/update_git-daemon
blob: ecb7e474ac93ec7ba6662d034ecff0976f5deb65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh

apk -U upgrade

gitd_pid="$(pgrep gitd)"
if [ -z "$gitd_pid" ]
then
  rc-service git-daemon restart
  exit 0
fi

gitd_proc_start_time="$(stat -Lc %Y /proc/${gitd_pid})"
gitd_file_mtime="$(stat -Lc %Y $(which git))"

if [ "$gitd_file_mtime" -gt "$gitd_proc_start_time" ]
then
  rc-service git-daemon restart
fi