diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index 611be71..0000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,3 +0,0 @@ -# These are supported funding model platforms - -custom: ["https://www.paypal.me/switnet", switnet.net] diff --git a/README.md b/README.md index 5a041c3..d231641 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Login into your clean server, clone git repository and run the installer, ``` git clone https://github.com/switnet-ltd/quick-jibri-installer cd quick-jibri-installer -sudo bash quick_jibri_installer.sh +bash quick-jibri-installer.sh ``` ![QJI - Setup](https://raw.githubusercontent.com/wiki/switnet-ltd/quick-jibri-installer/images/qji-diagram-setup.png) diff --git a/quick_jibri_installer.sh b/quick_jibri_installer.sh index 0b9548b..dd077f7 100644 --- a/quick_jibri_installer.sh +++ b/quick_jibri_installer.sh @@ -341,7 +341,8 @@ if [ "$LE_SSL" = "yes" ]; then apt-get -y install \ letsencrypt if [ "$(dpkg-query -W -f='${Status}' ufw 2>/dev/null | grep -c "ok installed")" == "1" ]; then - echo "# Disable pre-installed ufw to allow ssl challenges validation." + echo "# Disable pre-installed ufw, more on firewall see: + > https://github.com/switnet-ltd/quick-jibri-installer/wiki/Firewall" ufw disable fi fi @@ -451,8 +452,8 @@ echo ' ######################################################################## ' # MEET / JIBRI SETUP -DOMAIN="$(ls /etc/prosody/conf.d/ | awk -F'.cfg' '!/localhost/{print $1}' | awk '!NF || !seen[$0]++')" -WS_CONF="/etc/nginx/sites-enabled/$DOMAIN.conf" +DOMAIN="$(find /etc/prosody/conf.d/ -name *.lua|awk -F'.cfg' '!/localhost/{print $1}'|xargs basename)" +WS_CONF="/etc/nginx/sites-available/$DOMAIN.conf" JB_AUTH_PASS="$(tr -dc "a-zA-Z0-9#*=" < /dev/urandom | fold -w 10 | head -n1)" JB_REC_PASS="$(tr -dc "a-zA-Z0-9#*=" < /dev/urandom | fold -w 10 | head -n1)" PROSODY_FILE="/etc/prosody/conf.d/$DOMAIN.cfg.lua" diff --git a/tools/aws-grub-setup.sh b/tools/aws-grub-setup.sh new file mode 100644 index 0000000..409bb4a --- /dev/null +++ b/tools/aws-grub-setup.sh @@ -0,0 +1,70 @@ +#!/bin/bash +# Automated AWS generic kernel setup for jibri. +# SwITNet Ltd © - 2022, https://switnet.net/ +# GPLv3 or later. + +#### +# NOTE: Only use this script if you know what you are doing. +# Under your own risk. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY. +#### +wait_seconds() { +secs=$(($1)) +while [ $secs -gt 0 ]; do + echo -ne "$secs\033[0K\r" + sleep 1 + : $((secs--)) +done +} + +# Check if user is root +if [ $UID != 0 ]; then + echo You need to run this script as root or sudo rights! + exit 1 +fi + +TMP_DIR="$(mktemp -d)" +KERNEL_LOG="$TMP_DIR/kernel_log" +GRUB_FILE="/etc/default/grub" + +echo -e "# Check and update HWE kernel if possible...\n" +apt-get -q2 update +HWE_VIR_MOD=$(apt-cache madison linux-image-generic-hwe-$(lsb_release -sr) 2>/dev/null|head -n1|grep -c "hwe-$(lsb_release -sr)") +if [ "$HWE_VIR_MOD" = "1" ]; then + apt-get -y install \ + linux-image-generic-hwe-$(lsb_release -sr) \ + linux-tools-generic-hwe-$(lsb_release -sr) +else + apt-get -y install \ + linux-image-generic \ + linux-modules-extra-$(uname -r) +fi +apt-get -y autoremove +apt-get autoclean + +#Write update-grub output +update-grub > $KERNEL_LOG 2>&1 + +#Get clean output +cat $KERNEL_LOG | awk -F'boot/' '{print$2}'|sed '/^[[:space:]]*$/d' | \ +tee ${KERNEL_LOG}.tmp +mv ${KERNEL_LOG}.tmp $KERNEL_LOG + +echo -e "Check if AWS kernel is installed.\n" +[ $(grep -wc aws $KERNEL_LOG) = 0 ] && echo "No AWS kernel found, exiting..." && exit + +#Get kernel number +RAW_KERNEL_NUM="$(grep -Fn generic $KERNEL_LOG|head -n1|cut -d ':' -f1)" +FIXED_KERNEL_NUM="$(awk "BEGIN{ print $RAW_KERNEL_NUM - 1 }")" + +echo -e "Set up GRUB for custom kernel.\n" +sed -i "s|GRUB_DEFAULT=.*|GRUB_DEFAULT=\"1\>$FIXED_KERNEL_NUM\"|" $GRUB_FILE + +echo -e "Saving changes...\n" +update-grub + +echo "Time to reboot..." +echo "Rebooting in..." +wait_seconds 15 +reboot diff --git a/tools/start-over.sh b/tools/start-over.sh index 0cdc991..4db729f 100644 --- a/tools/start-over.sh +++ b/tools/start-over.sh @@ -79,8 +79,8 @@ if [ "$CONTINUE_PURGE2" = "no" ]; then echo " Good, see you next time..." exit elif [ "$CONTINUE_PURGE2" = "yes" ]; then - echo "No going back, lets start..." - wait_seconds 5 + echo "No going back, let's start..." + wait_seconds 10 fi done