Improve file handling in check_config
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
0fef2abc09
commit
2ad65f4512
1 changed files with 4 additions and 1 deletions
|
@ -31,7 +31,10 @@ STAT_PARM="-c %Y"
|
||||||
NEED_UPDATE=()
|
NEED_UPDATE=()
|
||||||
# Check repos for updates
|
# Check repos for updates
|
||||||
for REPO in ${REPOS[@]}; do
|
for REPO in ${REPOS[@]}; do
|
||||||
if [ $(( $(date +%s) - $(stat ${STAT_PARM} .cfg/${REPO}/FETCH_HEAD) )) -gt ${FETCH_INTERVAL} ] || [ $(wc -c ~/.cfg/${REPO}/FETCH_HEAD | cut -d' ' -f1) -eq 0 ]; then
|
LAST_FETCH=0
|
||||||
|
[ -f ~/.cfg/${REPO}/FETCH_HEAD ] && LAST_FETCH=$(stat ${STAT_PARM} ~/.cfg/${REPO}/FETCH_HEAD)
|
||||||
|
if [ $(( $(date +%s) - ${LAST_FETCH} )) -gt ${FETCH_INTERVAL} ] || \
|
||||||
|
[ $(wc -c ~/.cfg/${REPO}/FETCH_HEAD | cut -d' ' -f1) -eq 0 ]; then
|
||||||
vault-sshadd ${SSH_KEY} 2>&1 >/dev/null || { echo "Unable to load key ${SSH_KEY}"; exit 1; }
|
vault-sshadd ${SSH_KEY} 2>&1 >/dev/null || { echo "Unable to load key ${SSH_KEY}"; exit 1; }
|
||||||
gwrap fetch -q origin master
|
gwrap fetch -q origin master
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue