-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgenerate_releases.sh
executable file
·83 lines (68 loc) · 2.12 KB
/
generate_releases.sh
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
# #####
#
# Generate Odoo release.txt files.
#
# usage:
# # all
# bash generate_releases.sh
#
# # from a specific day
# bash generate_release.sh 2016-12-30
#
# author: Pedro Salgado <[email protected]>
# version: 1.2
#
# #####
ARG_START="${1}"
fmt_date='%Y-%m-%d'
today=`date "+${fmt_date}"`
epoch=$(date -j -f "${fmt_date}" ${today} "+%s")
next=$((${epoch} + 86400))
tomorrow=$(date -j -f "%s" ${next} "+${fmt_date}")
for ODOO_VERSION in 8.0 9.0 10.0
do
if [[ "${ARG_START}" != "" ]]; then
day="${ARG_START}"
elif [[ "${ODOO_VERSION}" == "8.0" ]]; then
day=2014-11-28
elif [[ "${ODOO_VERSION}" == "9.0" ]]; then
day=2016-01-01
elif [[ "${ODOO_VERSION}" == "10.0" ]]; then
day=2016-10-05
else
echo "[ERROR] unknown version ${ODOO_VERSION}"
exit 1
fi
release=$(echo "$day" | tr -d '-')
echo "collecting SHA1 checksums for ${ODOO_VERSION} starting at ${day}..."
rm -f "${ODOO_VERSION}/releases.txt.tmp"
while [ "${release}" != "$(echo $tomorrow | tr -d '-')" ]; do
if [[ "${ODOO_VERSION}" == '9.0' ]]; then
basename="odoo_${ODOO_VERSION}c.${release}"
else
basename="odoo_${ODOO_VERSION}.${release}"
fi
url="http://nightly.odoo.com/${ODOO_VERSION}/nightly/deb/${basename}_amd64.changes"
sha1sum=$(curl -s "${url}" \
| grep '_all.deb' \
| head -n 1 \
| awk '{ print $1 }' \
)
if [[ "${sha1sum}" != "" ]]; then
# found checksum
echo "${release}:${sha1sum}" >> "${ODOO_VERSION}/releases.txt.tmp"
fi
epoch=$(date -j -f "${fmt_date}" ${day} "+%s")
next=$((${epoch} + 86400))
day=$(date -j -f "%s" ${next} "+${fmt_date}")
release=$(echo "$day" | tr -d '-')
done
if [[ -f "${ODOO_VERSION}/releases.txt.tmp" ]]; then
# releases.txt.tmp file exists => there are changes to be processed
echo "generating ${ODOO_VERSION}/releases.txt..."
paste -d '\n' "${ODOO_VERSION}/releases.txt" "${ODOO_VERSION}/releases.txt.tmp" | sort -r | uniq > "${ODOO_VERSION}/releases.txt.out"
mv "${ODOO_VERSION}/releases.txt.out" "${ODOO_VERSION}/releases.txt"
rm "${ODOO_VERSION}/releases.txt.tmp"
fi
done