Skip to content

Commit

Permalink
Detect and automatically install unzip package.
Browse files Browse the repository at this point in the history
Detects whether the unzip package is installed, and automatically installs unzip if it is not installed.
  • Loading branch information
jojoandgyc committed Nov 6, 2024
1 parent d65c5c1 commit b2e8793
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,28 @@ script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

export XMAKE_RCFILES=${script_dir}/tools/scripts/xmake.lua
export RT_XMAKE_LINK_TYPE="static"


# Check whether unzip is installed.
if ! command -v unzip &> /dev/null; then
echo "Unzip is not installed. Installing unzip"

# Automatically install unzip according to package manager
if [[ -n $(command -v apt-get) ]]; then
sudo apt-get update
sudo apt-get install -y unzip
elif [[ -n $(command -v yum) ]]; then
sudo yum install -y unzip
elif [[ -n $(command -v dnf) ]]; then
sudo dnf install -y unzip
elif [[ -n $(command -v pacman) ]]; then
sudo pacman -Sy --noconfirm unzip
else
echo "Unrecognized package manager, please install unzip manually."
exit 1
fi

echo "Unzip has been successfully installed."
else
echo "Unzip is installed."
fi

0 comments on commit b2e8793

Please sign in to comment.