mirror of
https://github.com/mintycube/dotfiles.git
synced 2024-10-22 14:05:41 +02:00
add checks if local json is missing
This commit is contained in:
parent
ff95b12049
commit
563708819e
@ -11,7 +11,9 @@ function needs_update() {
|
|||||||
[ "$((current_date - local_date))" -ge "$((14 * 24 * 3600))" ]
|
[ "$((current_date - local_date))" -ge "$((14 * 24 * 3600))" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
if needs_update; then
|
if [ ! -f "$local_file" ]; then
|
||||||
|
curl -s "$json_url" -o "$local_file"
|
||||||
|
elif needs_update; then
|
||||||
remote_date=$(curl -sI "$json_url" | grep -i '^Last-Modified:' | sed 's/Last-Modified: //')
|
remote_date=$(curl -sI "$json_url" | grep -i '^Last-Modified:' | sed 's/Last-Modified: //')
|
||||||
if [ "$remote_date" != "$(stat -c %y "$local_file" 2>/dev/null)" ]; then
|
if [ "$remote_date" != "$(stat -c %y "$local_file" 2>/dev/null)" ]; then
|
||||||
curl -s "$json_url" -o "$local_file"
|
curl -s "$json_url" -o "$local_file"
|
||||||
|
Loading…
Reference in New Issue
Block a user