2021-09-30 12:05:43 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
package_sysname="onlyoffice";
|
|
|
|
DS_COMMON_NAME="onlyoffice";
|
2023-08-07 11:50:53 +00:00
|
|
|
product_name="DocSpace"
|
|
|
|
product=$(tr '[:upper:]' '[:lower:]' <<< ${product_name})
|
2023-05-12 09:48:18 +00:00
|
|
|
INSTALLATION_TYPE="ENTERPRISE"
|
2023-07-27 09:20:50 +00:00
|
|
|
MAKESWAP="true"
|
2021-09-30 12:05:43 +00:00
|
|
|
RES_APP_INSTALLED="is already installed";
|
|
|
|
RES_APP_CHECK_PORTS="uses ports"
|
|
|
|
RES_CHECK_PORTS="please, make sure that the ports are free.";
|
2023-08-07 11:50:53 +00:00
|
|
|
RES_INSTALL_SUCCESS="Thank you for installing ONLYOFFICE ${product_name}.";
|
2023-08-07 11:49:23 +00:00
|
|
|
RES_QUESTIONS="In case you have any questions contact us via http://support.onlyoffice.com or visit our forum at http://forum.onlyoffice.com"
|
2021-09-30 12:05:43 +00:00
|
|
|
|
|
|
|
while [ "$1" != "" ]; do
|
|
|
|
case $1 in
|
|
|
|
|
|
|
|
-u | --update )
|
|
|
|
if [ "$2" != "" ]; then
|
|
|
|
UPDATE=$2
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
;;
|
2023-04-26 06:57:42 +00:00
|
|
|
|
|
|
|
-je | --jwtenabled )
|
|
|
|
if [ "$2" != "" ]; then
|
|
|
|
DS_JWT_ENABLED=$2
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
|
|
|
-jh | --jwtheader )
|
|
|
|
if [ "$2" != "" ]; then
|
|
|
|
DS_JWT_HEADER=$2
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
|
|
|
-js | --jwtsecret )
|
|
|
|
if [ "$2" != "" ]; then
|
|
|
|
DS_JWT_SECRET=$2
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
;;
|
2021-10-11 09:08:29 +00:00
|
|
|
|
|
|
|
-gb | --gitbranch )
|
|
|
|
if [ "$2" != "" ]; then
|
|
|
|
PARAMETERS="$PARAMETERS ${1}";
|
|
|
|
GIT_BRANCH=$2
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
;;
|
2021-09-30 12:05:43 +00:00
|
|
|
|
|
|
|
-ls | --localscripts )
|
|
|
|
if [ "$2" != "" ]; then
|
|
|
|
LOCAL_SCRIPTS=$2
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
2021-12-10 13:26:34 +00:00
|
|
|
-skiphc | --skiphardwarecheck )
|
|
|
|
if [ "$2" != "" ]; then
|
|
|
|
SKIP_HARDWARE_CHECK=$2
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
2023-05-12 09:48:18 +00:00
|
|
|
-it | --installation_type )
|
|
|
|
if [ "$2" != "" ]; then
|
|
|
|
INSTALLATION_TYPE=$(echo "$2" | awk '{print toupper($0)}');
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
;;
|
2023-07-27 09:20:50 +00:00
|
|
|
|
|
|
|
-ms | --makeswap )
|
|
|
|
if [ "$2" != "" ]; then
|
|
|
|
MAKESWAP=$2
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
;;
|
2023-05-12 09:48:18 +00:00
|
|
|
|
2021-09-30 12:05:43 +00:00
|
|
|
-? | -h | --help )
|
|
|
|
echo " Usage $0 [PARAMETER] [[PARAMETER], ...]"
|
|
|
|
echo " Parameters:"
|
2023-05-25 08:57:12 +00:00
|
|
|
echo " -it, --installation_type installation type (community|enterprise)"
|
2021-09-30 12:05:43 +00:00
|
|
|
echo " -u, --update use to update existing components (true|false)"
|
2023-04-26 06:57:42 +00:00
|
|
|
echo " -je, --jwtenabled specifies the enabling the JWT validation (true|false)"
|
|
|
|
echo " -jh, --jwtheader defines the http header that will be used to send the JWT"
|
|
|
|
echo " -js, --jwtsecret defines the secret key to validate the JWT in the request"
|
2023-04-26 07:00:11 +00:00
|
|
|
echo " -ls, --local_scripts use 'true' to run local scripts (true|false)"
|
|
|
|
echo " -skiphc, --skiphardwarecheck use to skip hardware check (true|false)"
|
2023-07-27 09:20:50 +00:00
|
|
|
echo " -ms, --makeswap make swap file (true|false)"
|
2021-09-30 12:05:43 +00:00
|
|
|
echo " -?, -h, --help this help"
|
|
|
|
echo
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -z "${UPDATE}" ]; then
|
|
|
|
UPDATE="false";
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "${LOCAL_SCRIPTS}" ]; then
|
|
|
|
LOCAL_SCRIPTS="false";
|
|
|
|
fi
|
|
|
|
|
2021-12-10 13:26:34 +00:00
|
|
|
if [ -z "${SKIP_HARDWARE_CHECK}" ]; then
|
|
|
|
SKIP_HARDWARE_CHECK="false";
|
|
|
|
fi
|
|
|
|
|
2021-09-30 12:05:43 +00:00
|
|
|
if [ $(dpkg-query -W -f='${Status}' curl 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
|
|
|
|
apt-get update;
|
|
|
|
apt-get install -yq curl;
|
|
|
|
fi
|
|
|
|
|
2023-08-23 11:51:57 +00:00
|
|
|
if [ -z $GIT_BRANCH ]; then
|
|
|
|
DOWNLOAD_URL_PREFIX="https://download.onlyoffice.com/${product}/install-Debian"
|
|
|
|
else
|
2023-10-10 15:16:28 +00:00
|
|
|
DOWNLOAD_URL_PREFIX="https://raw.githubusercontent.com/ONLYOFFICE/${product}-buildtools/${GIT_BRANCH}/install/OneClickInstall/install-Debian"
|
2023-08-23 11:51:57 +00:00
|
|
|
fi
|
|
|
|
|
2021-09-30 12:05:43 +00:00
|
|
|
if [ "${LOCAL_SCRIPTS}" == "true" ]; then
|
|
|
|
source install-Debian/bootstrap.sh
|
|
|
|
else
|
|
|
|
source <(curl ${DOWNLOAD_URL_PREFIX}/bootstrap.sh)
|
|
|
|
fi
|
|
|
|
|
|
|
|
# add onlyoffice repo
|
2022-10-26 08:45:03 +00:00
|
|
|
mkdir -p -m 700 $HOME/.gnupg
|
2023-03-17 09:06:23 +00:00
|
|
|
echo "deb [signed-by=/usr/share/keyrings/onlyoffice.gpg] http://download.onlyoffice.com/repo/debian squeeze main" | tee /etc/apt/sources.list.d/onlyoffice.list
|
|
|
|
curl -fsSL https://download.onlyoffice.com/GPG-KEY-ONLYOFFICE | gpg --no-default-keyring --keyring gnupg-ring:/usr/share/keyrings/onlyoffice.gpg --import
|
|
|
|
chmod 644 /usr/share/keyrings/onlyoffice.gpg
|
2021-09-30 12:05:43 +00:00
|
|
|
|
|
|
|
declare -x LANG="en_US.UTF-8"
|
|
|
|
declare -x LANGUAGE="en_US:en"
|
|
|
|
declare -x LC_ALL="en_US.UTF-8"
|
|
|
|
|
|
|
|
if [ "${LOCAL_SCRIPTS}" == "true" ]; then
|
|
|
|
source install-Debian/tools.sh
|
|
|
|
source install-Debian/check-ports.sh
|
|
|
|
source install-Debian/install-preq.sh
|
|
|
|
source install-Debian/install-app.sh
|
|
|
|
else
|
|
|
|
source <(curl ${DOWNLOAD_URL_PREFIX}/tools.sh)
|
|
|
|
source <(curl ${DOWNLOAD_URL_PREFIX}/check-ports.sh)
|
|
|
|
source <(curl ${DOWNLOAD_URL_PREFIX}/install-preq.sh)
|
|
|
|
source <(curl ${DOWNLOAD_URL_PREFIX}/install-app.sh)
|
|
|
|
fi
|