bbb-post-install.sh: some minor changes on script output; get rid of unused code;

This commit is contained in:
Christoph 2020-03-29 01:21:29 +01:00
parent db729ef236
commit 50ccf5ea71

View File

@ -65,6 +65,14 @@ error (){
echo ""
}
info () {
if $terminal ; then
echo ""
echo -e " [ \033[32m\033[1minfo\033[m ] $*"
echo ""
fi
}
echo_ok() {
if $terminal ; then
echo -e "\033[85G[ \033[32mok\033[m ]"
@ -146,7 +154,8 @@ fi
# Make the HTML5 client default
#
if $terminal ; then
echo -e " \\033[1mMake the HTML5 client the default client\033[m (no longer load the Flash client)"
echo ""
echo -e " \033[1mMake the HTML5 client the default client\033[m (no longer load the Flash client)"
echo ""
fi
echononl "Set 'attendeesJoinViaHTML5Client=true'.."
@ -179,316 +188,31 @@ else
fi
fi
clean_up 0
# /etc/resolf.conf
#
echononl "Remove symlink '/etc/resolv.conf'.."
if [[ -h "/etc/resolv.conf" ]]; then
rm /etc/resolv.conf > $log_file 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
else
echo_skipped
fi
echononl "Create new file '/etc/resolf.conf'.."
cat <<EOF > /etc/resolv.conf 2> $log_file
### Hetzner Online GmbH installimage
# nameserver config
nameserver 213.133.100.100
nameserver 213.133.98.98
nameserver 213.133.99.99
nameserver 2a01:4f8:0:1::add:9898
nameserver 2a01:4f8:0:1::add:1010
nameserver 2a01:4f8:0:1::add:9999
EOF
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
echononl "Set FQDN hostname (IPv4).."
perl -i -n -p -e "s/^127\.0\.1\.1.*/127.0.1.1 $FQDN_HOSTNAME $HOSTNAME/" /etc/hosts > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
blank_line
echononl "Create sources.list for '$DIST $DIST_RELEASE'.."
cat <<EOF > /etc/apt/sources.list 2> "$log_file"
deb http://archive.ubuntu.com/ubuntu ${DIST_RELEASE} main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu ${DIST_RELEASE}-updates main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu ${DIST_RELEASE}-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu ${DIST_RELEASE}-backports main restricted universe multiverse
EOF
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
echononl "Update repositories.."
apt-get update > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
echononl "Upgrade System.."
apt-get dist-upgrade > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
blank_line
# Set the locale of the server to 'en_US.UTF-8'.
# Assign the server a hostname
#
echononl "Install 'language-pack-en'.."
apt-get install language-pack-en > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
if $terminal ; then
echo ""
echo -e " \033[1mAssign the server a hostname '$FQDN_HOSTNAME'\033[m"
echo ""
fi
echononl "Set the locale of the server to 'en_US.UTF-8'.."
update-locale LANG=en_US.UTF-8 > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
echononl "Set system environment to 'en_US.UTF-8'.."
systemctl set-environment LANG=en_US.UTF-8 > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
blank_line
# BigBlueButtons components, such as Tomcat, need a source of entropy when starting up.
#
echononl "Install 'haveged'.."
apt-get install haveged > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
echononl "Install 'software-properties-common'.."
apt-get install software-properties-common -y > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
blank_line
# Add reposototies for 'ffmpeg' (create recordings) and 'yq' (update YAML files)
#
# Note:
# The default version of ffmpeg in Ubuntu 16.04 is old and yq does not exist
# in the default repositories
#
echononl "Add repository for 'ffmpeg' .."
add-apt-repository ppa:bigbluebutton/support -y > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
echononl "Add repository for 'yq'.."
add-apt-repository ppa:rmescandon/yq -y > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
echononl "Update repositories.."
apt-get update > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
echononl "Upgrade System.."
apt-get dist-upgrade > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
blank_line
# add repository for mongodb
#
echononl "Add apt key for 'mongodb' repository.."
wget -qO - https://www.mongodb.org/static/pgp/server-3.4.asc | sudo apt-key add - > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
echononl "Add repository for 'mongodb'.."
cat <<EOF > /etc/apt/sources.list.d/mongodb-org-3.4.list 2> "$log_file"
deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu ${DIST_RELEASE}/mongodb-org/3.4 multiverse
EOF
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
echononl "Update repositories.."
apt-get update > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
echononl "Upgrade System.."
apt-get dist-upgrade > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
blank_line
# install nodejs
#
echononl "Trigger script to install the NodeSource Node.js 8.x LTS Carbon repo.."
echononl "Trigger command 'bbb-conf --setip $FQDN_HOSTNAME'"
echo_wait
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - > "$log_file" 2>&1
bbb-conf --setip $FQDN_HOSTNAME > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
echo_failed
error "$(cat "$log_file")"
else
echo_ok
echo_ok
echo -e "
\033[32m----------\033[m
\033[1mOutput from assigning a hostname 'bbb-conf --setip $FQDN_HOSTNAME' was:\033[m
$(cat "$log_file")
\033[32m----------\033[m
"
fi
echononl "Install nodejs.."
apt-get install -y nodejs > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
# apt-get key for BigBlueButton repository
#
echononl "Add apt key for BigBlueButton repository.."
wget https://ubuntu.bigbluebutton.org/repo/bigbluebutton.asc -O- 2> "$log_file" | sudo apt-key add - > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
# add the repository for BigBlueButton 2.2 packages
#
echononl "Add repository for BigBlueButton 2.2 packages.."
cat <<EOF > /etc/apt/sources.list.d/bigbluebutton.list 2> "$log_file"
deb https://ubuntu.bigbluebutton.org/${DIST_RELEASE}-220/ bigbluebutton-${DIST_RELEASE} main
EOF
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
echononl "Update repositories.."
apt-get update > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
blank_line
# Create 'override'-directory for service 'redis-server'
#
echononl "Create 'override'-directory for service 'redis-server'.."
if [[ -d "/etc/systemd/system/redis-server.service.d" ]] ; then
echo_skipped
else
mkdir /etc/systemd/system/redis-server.service.d
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
fi
echononl "Create 'override'-file for service 'redis-server'.."
cat <<EOF > /etc/systemd/system/redis-server.service.d/override.conf 2> "$log_file"
[Service]
PrivateDevices=no
EOF
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
clean_up 0