Skip to content

Commit

Permalink
lgtm
Browse files Browse the repository at this point in the history
  • Loading branch information
dcmartin committed Apr 8, 2020
1 parent 6873c89 commit fb5d04b
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 35 deletions.
2 changes: 1 addition & 1 deletion SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ cd ~/GIT/open-horizon && sudo ./sh/get.horizon.sh
export HZN_EXCHANGE_URL=${HZN_EXCHANGE_URL:-http://exchange:3090/v1/}
export HZN_FSS_CSSURL=${HZN_FSS_CSSURL:-http://exchange:9443/css/}
sudo sed -i -e "s/^HZN_EXCHANGE_URL=.*/HZN_EXCHANGE_URL=${HZN_EXCHANGE_URL}" /etc/default/horizon
sudo sed -i -e "s/^HZN_FSS_CSSURL=.*/HZN_FSS_CSSURL=${HZN_FSS_CSSURL}/" /etc/default/horizon
sudo sed -i -e "s/^HZN_FSS_CSSURL=.*/HZN_FSS_CSSURL=${HZN_FSS_CSSURL}" /etc/default/horizon
sudo systemctl restart horizon
```

Expand Down
20 changes: 0 additions & 20 deletions exchange/DIGITS.md

This file was deleted.

52 changes: 38 additions & 14 deletions sh/get.horizon.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,50 @@
#!/bin/bash

if [ "${USER:-}" != 'root' ]; then
echo "Run as root: sudo ${0} ${*}" &> /dev/stderr
exit 1
fi

# get particulars
arch=$(dpkg --print-architecture)
platform=$(lsb_release -a 2> /dev/null | egrep 'Distributor ID:' | awk '{ print $3 }' | tr '[:upper:]' '[:lower:]')
dist=$(lsb_release -a 2> /dev/null | egrep 'Codename:' | awk '{ print $2 }')
version=2.24.18

if [ ! -s bluehorizon.deb ]; then
curl -sSL http://pkg.bluehorizon.network/linux/${platform}/pool/main/h/horizon/bluehorizon_${version}~ppa~${platform}.${dist}_all.deb -o bluehorizon.deb
fi
# only working version
repo=http://pkg.bluehorizon.network/linux
dir=pool/main/h/horizon
version=2.24.18

if [ ! -s horizon-cli.deb ]; then
curl -sSL http://pkg.bluehorizon.network/linux/${platform}/pool/main/h/horizon/horizon-cli_${version}~ppa~${platform}.${dist}_${arch}.deb -o horizon-cli.deb
if [ ! -z "$(command -v hzn)" ]; then
echo 'The "hzn" command is already installed; remove with "sudo dpkg --purge bluehorizon horizon horizon-cli"' &> /dev/stderr
else
# download packages
for p in horizon-cli horizon bluehorizon; do
if [ ! -s ${p}.deb ]; then
if [ "${p}" = 'bluehorizon' ]; then dep=all; else dep=${arch}; fi
package=${dir}/${p}
curl -sSL ${repo}/${platform}/${package}_${version}~ppa~${platform}.${dist}_${dep}.deb -o ${p}.deb
fi
dpkg -i ${p}.deb
done
fi

if [ ! -s horizon.deb ]; then
curl -sSL http://pkg.bluehorizon.network/linux/${platform}/pool/main/h/horizon/horizon_${version}~ppa~${platform}.${dist}_${arch}.deb -o horizon.deb
if [ -s HZN_EXCHANGE_URL ]; then HZN_EXCHANGE_URL=$(cat HZN_EXCHANGE_URL); fi
if [ "${HZN_EXCHANGE_URL:-null}" != 'null' ]; then
echo 'Updating /etc/default/horizon with HZN_EXCHANGE_URL="'${HZN_EXCHANGE_URL}'"' &> /dev/stderr
sed -i -e "s|^HZN_EXCHANGE_URL=.*|HZN_EXCHANGE_URL=${HZN_EXCHANGE_URL}|" /etc/default/horizon
restart=true
else
echo 'Edit /etc/default/horizon and specify HZN_EXCHANGE_URL; then "sudo systemctl restart horizon"' &> /dev/stderr
fi

if [ "${USER:-}" != 'root' ]; then
echo "Run as root: sudo ${0} ${*}" &> /dev/stderr
exit 1
if [ -s HZN_FSS_CSSURL ]; then HZN_FSS_CSSURL=$(cat HZN_FSS_CSSURL); fi
if [ "${HZN_FSS_CSSURL:-null}" != 'null' ]; then
echo 'Updating /etc/default/horizon with HZN_FSS_CSSURL="'${HZN_FSS_CSSURL}'"' &> /dev/stderr
sed -i -e "s|^HZN_FSS_CSSURL=.*|HZN_FSS_CSSURL=${HZN_FSS_CSSURL}|" /etc/default/horizon
restart=true
else
echo 'Edit /etc/default/horizon and specify HZN_FSS_CSSURL; then "sudo systemctl restart horizon"' &> /dev/stderr
fi

dpkg -i horizon-cli.deb
dpkg -i horizon.deb
dpkg -i bluehorizon.deb
if [ "${restart:-false}" = 'true' ]; then systemctl restart horizon; fi

0 comments on commit fb5d04b

Please sign in to comment.