summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Lee <64482439+algojohnlee@users.noreply.github.com>2020-09-24 17:59:56 -0400
committerGitHub <noreply@github.com>2020-09-24 17:59:56 -0400
commit16287a9791944792eadac0ba49f781330388a301 (patch)
tree642aead0c58c1fa21b1ebdd0b57373f04c672a3e
parent314a5058c67a6237ff4ea16b1b8bf34e62a2a97d (diff)
parentc24182065fc447b507e67f60c69c9a5655301b8d (diff)
Merge pull request #1554 from onetechnical/onetechnical/relbeta2.1.6v2.1.6-beta
Hot fix for fixing bad genesis file on 2.1.5 install (#1553)
-rwxr-xr-xinstaller/debian/algorand/postinst8
-rwxr-xr-xinstaller/debian/algorand/preinst47
2 files changed, 41 insertions, 14 deletions
diff --git a/installer/debian/algorand/postinst b/installer/debian/algorand/postinst
index a24425ca8..33f4c31b4 100755
--- a/installer/debian/algorand/postinst
+++ b/installer/debian/algorand/postinst
@@ -35,3 +35,11 @@ if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-decon
deb-systemd-invoke $_dh_action algorand.service >/dev/null || true
fi
fi
+
+if [ "$1" = "configure" ]; then
+ if [ -f /var/lib/algorand/genesis.json-2.1.5-patch ]; then
+ # 2.1.5 bug fix - restore user-modified genesis.json
+ mv -f /var/lib/algorand/genesis.json-2.1.5-patch /var/lib/algorand/genesis.json
+ fi
+fi
+
diff --git a/installer/debian/algorand/preinst b/installer/debian/algorand/preinst
index 6608010ba..7e35c9d28 100755
--- a/installer/debian/algorand/preinst
+++ b/installer/debian/algorand/preinst
@@ -1,30 +1,49 @@
#!/usr/bin/env bash
-set -e
+set -eo pipefail
+export BASHOPTS
PKG_NAME=@PKG_NAME@
-if [ "$1" != install ]
+if [ "$1" = install ]
then
- exit 0
+ if dpkg-query --list 'algorand*' &> /dev/null
+ then
+ if PKG_INFO=$(dpkg-query --show --showformat='${Package} ${Status}\n' 'algorand*' | grep "install ok installed")
+ then
+ # Filter out `algorand-indexer` and `algorand-devtools` packages, they are allowed to be
+ # installed alongside other `algorand` packages.
+ INSTALLED_PKG=$(grep -v -e algorand-indexer -e algorand-devtools <<< "$PKG_INFO" | awk '{print $1}')
+
+ if [ -n "$INSTALLED_PKG" ]
+ then
+ echo -e "\nAlgorand does not currently support multi-distribution installations!\n\
+ To install this package, it is necessary to first remove the \`$INSTALLED_PKG\` package:\n\n\
+ sudo apt-get remove $INSTALLED_PKG\n\
+ sudo apt-get install $PKG_NAME\n"
+ exit 1
+ fi
+ fi
+ fi
fi
-if dpkg-query --list 'algorand*' &> /dev/null
+if [ "$1" = upgrade ]
then
- if PKG_INFO=$(dpkg-query --show --showformat='${Package} ${Status}\n' 'algorand*' | grep "install ok installed")
+ if [ -f /var/lib/algorand/genesis.json ]
then
- # Filter out `algorand-indexer` and `algorand-devtools` packages, they are allowed to be
- # installed alongside other `algorand` packages.
- INSTALLED_PKG=$(grep -v -e algorand-indexer -e algorand-devtools <<< "$PKG_INFO" | awk '{print $1}')
+ ALGO_MD5=$(md5sum /var/lib/algorand/genesis.json | awk '{print $1}')
+ ALGO_TIMESTAMP=$(stat -c %Y /var/lib/algorand/genesis.json)
- if [ -n "$INSTALLED_PKG" ]
+ if [ "$ALGO_MD5" = "9afc34b96a2c4a9f936870cd26ae7873" ]
then
- echo -e "\nAlgorand does not currently support multi-distribution installations!\n\
- To install this package, it is necessary to first remove the \`$INSTALLED_PKG\` package:\n\n\
- sudo apt-get remove $INSTALLED_PKG\n\
- sudo apt-get install $PKG_NAME\n"
- exit 1
+ if [[ "$ALGO_TIMESTAMP" != 1600456830 ||
+ ( "$ALGO_TIMESTAMP" = 1600456830 && ! -d /var/lib/algorand/mainnet-v1.0 ) ]]
+ then
+ # 2.1.5 bug fix - back up user-modified genesis.json to restore after conffiles
+ cp -p /var/lib/algorand/genesis.json /var/lib/algorand/genesis.json-2.1.5-patch
+ fi
fi
+
fi
fi