reproducible: actually, keep the real_year real, and deal with Dec/Jan which...

reproducible: actually, keep the real_year real, and deal with Dec/Jan which are special months for us

The future hosts are 1 year and 1 month (and 1 day) in the future,
therefore where we are in December of year X the future hosts will be in
January of year X+2.

This will still leave a single day of warnings during December 31 (I think).
Signed-off-by: Mattia Rizzolo's avatarMattia Rizzolo <mattia@debian.org>
parent 096ee89f
......@@ -107,13 +107,14 @@ fi
# (XXX: yes this is hardcoded but meh…)
echo "$(date -u) - testing whether the time is right..."
get_node_ssh_port "$HOSTNAME"
real_year=2019
real_year=2018
year=$(date +%Y)
if "$NODE_RUN_IN_THE_FUTURE"; then
if [ "$year" -eq "$real_year" ]; then
echo "Warning, today we came back to the present: $(date -u)."
DIRTY=true
elif [ "$year" -eq $(( $real_year + 1 )) ] ; then
elif [ "$year" -eq "$(("$real_year" + 1))" ] || \
[ "$year" -eq "$(("$real_year" + 2))" -a "$(date +%m)" -eq 1]; then
echo "Good, today is the right future: $(date -u)."
else
echo "Warning, today is the wrong future: $(date -u)."
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment