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

Tools: Remove dependencies installed by make tools #14309

Merged
merged 13 commits into from
Oct 26, 2023
6 changes: 3 additions & 3 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,15 @@ install_all() {
fi

# etcd
install_dep "etcd" $ETCD_VER "$VTROOT/dist/etcd" install_etcd
install_dep "etcd" "$ETCD_VER" "$VTROOT/dist/etcd" install_etcd

# consul
if [ "$BUILD_CONSUL" == 1 ] ; then
install_dep "Consul" $CONSUL_VER "$VTROOT/dist/consul" install_consul
install_dep "Consul" "$CONSUL_VER" "$VTROOT/dist/consul" install_consul
fi

# toxiproxy
install_dep "toxiproxy" $TOXIPROXY_VER "$VTROOT/dist/toxiproxy" install_toxiproxy
install_dep "toxiproxy" "$TOXIPROXY_VER" "$VTROOT/dist/toxiproxy" install_toxiproxy

echo
echo "bootstrap finished - run 'make build' to compile"
Expand Down
72 changes: 36 additions & 36 deletions tools/remove_dependencies.sh
FirePing32 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -25,107 +25,107 @@ function fail() {

FirePing32 marked this conversation as resolved.
Show resolved Hide resolved
BUILD_JAVA=${BUILD_JAVA:-1}
BUILD_CONSUL=${BUILD_CONSUL:-1}
uname=$(uname)
get_arch=$(uname -m)
UNAME=$(uname)
ARCH=$(uname -m)

uninstall_protoc() {
echo "Removing protoc..."
local dist="$1"
local DIST="$1"
FirePing32 marked this conversation as resolved.
Show resolved Hide resolved

if [ -f "$dist/bin/protoc" ]; then
unlink "$dist/bin/protoc"
if [ -f "$DIST/bin/protoc" ]; then
unlink "$DIST/bin/protoc"
rm "$VTROOT/bin/protoc"
fi
if [[ "$(echo $dist | awk -F/ '{print $NF}')" == "vt-protoc-$PROTOC_VER" ]]; then
rm -rf $dist
if [[ "$(echo $DIST | awk -F/ '{print $NF}')" == "vt-protoc-$PROTOC_VER" ]]; then
FirePing32 marked this conversation as resolved.
Show resolved Hide resolved
rm -rf $DIST
fi
}

uninstall_zookeeper() {
echo "Removing zookeeper..."
local dist="$1"
local DIST="$1"

if [[ "$(echo $dist | awk -F/ '{print $NF}')" == "vt-zookeeper-$ZK_VER" ]]; then
rm -rf $dist
if [[ "$(echo $DIST | awk -F/ '{print $NF}')" == "vt-zookeeper-$ZK_VER" ]]; then
rm -rf $DIST
fi
}

uninstall_etcd() {
echo "Removing etcd..."
local version="$1"
local dist="$2"
local DIST="$2"

case $uname in
case $UNAME in
Linux) local platform=linux; local ext=tar.gz;;
Darwin) local platform=darwin; local ext=zip;;
*) echo "Etcd not installed. Ignoring.."; return;;
*) echo "Etcd not installed. Ignoring..."; return;;
esac

case $get_arch in
case $ARCH in
aarch64) local target=arm64;;
x86_64) local target=amd64;;
arm64) local target=arm64;;
*) echo "Etcd not installed. Ignoring.."; return;;
*) echo "Etcd not installed. Ignoring..."; return;;
esac

if [ -f "$dist/etcd-${version}-${platform}-${target}/etcd" ]; then
unlink "$dist/etcd-${version}-${platform}-${target}/etcd"
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"
if [ -f "$DIST/etcd-${version}-${platform}-${target}/etcdctl" ]; then
unlink "$DIST/etcd-${version}-${platform}-${target}/etcdctl"
rm "$VTROOT/bin/etcdctl"
fi

if [[ "$(echo $dist | awk -F/ '{print $NF}')" == "etcd" ]]; then
rm -rf $dist
if [[ "$(echo $DIST | awk -F/ '{print $NF}')" == "etcd" ]]; then
rm -rf $DIST
fi
}

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

if [ -f "$dist/consul" ]; then
unlink "$dist/consul"
if [ -f "$DIST/consul" ]; then
unlink "$DIST/consul"
rm "$VTROOT/bin/consul"
fi
if [[ "$(echo $dist | awk -F/ '{print $NF}')" == "consul" ]]; then
rm -rf $dist
if [[ "$(echo $DIST | awk -F/ '{print $NF}')" == "consul" ]]; then
rm -rf $DIST
fi
}

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

case $uname in
case $UNAME in
Linux) local platform=linux;;
Darwin) local platform=darwin;;
*) echo "Toxiproxy not installed. Ignoring.."; return;;
*) echo "Toxiproxy not installed. Ignoring..."; return;;
esac

case $get_arch in
case $ARCH in
aarch64) local target=arm64;;
x86_64) local target=amd64;;
arm64) local target=arm64;;
*) echo "Toxiproxy not installed. Ignoring.."; return;;
*) echo "Toxiproxy not installed. Ignoring..."; return;;
esac

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

if [ -f "$dist/$file" ]; then
unlink "$dist/$file"
if [ -f "$DIST/$file" ]; then
unlink "$DIST/$file"
rm "$VTROOT/bin/toxiproxy-server"
fi
if [[ "$(echo $dist | awk -F/ '{print $NF}')" == "toxiproxy" ]]; then
rm -rf $dist
if [[ "$(echo $DIST | awk -F/ '{print $NF}')" == "toxiproxy" ]]; then
rm -rf $DIST
FirePing32 marked this conversation as resolved.
Show resolved Hide resolved
fi
}

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

# protoc
uninstall_protoc "$VTROOT/dist/vt-protoc-$PROTOC_VER"
Expand Down
Loading