Skip to content

Commit

Permalink
Revert "[scripts] fix dev_setup package manager detection and mpm ver…
Browse files Browse the repository at this point in the history
…sion on ubuntu18.04 (#37)"

This reverts commit 796fd3f.
  • Loading branch information
nkysg committed Mar 2, 2023
1 parent 6517c8a commit d6ad76f
Showing 1 changed file with 36 additions and 60 deletions.
96 changes: 36 additions & 60 deletions scripts/dev_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -149,30 +149,26 @@ function install_toolchain {
fi
}


function install_mpm {
echo "Installing mpm"
echo "Installing mpm"
VERSION="$(mpm --version || true)"
if [ -n "$VERSION" ]; then
if [[ "${BATCH_MODE}" == "false" ]]; then
echo "mpm is already installed, version: $VERSION"
fi
else
if [[ $(uname -s) == "Darwin" ]]; then
mpm_file="mpm-macos-latest";
if [ -n "$VERSION" ]; then
if [[ "${BATCH_MODE}" == "false" ]]; then
echo "mpm is already installed, version: $VERSION"
fi
else
if [[ $(lsb_release -r | cut -f 2) == '18.04' ]]; then
mpm_file="mpm-ubuntu-18.04";

if [[ $(uname -s) == "Darwin" ]]; then
mpm_file="mpm-macos-latest";
else
mpm_file="mpm-ubuntu-latest";
fi
curl -sL -o "${INSTALL_DIR}${mpm_file}.zip" "https://github.com/starcoinorg/starcoin/releases/download/${MPM_VERSION}/${mpm_file}.zip"
unzip -q "${INSTALL_DIR}${mpm_file}.zip" -d "${INSTALL_DIR}"
mv "${INSTALL_DIR}${mpm_file}/mpm" "${INSTALL_DIR}mpm"
chmod +x "${INSTALL_DIR}mpm"
rmdir "${INSTALL_DIR}${mpm_file}"
fi
curl -sL -o "${INSTALL_DIR}${mpm_file}.zip" "https://github.com/starcoinorg/starcoin/releases/download/${MPM_VERSION}/${mpm_file}.zip"
unzip -q "${INSTALL_DIR}${mpm_file}.zip" -d "${INSTALL_DIR}"
mv "${INSTALL_DIR}${mpm_file}/mpm" "${INSTALL_DIR}mpm"
chmod +x "${INSTALL_DIR}mpm"
rmdir "${INSTALL_DIR}${mpm_file}"
fi
}

function install_dotnet {
Expand Down Expand Up @@ -388,51 +384,31 @@ fi

PACKAGE_MANAGER=
if [[ "$(uname)" == "Linux" ]]; then
# check for default package manager for linux
if [[ -f /etc/redhat-release ]]; then
# use yum for redhat-releases by default
if command -v yum &>/dev/null; then
PACKAGE_MANAGER="yum"
elif command -v dnf &>/dev/null; then
# dnf is the updated default since Red Hat Enterprise Linux 8, CentOS 8, Fedora 22, and any distros based on these
echo "WARNING: dnf package manager support is experimental"
PACKAGE_MANAGER="dnf"
fi
elif [[ -f /etc/debian_version ]] && command -v apt-get &>/dev/null; then
PACKAGE_MANAGER="apt-get"
elif [[ -f /etc/arch-release ]] && command -v pacman &>/dev/null; then
PACKAGE_MANAGER="pacman"
elif [[ -f /etc/alpine-release ]] && command -v apk &>/dev/null; then
PACKAGE_MANAGER="apk"
fi
# if no default OS specific PACKAGE_MANAGER detected, just pick one that's installed (as best effort)
if [[ -z $PACKAGE_MANAGER ]]; then
if command -v yum &>/dev/null; then
PACKAGE_MANAGER="yum"
elif command -v apt-get &>/dev/null; then
PACKAGE_MANAGER="apt-get"
elif command -v pacman &>/dev/null; then
PACKAGE_MANAGER="pacman"
elif command -v apk &>/dev/null; then
PACKAGE_MANAGER="apk"
elif command -v dnf &>/dev/null; then
echo "WARNING: dnf package manager support is experimental"
PACKAGE_MANAGER="dnf"
else
echo "Unable to find supported package manager (yum, apt-get, dnf, or pacman). Abort"
exit 1
fi
fi
if command -v yum &> /dev/null; then
PACKAGE_MANAGER="yum"
elif command -v apt-get &> /dev/null; then
PACKAGE_MANAGER="apt-get"
elif command -v pacman &> /dev/null; then
PACKAGE_MANAGER="pacman"
elif command -v apk &>/dev/null; then
PACKAGE_MANAGER="apk"
elif command -v dnf &>/dev/null; then
echo "WARNING: dnf package manager support is experimental"
PACKAGE_MANAGER="dnf"
else
echo "Unable to find supported package manager (yum, apt-get, dnf, or pacman). Abort"
exit 1
fi
elif [[ "$(uname)" == "Darwin" ]]; then
if command -v brew &>/dev/null; then
PACKAGE_MANAGER="brew"
else
echo "Missing package manager Homebrew (https://brew.sh/). Abort"
exit 1
fi
if command -v brew &>/dev/null; then
PACKAGE_MANAGER="brew"
else
echo "Missing package manager Homebrew (https://brew.sh/). Abort"
exit 1
fi
else
echo "Unknown OS. Abort."
exit 1
echo "Unknown OS. Abort."
exit 1
fi

if [[ "$BATCH_MODE" == "false" ]]; then
Expand Down

0 comments on commit d6ad76f

Please sign in to comment.