Skip to content

Commit df65da2

Browse files
authored
Merge pull request #1552 from onetechnical/onetechnical/relstable2.1.6
Onetechnical/relstable2.1.6
2 parents b0063b1 + 20aeb09 commit df65da2

File tree

4 files changed

+43
-16
lines changed

4 files changed

+43
-16
lines changed

buildnumber.dat

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5
1+
6

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

scripts/release/build/deb/build_deb.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ if [[ ! "$PKG_NAME" =~ devtools ]]; then
6262
mkdir -p "$PKG_ROOT/var/lib/algorand/genesis/$dir"
6363
cp "./installer/genesis/$dir/genesis.json" "$PKG_ROOT/var/lib/algorand/genesis/$dir/genesis.json"
6464
done
65-
cp "./installer/genesis/$DEFAULTNETWORK/genesis.json" "$PKG_ROOT/var/lib/algorand/genesis.json"
65+
cp "./installer/genesis/$DEFAULT_RELEASE_NETWORK/genesis.json" "$PKG_ROOT/var/lib/algorand/genesis.json"
6666

6767
# files should not be group writable but directories should be
6868
chmod -R g-w "$PKG_ROOT/var/lib/algorand"

0 commit comments

Comments
 (0)