Skip to content

Commit

Permalink
remove deps and symlinks
Browse files Browse the repository at this point in the history
Signed-off-by: Prakhar Gurunani <[email protected]>
  • Loading branch information
FirePing32 committed Oct 18, 2023
1 parent 7877cb4 commit 9ad4dbc
Showing 1 changed file with 84 additions and 6 deletions.
90 changes: 84 additions & 6 deletions tools/remove_dependencies.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,29 @@

# Remove tools and dependencies installed by "make tools"

source ./../dev.env
get_arch() {
uname -m
}

function fail() {
echo "ERROR: ${1}"
exit 1
}

BUILD_JAVA=${BUILD_JAVA:-1}
BUILD_CONSUL=${BUILD_CONSUL:-1}
VTROOT="$PWD/../"

[[ "$(dirname "$0")" = "." ]] || fail "remove_dependencies.sh must be run from its current directory"

uninstall_protoc() {
echo "Removing protoc..."
local dist="$1"

unlink "$dist/bin/protoc"
if [ -f $dist ]; then
unlink "$dist/bin/protoc"
rm "$VTROOT/bin/protoc"
fi
rm -rf $dist
}

Expand Down Expand Up @@ -51,16 +67,78 @@ uninstall_etcd() {
*) echo "ERROR: unsupported architecture for etcd"; exit 1;;
esac


unlink "$dist/etcd-${version}-${platform}-${target}/etcd"
unlink "$dist/etcd-${version}-${platform}-${target}/etcdctl"
if [ -f "$dist/etcd-${version}-${platform}-${target}/etcd" ]; then
unlink "$dist/etcd-${version}-${platform}-${target}/etcd"
rm "$VTROOT/bin/etcd"
fi
if [ -f "$dist/etcd-${version}-${platform}-${target}/etcdctl" ]; then
unlink "$dist/etcd-${version}-${platform}-${target}/etcdctl"
rm "$VTROOT/bin/etcdctl"
fi
rm -rf $dist
}

uninstall_consul() {
echo "Removing consul..."
local dist="$1"

unlink "$dist/consul"
if [ -f "$dist/consul" ]; then
unlink "$dist/consul"
rm "$VTROOT/bin/consul"
fi
rm -rf $dist
}

uninstall_toxiproxy() {
echo "Removing toxiproxy..."
local dist="$1"

case $(uname) in
Linux) local platform=linux;;
Darwin) local platform=darwin;;
*) echo "WARNING: unsupported platform. Some tests that rely on toxiproxy will not function."; return;;
esac

case $(get_arch) in
aarch64) local target=arm64;;
x86_64) local target=amd64;;
arm64) local target=arm64;;
*) echo "WARNING: unsupported architecture. Some tests that rely on toxiproxy will not function."; return;;
esac

file="toxiproxy-server-${platform}-${target}"

if [ -f "$dist/$file" ]; then
unlink "$dist/$file"
rm "$VTROOT/bin/toxiproxy-server"
fi
rm -rf $dist
}

uninstall_all() {
echo "## local system details..."
echo "## platform: $(uname) target:$(get_arch) OS: $os"

# protoc
protoc_ver=21.3
uninstall_protoc "$VTROOT/dist/vt-protoc-$protoc_ver"

# zk
zk_ver=${ZK_VERSION:-3.8.0}
if [ "$BUILD_JAVA" == 1 ] ; then
uninstall_zookeeper "$VTROOT/dist/vt-zookeeper-$zk_ver"
fi

# etcd
uninstall_etcd "v3.5.6" "$VTROOT/dist/etcd"

# consul
if [ "$BUILD_CONSUL" == 1 ] ; then
uninstall_consul "$VTROOT/dist/consul"
fi

# toxiproxy
uninstall_toxiproxy "$VTROOT/dist/toxiproxy"
}

uninstall_all

0 comments on commit 9ad4dbc

Please sign in to comment.