Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install cybercli script #506

Merged
merged 2 commits into from
Apr 2, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions scripts/install_cyberdcli_v0.1.6.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#!/bin/sh
# Installation script for cyber. It tries to move $bin in one of the
# directories stored in $binpaths.

binpaths="/usr/local/bin /usr/bin"
libpaths="/usr/lib /usr/local/lib"


# This variable contains a nonzero length string in case the script fails
# because of missing write permissions.
is_write_perm_missing=""

# Download archive with cyberdcli binaries according to platform type
PLATFORM=$(uname)
case "$PLATFORM" in
"Darwin")
# macOS
curl https://mars.cybernode.ai/go-cyber/go_cyber_v0.1.6_darwin-amd64.tar.gz --output go_cyber_v0.1.6_darwin-amd64.tar.gz
tar -xzf go_cyber_v0.1.6_darwin-amd64.tar.gz -C ./
for binpath in $binpaths; do
if cp build_v0.1.6_darwin_amd64/cyberdcli "$binpath"; then
for libpath in $libpaths; do
if cp build_v0.1.6_darwin_amd64/libgo_cosmwasm.dylib "$libpath"; then
cp build_v0.1.6_darwin_amd64/libgo_cosmwasm.so "$libpath"
echo "Moved libgo_cosmwasm to $libpath"
break
else
if [ -d "$libpath" ] && [ ! -w "$libpath" ]; then
is_write_perm_missing=1
fi
fi
done
echo "Moved $bin to $binpath"
echo "Enjoy your cyber experience!"
rm go_cyber_v0.1.6_darwin-amd64.tar.gz
rm -rf build_v0.1.6_darwin_amd64
exit 0
else
if [ -d "$binpath" ] && [ ! -w "$binpath" ]; then
is_write_perm_missing=1
rm go_cyber_v0.1.6_darwin-amd64.tar.gz
fi
fi
done
;;
"Linux")
# Linux distro,
curl https://mars.cybernode.ai/go-cyber/go_cyber_v0.1.6_linux-amd64.tar.gz --output go_cyber_v0.1.6_linux-amd64.tar.gz
tar -xzf go_cyber_v0.1.6_linux-amd64.tar.gz -C ./
for binpath in $binpaths; do
if cp build_v0.1.6_linux_amd64/cyberdcli "$binpath"; then
for libpath in $libpaths; do
if cp build_v0.1.6_linux_amd64/libgo_cosmwasm.dylib "$libpath"; then
cp build_v0.1.6_linux_amd64/libgo_cosmwasm.so "$libpath"
echo "Moved libgo_cosmwasm to $libpath"
break
else
if [ -d "$libpath" ] && [ ! -w "$libpath" ]; then
is_write_perm_missing=1
fi
fi
done
echo "Moved $bin to $binpath"
echo "Enjoy your cyber experience!"
rm go_cyber_v0.1.6_linux-amd64.tar.gz
exit 0
else
if [ -d "$binpath" ] && [ ! -w "$binpath" ]; then
is_write_perm_missing=1
rm go_cyber_v0.1.6_darwin-amd64.tar.gz
fi
fi
done
;;
esac


echo "We cannot install $bin in one of the directories $binpaths"

if [ -n "$is_write_perm_missing" ]; then
echo "It seems that we do not have the necessary write permissions."
echo "Perhaps try running this script as a privileged user:"
echo "Or check that you using default library path."
echo " sudo $0"
echo
fi

exit 1