Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: remove install_bb.sh and install.sh (#1625)

tianzhou81f9b33e5582
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 5db0b82488..61601334f6 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -67,16 +67,3 @@ jobs:
run: |
go generate -tags ${{ matrix.release-tags }}mysql ./...
go test -v ./... -tags=${{ matrix.release-tags }}mysql
-
- # tests if scripts/install_bb.sh is working correctly.
- install-bb:
- strategy:
- matrix:
- os: [ubuntu-latest, macos-latest]
- runs-on: ${{matrix.os}}
- steps:
- - uses: actions/checkout@v2
- - name: run install script
- run: ./scripts/install_bb.sh
- - name: check bb version
- run: bb version
diff --git a/scripts/install.sh b/scripts/install.sh
deleted file mode 100755
index b31fda0678..0000000000
--- a/scripts/install.sh
+++ /dev/null
@@ -1,113 +0,0 @@
-#!/bin/sh
-
-# Users can install the latest version of bytebase by execute this script instead of cloning the whole bytebase GitHub repository and build by themselves.
-
-set -u
-
-abort() {
- printf "%s\n" "$@" >&2
- exit 1
-}
-
-uname_os() {
- local OS="$(uname -s)"
- if [[ "${OS}" != "Darwin" && "${OS}" ]]; then
- abort "OS ${OS} is not support, bytebase is only supported on Linux and MacOS"
- fi
- echo ${OS}
-}
-
-uname_arch() {
- local ARCH=$(uname -m)
- if [[ "${ARCH}" == "amd64" || "${ARCH}" == "x86_64" ]]; then
- ARCH="x86_64"
- elif [[ "${ARCH}" != "arm64" ]]; then
- abort "Arch ${ARCH} is not support, bytebase is only supported on x86_64, amd64 and arm64"
- fi
- echo ${ARCH}
-}
-
-test_curl() {
- local curl_version=$(curl --version 2>/dev/null)
- if [ $? -ne 0 ]; then
- abort "You must install curl before installing bytebase."
- fi
-}
-
-test_tar() {
- local tar_version=$(tar --version 2>/dev/null)
- if [ $? -ne 0 ]; then
- abort "You must install tar before installing bytebase."
- fi
-}
-
-http_download() {
- local local_file=$1
- local source_url=$2
-
- echo "Start downloading ${source_url}..."
-
- local code=$(curl -w '%{http_code}' -L -o "${local_file}" "${source_url}")
- if [ "$code" != "200" ]; then
- abort "Failed to download from ${source_url}, status code: ${code}"
- fi
-
- echo "Completed downloading ${source_url}"
-}
-
-get_bytebase_latest_version() {
- local version_url="https://raw.githubusercontent.com/bytebase/bytebase/main/scripts/VERSION"
- local local_file=$1
-
- local code=$(curl -w '%{http_code}' -sL -o "${local_file}" "${version_url}")
- if [ "$code" != "200" ]; then
- abort "Failed to get bytebase latest version from ${version_url}, status code: ${code}"
- fi
-
- local version=$(<${local_file})
-
- echo "${version}"
-}
-
-execute() {
- OS="$(uname_os)"
- echo "OS: ${OS}"
- ARCH="$(uname_arch)"
- echo "ARCH: ${ARCH}"
-
- test_curl
- test_tar
-
- # Initialize bytebase direcoty
- bytebase_dir="/opt/bytebase"
- (sudo mkdir -p "${bytebase_dir}") || abort "cannot create directory ${bytebase_dir}"
-
- install_dir="/usr/local/bin"
-
- tmp_dir=$(mktemp -d) || abort "cannot create temp directory"
- # Clean the tmpdir automatically if the shell script exit
- trap "rm -r ${tmp_dir}" EXIT
-
- VERSION="$(get_bytebase_latest_version ${tmp_dir}/VERSION)"
- echo "Get bytebase latest version: ${VERSION}"
-
- echo "Downloading tarball into ${tmp_dir}"
- tarball_name="bytebase_${VERSION}_${OS}_${ARCH}.tar.gz"
- http_download "${tmp_dir}/${tarball_name}" \
- "https://github.com/bytebase/bytebase/releases/download/${VERSION}/${tarball_name}"
-
- echo "Start extracting tarball into ${bytebase_dir}..."
- cd "${bytebase_dir}" && sudo tar -xzf "${tmp_dir}/${tarball_name}"
-
- echo "Start installing bytebase and bb ${VERSION}"
- sudo install "${bytebase_dir}/bytebase" "${install_dir}"
- echo "Installed bytebase ${VERSION} to ${install_dir}"
- sudo install "${bytebase_dir}/bb" "${install_dir}"
- echo "Installed bb ${VERSION} to ${install_dir}"
- echo ""
- echo "Check the usage with"
- echo " bytebase --help"
- echo " bb --help"
-}
-
-execute
diff --git a/scripts/install_bb.sh b/scripts/install_bb.sh
deleted file mode 100755
index baf498e117..0000000000
--- a/scripts/install_bb.sh
+++ /dev/null
@@ -1,70 +0,0 @@
-#! /bin/sh
-set -u
-
-abort() {
- printf "%s\n" "$@" >&2
- exit 1
-}
-
-uname_os() {
- OS="$(uname -s)"
- if [[ "${OS}" != "Darwin" && "${OS}" != "Linux" ]]; then
- abort "OS ${OS} is not support, bb is only supported on Linux and MacOS"
- fi
- echo $OS
-}
-
-uname_arch() {
- ARCH=$(uname -m)
- if [[ "${ARCH}" == "amd64" || "${ARCH}" == "x86_64" ]]; then
- ARCH="x86_64"
- elif [[ "${ARCH}" != "arm64" ]]; then
- abort "Arch ${ARCH} is not support, bb is only supported on x86_64, amd64 and arm64"
- fi
- echo $ARCH
-}
-
-http_download() {
- local_file=$1
- source_url=$2
-
- echo "Start downloading $source_url..."
-
- code=$(curl -w '%{http_code}' -sL -o "$local_file" "$source_url")
- if [ "$code" != "200" ]; then
- abort "Failed to download $source_url, status code: $code"
- fi
-
- echo "Completed downloading $source_url"
- return 0
-}
-
-execute() {
- BB_VERSION="1.2.0"
- OS="$(uname_os)"
- ARCH="$(uname_arch)"
-
- tmpdir=$(mktemp -d)
- echo "Downloading tarball into ${tmpdir}"
-
- http_download "${tmpdir}/bytebase_${BB_VERSION}_${OS}_${ARCH}.tar.gz" \
- "https://github.com/bytebase/bytebase/releases/download/${BB_VERSION}/bytebase_${BB_VERSION}_${OS}_${ARCH}.tar.gz"
-
- echo "Start extracting tarball..."
- (cd "${tmpdir}" && tar -xf "bytebase_${BB_VERSION}_${OS}_${ARCH}.tar.gz" "bb")
- echo "Completed extracting tarball"
-
- echo "Start installing bb..."
- echo "Requesting root privilege..."
- sudo install "${tmpdir}/bb" "/usr/local/bin"
- echo "Installed bb to /usr/local/bin"
-
- echo ""
- echo "Check the usage with"
- echo " bb --help"
- echo ""
- echo "You can clean up the installation files with"
- echo " rm -rf ${tmpdir}"
-}
-
-execute