v7.2 (#100)
* jitsi-updater.sh: fix check chrome driver version. * jra_nextcloud.sh: organize functions, add apt checks, higher password length and small fixes. * quick_jibri_installer.sh,jitsi-updater.sh: update chromedriver 115+ version download. * quick_jibri_installer.sh: update nodejs to a stable release. * quick_jibri_installer.sh: fix empty variable usage. * quick_jibri_installer.sh: rearrange chromedriver variables.
This commit is contained in:
parent
5a143d4c25
commit
ccec4a0ab6
|
@ -40,7 +40,10 @@ fi
|
||||||
support="https://switnet.net/support"
|
support="https://switnet.net/support"
|
||||||
apt_repo="/etc/apt/sources.list.d"
|
apt_repo="/etc/apt/sources.list.d"
|
||||||
ENABLE_BLESSM="TBD"
|
ENABLE_BLESSM="TBD"
|
||||||
CHD_LTST="$(curl -sL https://chromedriver.storage.googleapis.com/LATEST_RELEASE)"
|
G_CHROME=$(apt-cache madison google-chrome-stable|awk '{print$3}'|cut -d. -f1-3)
|
||||||
|
CHROMELAB_URL="https://googlechromelabs.github.io/chrome-for-testing"
|
||||||
|
CHD_LTST_DWNL=$(curl -s $CHROMELAB_URL/known-good-versions-with-downloads.json | jq -r ".versions[].downloads.chromedriver | select(. != null) | .[].url" | grep linux64 | grep "$G_CHROME" | tail -1)
|
||||||
|
CHD_LTST=$(awk -F '/' '{print$7}' <<< "$CHD_LTST_DWNL")
|
||||||
CHD_LTST_2D="$(cut -d "." -f 1,2 <<< "$CHD_LTST")"
|
CHD_LTST_2D="$(cut -d "." -f 1,2 <<< "$CHD_LTST")"
|
||||||
CHDB="$(whereis chromedriver | awk '{print$2}')"
|
CHDB="$(whereis chromedriver | awk '{print$2}')"
|
||||||
if [ -d /etc/prosody/conf.d/ ]; then
|
if [ -d /etc/prosody/conf.d/ ]; then
|
||||||
|
@ -66,12 +69,6 @@ read -r -a google_package < <(grep ^Package /var/lib/apt/lists/dl.google.com_*_P
|
||||||
else
|
else
|
||||||
echo "Seems no Google repo installed"
|
echo "Seems no Google repo installed"
|
||||||
fi
|
fi
|
||||||
if [ -z "$CHDB" ]; then
|
|
||||||
echo "Seems no chromedriver installed"
|
|
||||||
else
|
|
||||||
CHD_VER_LOCAL="$($CHDB -v | awk '{print $2}')"
|
|
||||||
CHD_VER_2D="$(awk '{printf "%.1f\n", $NF}' <<< "$CHD_VER_LOCAL")"
|
|
||||||
fi
|
|
||||||
if [ -f "$apt_repo"/nodesource.list ]; then
|
if [ -f "$apt_repo"/nodesource.list ]; then
|
||||||
read -r -a nodejs_package < <(grep ^Package /var/lib/apt/lists/deb.nodesource.com_node*_Packages | \
|
read -r -a nodejs_package < <(grep ^Package /var/lib/apt/lists/deb.nodesource.com_node*_Packages | \
|
||||||
sort -u | awk '{print $2}' | xargs)
|
sort -u | awk '{print $2}' | xargs)
|
||||||
|
@ -114,6 +111,12 @@ update_google_repo() {
|
||||||
else
|
else
|
||||||
echo "No Google repository found"
|
echo "No Google repository found"
|
||||||
fi
|
fi
|
||||||
|
if [ -z "$CHDB" ]; then
|
||||||
|
echo "Seems no chromedriver installed"
|
||||||
|
else
|
||||||
|
CHD_VER_LOCAL="$($CHDB -v | awk '{print $2}')"
|
||||||
|
CHD_VER_2D="$(awk '{printf "%.1f\n", $NF}' <<< "$CHD_VER_LOCAL")"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
update_nodejs_repo() {
|
update_nodejs_repo() {
|
||||||
apt-get update -o Dir::Etc::sourcelist="sources.list.d/nodesource.list" \
|
apt-get update -o Dir::Etc::sourcelist="sources.list.d/nodesource.list" \
|
||||||
|
@ -131,9 +134,10 @@ upgrade_cd() {
|
||||||
if [ -n "$GOOGL_VER_2D" ]; then
|
if [ -n "$GOOGL_VER_2D" ]; then
|
||||||
if version_gt "$GOOGL_VER_2D" "$CHD_VER_2D" ; then
|
if version_gt "$GOOGL_VER_2D" "$CHD_VER_2D" ; then
|
||||||
echo "Upgrading Chromedriver to Google Chromes version"
|
echo "Upgrading Chromedriver to Google Chromes version"
|
||||||
wget -q https://chromedriver.storage.googleapis.com/"$CHD_LTST"/chromedriver_linux64.zip \
|
wget -q "$CHD_LTST_DWNL" \
|
||||||
-O /tmp/chromedriver_linux64.zip
|
-O /tmp/chromedriver_linux64.zip
|
||||||
unzip -o /tmp/chromedriver_linux64.zip -d /usr/local/bin/
|
unzip -o /tmp/chromedriver_linux64.zip -d /usr/local/bin/
|
||||||
|
mv /usr/local/bin/chromedriver-linux64/chromedriver "$CHDB"
|
||||||
chown root:root "$CHDB"
|
chown root:root "$CHDB"
|
||||||
chmod 0755 "$CHDB"
|
chmod 0755 "$CHDB"
|
||||||
rm -rf /tpm/chromedriver_linux64.zip
|
rm -rf /tpm/chromedriver_linux64.zip
|
||||||
|
|
|
@ -37,6 +37,10 @@ echo -e '\n
|
||||||
by Software, IT & Networks Ltd
|
by Software, IT & Networks Ltd
|
||||||
\n'
|
\n'
|
||||||
exit_if_not_installed jitsi-meet
|
exit_if_not_installed jitsi-meet
|
||||||
|
## APT checks
|
||||||
|
apt-get update -q2
|
||||||
|
# Manually add prerequisites.
|
||||||
|
apt-get install -y curl letsencrypt nginx
|
||||||
|
|
||||||
DISTRO_RELEASE="$(lsb_release -sc)"
|
DISTRO_RELEASE="$(lsb_release -sc)"
|
||||||
DOMAIN="$(find /etc/prosody/conf.d/ -name \*.lua|awk -F'.cfg' '!/localhost/{print $1}'|xargs basename)"
|
DOMAIN="$(find /etc/prosody/conf.d/ -name \*.lua|awk -F'.cfg' '!/localhost/{print $1}'|xargs basename)"
|
||||||
|
@ -47,6 +51,7 @@ PHP_FPM_DIR="/etc/php/$PHPVER/fpm"
|
||||||
PHP_INI="$PHP_FPM_DIR/php.ini"
|
PHP_INI="$PHP_FPM_DIR/php.ini"
|
||||||
PHP_CONF="/etc/php/$PHPVER/fpm/pool.d/www.conf"
|
PHP_CONF="/etc/php/$PHPVER/fpm/pool.d/www.conf"
|
||||||
NC_NGINX_SSL_PORT="$(grep "listen 44" /etc/nginx/sites-available/"$DOMAIN".conf | awk '{print$2}')"
|
NC_NGINX_SSL_PORT="$(grep "listen 44" /etc/nginx/sites-available/"$DOMAIN".conf | awk '{print$2}')"
|
||||||
|
[ -z $NC_NGINX_SSL_PORT ] && NC_NGINX_SSL_PORT="443"
|
||||||
NC_REPO="https://download.nextcloud.com/server/releases"
|
NC_REPO="https://download.nextcloud.com/server/releases"
|
||||||
NCVERSION="$(curl -s -m 900 $NC_REPO/ | sed --silent 's/.*href="nextcloud-\([^"]\+\).zip.asc".*/\1/p' | sort --version-sort | tail -1)"
|
NCVERSION="$(curl -s -m 900 $NC_REPO/ | sed --silent 's/.*href="nextcloud-\([^"]\+\).zip.asc".*/\1/p' | sort --version-sort | tail -1)"
|
||||||
STABLEVERSION="nextcloud-$NCVERSION"
|
STABLEVERSION="nextcloud-$NCVERSION"
|
||||||
|
@ -58,13 +63,13 @@ NC_DB_PASSWD="$(tr -dc "a-zA-Z0-9#_*=" < /dev/urandom | fold -w 14 | head -n1)"
|
||||||
DIR_RECORD="$(awk -F '"' '/RECORDING/{print$2}' /home/jibri/finalize_recording.sh|awk 'NR==1{print$1}')"
|
DIR_RECORD="$(awk -F '"' '/RECORDING/{print$2}' /home/jibri/finalize_recording.sh|awk 'NR==1{print$1}')"
|
||||||
REDIS_CONF="/etc/redis/redis.conf"
|
REDIS_CONF="/etc/redis/redis.conf"
|
||||||
JITSI_MEET_PROXY="/etc/nginx/modules-enabled/60-jitsi-meet.conf"
|
JITSI_MEET_PROXY="/etc/nginx/modules-enabled/60-jitsi-meet.conf"
|
||||||
if [ -f "$JITSI_MEET_PROXY" ];then
|
|
||||||
PREAD_PROXY=$(grep -nr "preread_server_name" "$JITSI_MEET_PROXY" | cut -d ":" -f1)
|
[ -f "$JITSI_MEET_PROXY" ] && PREAD_PROXY=$(grep -nr "preread_server_name" "$JITSI_MEET_PROXY" | cut -d ":" -f1)
|
||||||
fi
|
|
||||||
PUBLIC_IP="$(dig +short myip.opendns.com @resolver1.opendns.com)"
|
PUBLIC_IP="$(dig +short myip.opendns.com @resolver1.opendns.com)"
|
||||||
ISO3166_CODE=TBD
|
ISO3166_CODE=TBD
|
||||||
NL="$(printf '\n ')"
|
NL="$(printf '\n ')"
|
||||||
TMP_GPG_REPO="$(mktemp -d)"
|
TMP_GPG_REPO="$(mktemp -d)"
|
||||||
|
|
||||||
add_gpg_keyring() {
|
add_gpg_keyring() {
|
||||||
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com "$1"
|
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com "$1"
|
||||||
apt-key export "$1" | gpg --dearmour | tee "$TMP_GPG_REPO"/"$1".gpg >/dev/null
|
apt-key export "$1" | gpg --dearmour | tee "$TMP_GPG_REPO"/"$1".gpg >/dev/null
|
||||||
|
@ -85,7 +90,34 @@ for i in $1
|
||||||
apt-get -y install $packages
|
apt-get -y install $packages
|
||||||
packages=""
|
packages=""
|
||||||
}
|
}
|
||||||
|
exit_ifinstalled() {
|
||||||
|
if [ "$(dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed")" == "1" ]; then
|
||||||
|
echo " This instance already has $1 installed, exiting..."
|
||||||
|
echo " If you think this is an error, please report to:
|
||||||
|
-> https://github.com/switnet-ltd/quick-jibri-installer/issues "
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
install_ifnot() {
|
||||||
|
if [ "$(dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed")" == "1" ]; then
|
||||||
|
echo " $1 is installed, skipping..."
|
||||||
|
else
|
||||||
|
echo -e "\n---- Installing $1 ----"
|
||||||
|
apt-get -yq2 install "$1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
add_php() {
|
||||||
|
if [ "$PHP_REPO" = "php" ]; then
|
||||||
|
echo "PHP $PHPVER already installed"
|
||||||
|
apt-get -q2 update
|
||||||
|
apt-get -yq2 dist-upgrade
|
||||||
|
else
|
||||||
|
echo "# Adding Ondrej PHP $PHPVER PPA Repository"
|
||||||
|
add_gpg_keyring E5267A6C
|
||||||
|
echo "deb [arch=amd64] http://ppa.launchpad.net/ondrej/php/ubuntu $DISTRO_RELEASE main" > /etc/apt/sources.list.d/php"$PHPVER".list
|
||||||
|
apt-get update -q2
|
||||||
|
fi
|
||||||
|
}
|
||||||
while [[ "$ANS_NCD" != "yes" ]]
|
while [[ "$ANS_NCD" != "yes" ]]
|
||||||
do
|
do
|
||||||
read -p "> Please set your domain (or subdomain) here for Nextcloud: (e.g.: cloud.domain.com)$NL" -r NC_DOMAIN
|
read -p "> Please set your domain (or subdomain) here for Nextcloud: (e.g.: cloud.domain.com)$NL" -r NC_DOMAIN
|
||||||
|
@ -124,11 +156,11 @@ do
|
||||||
echo " - This field is mandatory."
|
echo " - This field is mandatory."
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
while [ -z "$NC_PASS" ] || [ ${#NC_PASS} -lt 6 ]
|
while [ -z "$NC_PASS" ] || [ ${#NC_PASS} -lt 8 ]
|
||||||
do
|
do
|
||||||
read -p "Nextcloud user password: " -r NC_PASS
|
read -p "Nextcloud user password: " -r NC_PASS
|
||||||
if [ -z "$NC_PASS" ] || [ ${#NC_PASS} -lt 6 ]; then
|
if [ -z "$NC_PASS" ] || [ ${#NC_PASS} -lt8 ]; then
|
||||||
echo -e " - This field is mandatory. \nPlease make sure it's at least 6 characters.\n"
|
echo -e " - This field is mandatory. \nPlease make sure it's at least 8 characters.\n"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
#Enable HSTS
|
#Enable HSTS
|
||||||
|
@ -169,34 +201,6 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit_ifinstalled() {
|
|
||||||
if [ "$(dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed")" == "1" ]; then
|
|
||||||
echo " This instance already has $1 installed, exiting..."
|
|
||||||
echo " If you think this is an error, please report to:
|
|
||||||
-> https://github.com/switnet-ltd/quick-jibri-installer/issues "
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
install_ifnot() {
|
|
||||||
if [ "$(dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed")" == "1" ]; then
|
|
||||||
echo " $1 is installed, skipping..."
|
|
||||||
else
|
|
||||||
echo -e "\n---- Installing $1 ----"
|
|
||||||
apt-get -yq2 install "$1"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
add_php() {
|
|
||||||
if [ "$PHP_REPO" = "php" ]; then
|
|
||||||
echo "PHP $PHPVER already installed"
|
|
||||||
apt-get -q2 update
|
|
||||||
apt-get -yq2 dist-upgrade
|
|
||||||
else
|
|
||||||
echo "# Adding Ondrej PHP $PHPVER PPA Repository"
|
|
||||||
add_gpg_keyring E5267A6C
|
|
||||||
echo "deb [arch=amd64] http://ppa.launchpad.net/ondrej/php/ubuntu $DISTRO_RELEASE main" > /etc/apt/sources.list.d/php"$PHPVER".list
|
|
||||||
apt-get update -q2
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
#Prevent root folder permission issues
|
#Prevent root folder permission issues
|
||||||
cp "$PWD"/files/jra-nc-app-ef.json /tmp
|
cp "$PWD"/files/jra-nc-app-ef.json /tmp
|
||||||
|
|
||||||
|
@ -206,7 +210,8 @@ exit_ifinstalled postgresql-"$PSGVER"
|
||||||
# PostgresSQL
|
# PostgresSQL
|
||||||
install_ifnot postgresql-"$PSGVER"
|
install_ifnot postgresql-"$PSGVER"
|
||||||
|
|
||||||
# PHP 7.4
|
# PHP 7.4 / 8.1
|
||||||
|
|
||||||
add_php
|
add_php
|
||||||
install_aval_package " \
|
install_aval_package " \
|
||||||
imagemagick \
|
imagemagick \
|
||||||
|
@ -488,7 +493,7 @@ echo -e "\nApply custom mods...\n"
|
||||||
sed -i "/datadirectory/a \ \ \'skeletondirectory\' => \'\'," "$NC_CONFIG"
|
sed -i "/datadirectory/a \ \ \'skeletondirectory\' => \'\'," "$NC_CONFIG"
|
||||||
sed -i "/skeletondirectory/a \ \ \'simpleSignUpLink.shown\' => false," "$NC_CONFIG"
|
sed -i "/skeletondirectory/a \ \ \'simpleSignUpLink.shown\' => false," "$NC_CONFIG"
|
||||||
sed -i "/simpleSignUpLink.shown/a \ \ \'knowledgebaseenabled\' => false," "$NC_CONFIG"
|
sed -i "/simpleSignUpLink.shown/a \ \ \'knowledgebaseenabled\' => false," "$NC_CONFIG"
|
||||||
sed -i "s|http://localhost|http://$NC_DOMAIN|" "$NC_CONFIG"
|
sed -i "s|http://localhost|https://$NC_DOMAIN|" "$NC_CONFIG"
|
||||||
|
|
||||||
echo -e "\nAdd crontab...\n"
|
echo -e "\nAdd crontab...\n"
|
||||||
crontab -u www-data -l | { cat; echo "*/5 * * * * php -f $NC_PATH/cron.php"; } | crontab -u www-data -
|
crontab -u www-data -l | { cat; echo "*/5 * * * * php -f $NC_PATH/cron.php"; } | crontab -u www-data -
|
||||||
|
|
|
@ -391,7 +391,7 @@ echo "
|
||||||
if [ "$(dpkg-query -W -f='${Status}' nodejs 2>/dev/null | grep -c "ok")" == "1" ]; then
|
if [ "$(dpkg-query -W -f='${Status}' nodejs 2>/dev/null | grep -c "ok")" == "1" ]; then
|
||||||
echo "Nodejs is installed, skipping..."
|
echo "Nodejs is installed, skipping..."
|
||||||
else
|
else
|
||||||
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
|
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
|
||||||
apt-get install -yq2 nodejs
|
apt-get install -yq2 nodejs
|
||||||
echo "Installing nodejs esprima package..."
|
echo "Installing nodejs esprima package..."
|
||||||
npm install -g esprima
|
npm install -g esprima
|
||||||
|
@ -404,9 +404,6 @@ elif [ "$(npm list -g esprima 2>/dev/null | grep -c "esprima")" == "1" ]; then
|
||||||
echo "Good. Esprima package is already installed"
|
echo "Good. Esprima package is already installed"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CHD_LTST=$(curl -sL https://chromedriver.storage.googleapis.com/LATEST_RELEASE)
|
|
||||||
GCMP_JSON="/etc/opt/chrome/policies/managed/managed_policies.json"
|
|
||||||
|
|
||||||
echo "# Installing Google Chrome / ChromeDriver"
|
echo "# Installing Google Chrome / ChromeDriver"
|
||||||
if [ "$GOOGLE_ACTIVE_REPO" = "main" ]; then
|
if [ "$GOOGLE_ACTIVE_REPO" = "main" ]; then
|
||||||
echo "Google repository already set."
|
echo "Google repository already set."
|
||||||
|
@ -420,13 +417,20 @@ apt-get -q2 update
|
||||||
apt-get install -yq2 google-chrome-stable
|
apt-get install -yq2 google-chrome-stable
|
||||||
rm -rf /etc/apt/sources.list.d/dl_google_com_linux_chrome_deb.list
|
rm -rf /etc/apt/sources.list.d/dl_google_com_linux_chrome_deb.list
|
||||||
|
|
||||||
|
G_CHROME=$(apt-cache madison google-chrome-stable|awk '{print$3}'|cut -d. -f1-3)
|
||||||
|
CHROMELAB_URL="https://googlechromelabs.github.io/chrome-for-testing"
|
||||||
|
CHD_LTST_DWNL=$(curl -s $CHROMELAB_URL/known-good-versions-with-downloads.json | jq -r ".versions[].downloads.chromedriver | select(. != null) | .[].url" | grep linux64 | grep "$G_CHROME" | tail -1)
|
||||||
|
CHD_LTST=$(awk -F '/' '{print$7}' <<< "$CHD_LTST_DWNL")
|
||||||
|
GCMP_JSON="/etc/opt/chrome/policies/managed/managed_policies.json"
|
||||||
|
|
||||||
if [ -f /usr/local/bin/chromedriver ]; then
|
if [ -f /usr/local/bin/chromedriver ]; then
|
||||||
echo "Chromedriver already installed."
|
echo "Chromedriver already installed."
|
||||||
else
|
else
|
||||||
echo "Installing Chromedriver"
|
echo "Installing Chromedriver"
|
||||||
wget -q https://chromedriver.storage.googleapis.com/"$CHD_LTST"/chromedriver_linux64.zip \
|
wget -q "$CHD_LTST_DWNL" \
|
||||||
-O /tmp/chromedriver_linux64.zip
|
-O /tmp/chromedriver_linux64.zip
|
||||||
unzip -o /tmp/chromedriver_linux64.zip -d /usr/local/bin/
|
unzip -o /tmp/chromedriver_linux64.zip -d /usr/local/bin/
|
||||||
|
mv /usr/local/bin/chromedriver-linux64/chromedriver /usr/local/bin/chromedriver
|
||||||
chown root:root /usr/local/bin/chromedriver
|
chown root:root /usr/local/bin/chromedriver
|
||||||
chmod 0755 /usr/local/bin/chromedriver
|
chmod 0755 /usr/local/bin/chromedriver
|
||||||
rm -rf /tmp/chromedriver_linux64.zip
|
rm -rf /tmp/chromedriver_linux64.zip
|
||||||
|
|
Loading…
Reference in New Issue