From 3f46c6c14a3a830f2edc06d2a224b33057b31a49 Mon Sep 17 00:00:00 2001 From: JerryKwan Date: Tue, 5 Jul 2022 21:27:12 +0800 Subject: [PATCH] support installing mpm from source (#56) support installing mpm from source --- scripts/dev_setup.sh | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/scripts/dev_setup.sh b/scripts/dev_setup.sh index d05228e2..caf57153 100755 --- a/scripts/dev_setup.sh +++ b/scripts/dev_setup.sh @@ -161,17 +161,26 @@ function install_mpm { if [[ $(uname -s) == "Darwin" ]]; then mpm_file="mpm-macos-latest"; else - if [[ $(lsb_release -r | cut -f 2) == '18.04' ]]; then - mpm_file="mpm-ubuntu-18.04"; + if [ "$(. /etc/os-release; echo $NAME)" = "Ubuntu" ]; then + if [[ $(lsb_release -r | cut -f 2) == '18.04' ]]; then + mpm_file="mpm-ubuntu-18.04"; + else + mpm_file="mpm-ubuntu-latest"; + fi else - mpm_file="mpm-ubuntu-latest"; + mpm_file=""; fi 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}" + if [[ $mpm_file != "" ]]; then + 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}" + else + echo "Install mpm from source" + cargo install --git https://github.com/starcoinorg/starcoin move-package-manager --tag $MPM_VERSION --bin mpm --root $HOME + fi fi }