setup-snapshots.sh 804 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash

mkdir -p assets/snapshot
cd assets/snapshot

wget http://eris.dynare.org/snapshot/macosx.json
wget http://eris.dynare.org/snapshot/source.json
wget http://eris.dynare.org/snapshot/windows.json
wget http://eris.dynare.org/snapshot/windows-zip.json

declare -a arr=("macosx" "source" "windows" "windows-zip")

for dir in "${arr[@]}"
do
    mkdir $dir
    filenames=(`jq .[].filename $dir.json`)
    timestamps=(`jq .[].date $dir.json`)
    n=`jq length $dir.json`
    n=`expr $n - 1`
    cd $dir
    for i in `seq 0 $n`;
    do
        filename="${filenames[i]%\"}"
        filename="${filename#\"}"
        timestamp="${timestamps[i]%\"}"
        timestamp="${timestamp#\"}"
        echo $filename $timestamp
        touch -amt $timestamp $filename
    done
    cd ..
done
rm *.json
cd ../..