-
-
Notifications
You must be signed in to change notification settings - Fork 244
/
install.sh
executable file
·88 lines (74 loc) · 2.03 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/sh
set -e
if [ -z "${BIN_DIR}" ]; then
BIN_DIR=$(pwd)
fi
THE_ARCH_BIN=""
DEST=${BIN_DIR}/frankenphp
OS=$(uname -s)
ARCH=$(uname -m)
if type "tput" >/dev/null 2>&1; then
bold=$(tput bold || true)
italic=$(tput sitm || true)
normal=$(tput sgr0 || true)
fi
case ${OS} in
Linux*)
case ${ARCH} in
aarch64)
THE_ARCH_BIN="frankenphp-linux-aarch64"
;;
x86_64)
THE_ARCH_BIN="frankenphp-linux-x86_64"
;;
*)
THE_ARCH_BIN=""
;;
esac
;;
Darwin*)
case ${ARCH} in
arm64)
THE_ARCH_BIN="frankenphp-mac-arm64"
;;
*)
THE_ARCH_BIN="frankenphp-mac-x86_64"
;;
esac
;;
Windows | MINGW64_NT*)
echo "❗ Use WSL to run FrankenPHP on Windows: https://learn.microsoft.com/windows/wsl/"
exit 1
;;
*)
THE_ARCH_BIN=""
;;
esac
if [ -z "${THE_ARCH_BIN}" ]; then
echo "❗ FrankenPHP is not supported on ${OS} and ${ARCH}"
exit 1
fi
SUDO=""
echo "📦 Downloading ${bold}FrankenPHP${normal} for ${OS} (${ARCH}):"
# check if $DEST is writable and suppress an error message
touch "${DEST}" 2>/dev/null
# we need sudo powers to write to DEST
if [ $? -eq 1 ]; then
echo "❗ You do not have permission to write to ${italic}${DEST}${normal}, enter your password to grant sudo powers"
SUDO="sudo"
fi
if type "curl" >/dev/null 2>&1; then
curl -L --progress-bar "https://github.com/dunglas/frankenphp/releases/latest/download/${THE_ARCH_BIN}" -o "${DEST}"
elif type "wget" >/dev/null 2>&1; then
${SUDO} wget "https://github.com/dunglas/frankenphp/releases/latest/download/${THE_ARCH_BIN}" -O "${DEST}"
else
echo "❗ Please install ${italic}curl${normal} or ${italic}wget${normal} to download FrankenPHP"
exit 1
fi
${SUDO} chmod +x "${DEST}"
echo
echo "🥳 FrankenPHP downloaded successfully to ${italic}${DEST}${normal}"
echo "🔧 Move the binary to ${italic}/usr/local/bin/${normal} or another directory in your ${italic}PATH${normal} to use it globally:"
echo " ${bold}sudo mv ${DEST} /usr/local/bin/${normal}"
echo
echo "⭐ If you like FrankenPHP, please give it a star on GitHub: ${italic}https://github.com/dunglas/frankenphp${normal}"