Skip to content

Commit

Permalink
feat: check command success
Browse files Browse the repository at this point in the history
  • Loading branch information
wy-luke committed Aug 20, 2023
1 parent d4cbd28 commit f9c314a
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions sd-installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,20 @@ echo "############ Check and install Homebrew ##############"
# More: https://brew.sh/
if ! command -v brew &>/dev/null; then
# TODO: Force install without confirmation
echo "请下面按照提示,按回车键"
yes | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo "Homebrew has been installed successfully"
# echo "请下面按照提示,按回车键"
if curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh -o install.sh && [ -s install.sh ]; then
yes | /bin/bash install.sh
if [ $? -eq 0 ]; then
echo "Homebrew has been installed successfully"
else
echo "Failed to install Homebrew"
exit 1
fi
else
echo "Homebrew 安装文件下载失败,请检查网络连接"
echo "Failed to download Homebrew installation script, please check your network connection"
exit 1
fi
else
echo "Homebrew has already been installed"
fi
Expand Down

0 comments on commit f9c314a

Please sign in to comment.