6.4.4
* Use the original file, instead of overwrite the symlink. * Fix typo and increase countdown. * Add tool for grub setup.
This commit is contained in:
parent
fff640c495
commit
299c288813
|
@ -341,7 +341,8 @@ if [ "$LE_SSL" = "yes" ]; then
|
||||||
apt-get -y install \
|
apt-get -y install \
|
||||||
letsencrypt
|
letsencrypt
|
||||||
if [ "$(dpkg-query -W -f='${Status}' ufw 2>/dev/null | grep -c "ok installed")" == "1" ]; then
|
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
|
ufw disable
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -451,8 +452,8 @@ echo '
|
||||||
########################################################################
|
########################################################################
|
||||||
'
|
'
|
||||||
# MEET / JIBRI SETUP
|
# MEET / JIBRI SETUP
|
||||||
DOMAIN="$(ls /etc/prosody/conf.d/ | awk -F'.cfg' '!/localhost/{print $1}' | awk '!NF || !seen[$0]++')"
|
DOMAIN="$(find /etc/prosody/conf.d/ -name *.lua|awk -F'.cfg' '!/localhost/{print $1}'|xargs basename)"
|
||||||
WS_CONF="/etc/nginx/sites-enabled/$DOMAIN.conf"
|
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_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)"
|
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"
|
PROSODY_FILE="/etc/prosody/conf.d/$DOMAIN.cfg.lua"
|
||||||
|
|
|
@ -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
|
|
@ -79,8 +79,8 @@ if [ "$CONTINUE_PURGE2" = "no" ]; then
|
||||||
echo " Good, see you next time..."
|
echo " Good, see you next time..."
|
||||||
exit
|
exit
|
||||||
elif [ "$CONTINUE_PURGE2" = "yes" ]; then
|
elif [ "$CONTINUE_PURGE2" = "yes" ]; then
|
||||||
echo "No going back, lets start..."
|
echo "No going back, let's start..."
|
||||||
wait_seconds 5
|
wait_seconds 10
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue