-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·61 lines (54 loc) · 1.56 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env bash
LOCAL_BIN_DIR="/usr/local/bin"
# Check if already has symlink
if ! [[ -L "${LOCAL_BIN_DIR}/ez" ]]; then
echo "Creating symlink to ${LOCAL_BIN_DIR}/ez..."
mkdir -p "${LOCAL_BIN_DIR}" && sudo ln -sf ~/.ez-install/ez "${LOCAL_BIN_DIR}"
fi
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) machine=Linux ;;
Darwin*) machine=Mac ;;
CYGWIN*) machine=Cygwin ;;
MINGW*) machine=MinGw ;;
*) machine="UNKNOWN:${unameOut}" ;;
esac
# If MacOS, ensure bash is up-to-date
if [ "$machine" == "Mac" ]; then
# Ensure brew is installed
if ! command -v brew &>/dev/null; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew update
brew upgrade
fi
# Ensure bash is installed by brew
if [ "$(brew ls --versions bash)" == "" ]; then
brew install bash
fi
fi
# Install JQ if not existing
if ! command -v jq &>/dev/null; then
if [ "$machine" == "Mac" ]; then
# Install jq
brew install jq
elif [ "$machine" == "Linux" ]; then
if command -v apk &>/dev/null; then
sudo apk add jq
elif command -v pkg &>/dev/null; then
sudo pkg install jq
elif command -v pacman &>/dev/null; then
sudo pacman -S jq
elif command -v apt &>/dev/null; then
sudo apt install jq
elif command -v dnf &>/dev/null; then
sudo dnf install jq
elif command -v zypper &>/dev/null; then
sudo zypper install jq
elif command -v nix-env &>/dev/null; then
sudo nix-env -i jq
fi
fi
fi
echo "Generating packages..."
"$(dirname -- "$(realpath -- "${BASH_SOURCE[0]}")")"/scripts/generate-packages
echo "Installation done!"