Skip to content

Commit 9f3b809

Browse files
committed
install packages instead of binary
1 parent d435af6 commit 9f3b809

File tree

1 file changed

+47
-13
lines changed

1 file changed

+47
-13
lines changed

install.sh

Lines changed: 47 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
set -e
44

5+
SUDO=""
6+
if [ "$(id -u)" -ne 0 ]; then
7+
SUDO="sudo"
8+
fi
9+
510
if [ -z "${BIN_DIR}" ]; then
611
BIN_DIR=$(pwd)
712
fi
@@ -21,6 +26,46 @@ fi
2126

2227
case ${OS} in
2328
Linux*)
29+
if [ "${ARCH}" = "aarch64" ] || [ "${ARCH}" = "x86_64" ]; then
30+
if command -v dnf >/dev/null 2>&1; then
31+
echo "📦 Detected dnf. Installing FrankenPHP from RPM repository..."
32+
if [ -n "${SUDO}" ]; then
33+
echo "❗ Enter your password to grant sudo powers for package installation"
34+
${SUDO} -v || true
35+
fi
36+
${SUDO} dnf -y install https://rpm.henderkes.com/static-php-1-0.noarch.rpm
37+
${SUDO} dnf -y module enable php-zts:static-8.4 || true
38+
${SUDO} dnf -y install frankenphp
39+
echo
40+
echo "🥳 FrankenPHP installed successfully"
41+
echo
42+
echo "⭐ If you like FrankenPHP, please give it a star on GitHub: ${italic}https://github.com/php/frankenphp${normal}"
43+
exit 0
44+
fi
45+
46+
if command -v apt >/dev/null 2>&1 || command -v apt-get >/dev/null 2>&1; then
47+
echo "📦 Detected apt. Installing FrankenPHP from DEB repository..."
48+
if [ -n "${SUDO}" ]; then
49+
echo "❗ Enter your password to grant sudo powers for package installation"
50+
${SUDO} -v || true
51+
fi
52+
${SUDO} sh -c 'curl -fsSL https://key.henderkes.com/static-php.gpg -o /usr/share/keyrings/static-php.gpg'
53+
${SUDO} sh -c 'echo "deb [signed-by=/usr/share/keyrings/static-php.gpg] https://deb.henderkes.com/ stable main" > /etc/apt/sources.list.d/static-php.list'
54+
if command -v apt >/dev/null 2>&1; then
55+
${SUDO} apt update
56+
${SUDO} apt -y install frankenphp
57+
else
58+
${SUDO} apt-get update
59+
${SUDO} apt-get -y install frankenphp
60+
fi
61+
echo
62+
echo "🥳 FrankenPHP installed successfully."
63+
echo
64+
echo "⭐ If you like FrankenPHP, please give it a star on GitHub: ${italic}https://github.com/php/frankenphp${normal}"
65+
exit 0
66+
fi
67+
fi
68+
2469
case ${ARCH} in
2570
aarch64)
2671
THE_ARCH_BIN="frankenphp-linux-aarch64"
@@ -63,33 +108,22 @@ if [ -z "${THE_ARCH_BIN}" ]; then
63108
exit 1
64109
fi
65110

66-
SUDO=""
67-
68111
echo "📦 Downloading ${bold}FrankenPHP${normal} for ${OS}${GNU} (${ARCH}):"
69112

70-
# check if $DEST is writable and suppress an error message
71113
touch "${DEST}" 2>/dev/null
72114

73-
# we need sudo powers to write to DEST
74115
if [ $? -eq 1 ]; then
75116
echo "❗ You do not have permission to write to ${italic}${DEST}${normal}, enter your password to grant sudo powers"
76117
SUDO="sudo"
77118
fi
78119

79-
if type "curl" >/dev/null 2>&1; then
80-
curl -L --progress-bar "https://github.com/php/frankenphp/releases/latest/download/${THE_ARCH_BIN}" -o "${DEST}"
81-
elif type "wget" >/dev/null 2>&1; then
82-
${SUDO} wget "https://github.com/php/frankenphp/releases/latest/download/${THE_ARCH_BIN}" -O "${DEST}"
83-
else
84-
echo "❗ Please install ${italic}curl${normal} or ${italic}wget${normal} to download FrankenPHP"
85-
exit 1
86-
fi
120+
curl -L --progress-bar "https://github.com/php/frankenphp/releases/latest/download/${THE_ARCH_BIN}" -o "${DEST}"
87121

88122
${SUDO} chmod +x "${DEST}"
89123

90124
echo
91125
echo "🥳 FrankenPHP downloaded successfully to ${italic}${DEST}${normal}"
92126
echo "🔧 Move the binary to ${italic}/usr/local/bin/${normal} or another directory in your ${italic}PATH${normal} to use it globally:"
93-
echo " ${bold}sudo mv ${DEST} /usr/local/bin/${normal}"
127+
echo " ${bold}sudo mv ${DEST} /usr/local/bin/${normal}"
94128
echo
95129
echo "⭐ If you like FrankenPHP, please give it a star on GitHub: ${italic}https://github.com/php/frankenphp${normal}"

0 commit comments

Comments
 (0)