Skip to content

Commit 16287a9

Browse files
authored
Merge pull request #1554 from onetechnical/onetechnical/relbeta2.1.6
Hot fix for fixing bad genesis file on 2.1.5 install (#1553)
2 parents 314a505 + c241820 commit 16287a9

File tree

2 files changed

+41
-14
lines changed

2 files changed

+41
-14
lines changed

installer/debian/algorand/postinst

+8
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,11 @@ if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-decon
3535
deb-systemd-invoke $_dh_action algorand.service >/dev/null || true
3636
fi
3737
fi
38+
39+
if [ "$1" = "configure" ]; then
40+
if [ -f /var/lib/algorand/genesis.json-2.1.5-patch ]; then
41+
# 2.1.5 bug fix - restore user-modified genesis.json
42+
mv -f /var/lib/algorand/genesis.json-2.1.5-patch /var/lib/algorand/genesis.json
43+
fi
44+
fi
45+

installer/debian/algorand/preinst

+33-14
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,49 @@
11
#!/usr/bin/env bash
22

3-
set -e
3+
set -eo pipefail
4+
export BASHOPTS
45

56
PKG_NAME=@PKG_NAME@
67

7-
if [ "$1" != install ]
8+
if [ "$1" = install ]
89
then
9-
exit 0
10+
if dpkg-query --list 'algorand*' &> /dev/null
11+
then
12+
if PKG_INFO=$(dpkg-query --show --showformat='${Package} ${Status}\n' 'algorand*' | grep "install ok installed")
13+
then
14+
# Filter out `algorand-indexer` and `algorand-devtools` packages, they are allowed to be
15+
# installed alongside other `algorand` packages.
16+
INSTALLED_PKG=$(grep -v -e algorand-indexer -e algorand-devtools <<< "$PKG_INFO" | awk '{print $1}')
17+
18+
if [ -n "$INSTALLED_PKG" ]
19+
then
20+
echo -e "\nAlgorand does not currently support multi-distribution installations!\n\
21+
To install this package, it is necessary to first remove the \`$INSTALLED_PKG\` package:\n\n\
22+
sudo apt-get remove $INSTALLED_PKG\n\
23+
sudo apt-get install $PKG_NAME\n"
24+
exit 1
25+
fi
26+
fi
27+
fi
1028
fi
1129

12-
if dpkg-query --list 'algorand*' &> /dev/null
30+
if [ "$1" = upgrade ]
1331
then
14-
if PKG_INFO=$(dpkg-query --show --showformat='${Package} ${Status}\n' 'algorand*' | grep "install ok installed")
32+
if [ -f /var/lib/algorand/genesis.json ]
1533
then
16-
# Filter out `algorand-indexer` and `algorand-devtools` packages, they are allowed to be
17-
# installed alongside other `algorand` packages.
18-
INSTALLED_PKG=$(grep -v -e algorand-indexer -e algorand-devtools <<< "$PKG_INFO" | awk '{print $1}')
34+
ALGO_MD5=$(md5sum /var/lib/algorand/genesis.json | awk '{print $1}')
35+
ALGO_TIMESTAMP=$(stat -c %Y /var/lib/algorand/genesis.json)
1936

20-
if [ -n "$INSTALLED_PKG" ]
37+
if [ "$ALGO_MD5" = "9afc34b96a2c4a9f936870cd26ae7873" ]
2138
then
22-
echo -e "\nAlgorand does not currently support multi-distribution installations!\n\
23-
To install this package, it is necessary to first remove the \`$INSTALLED_PKG\` package:\n\n\
24-
sudo apt-get remove $INSTALLED_PKG\n\
25-
sudo apt-get install $PKG_NAME\n"
26-
exit 1
39+
if [[ "$ALGO_TIMESTAMP" != 1600456830 ||
40+
( "$ALGO_TIMESTAMP" = 1600456830 && ! -d /var/lib/algorand/mainnet-v1.0 ) ]]
41+
then
42+
# 2.1.5 bug fix - back up user-modified genesis.json to restore after conffiles
43+
cp -p /var/lib/algorand/genesis.json /var/lib/algorand/genesis.json-2.1.5-patch
44+
fi
2745
fi
46+
2847
fi
2948
fi
3049

0 commit comments

Comments
 (0)