-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
39 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |