forked from rapyd-cloud/rapyd-vz-support
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrapyd-monarx-linker.sh
33 lines (25 loc) · 1011 Bytes
/
rapyd-monarx-linker.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
#!/bin/bash
# must be run as root user
cd ~
# define logic variables to determine which monarx linked so file we should deploy
MONARX_PHP=$(php-config --version | cut -c -3)
MONARX_PHPSTRIPPED=${MONARX_PHP/.}
MONARX_INI_DIR=$(php-config --ini-dir)
MONARX_EXT_DIR=$(php-config --extension-dir)
MONARX_ARCH=$(arch | sed -e 's/arm64/aarch64/;s/amd64\|x86_64/x86-64/')
MONARX_SOPATH="/usr/lib64/monarx-protect"
MONARX_SO="monarxprotect-php$MONARX_PHPSTRIPPED.so"
MONARX_INI_FILEPATH="$MONARX_INI_DIR/monarxprotect.ini"
MONARX_LINKED="$MONARX_EXT_DIR/$MONARX_SO"
# clean up any existing linked file and then link so
if [ -L "$MONARX_LINKED" ]; then
rm -f "$MONARX_LINKED"
fi
ln -sf "$MONARX_SOPATH/$MONARX_SO" "$MONARX_EXT_DIR"
# clean up any existing monarxprotect.ini file and then create new one
if [ -f "$MONARX_INI_FILEPATH" ]; then
rm -f "$MONARX_INI_FILEPATH"
fi
echo "extension=$MONARX_SO" > "$MONARX_INI_FILEPATH"
chown litespeed:litespeed "$MONARX_INI_FILEPATH"
# end of monarx linker logic