From 9d1edbb39bb04715358e39df13f38b72b2a7f1d5 Mon Sep 17 00:00:00 2001 From: jfederico Date: Sat, 28 Nov 2020 12:41:45 -0500 Subject: scalelite host can be set up with paramaters --- init-recordings-bigbluebutton.sh | 48 +++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 6 deletions(-) (limited to 'init-recordings-bigbluebutton.sh') diff --git a/init-recordings-bigbluebutton.sh b/init-recordings-bigbluebutton.sh index 58a0381..7313ed6 100755 --- a/init-recordings-bigbluebutton.sh +++ b/init-recordings-bigbluebutton.sh @@ -1,13 +1,39 @@ -#!/bin/bash +#!/bin/bash -ex -if [[ ! -f ./.env ]]; then - echo ".env file does not exist on your filesystem." - exit 1 +usage() { + set +x + cat 1>&2 < Configure server with (required) +EXAMPLES: +Sample options for setup a BigBlueButton server + -s scalelite.example.com +HERE +} + +main() { + export DEBIAN_FRONTEND=noninteractive + while builtin getopts "s" opt "${@}"; do + + case $opt in + s) + HOST=$OPTARG + if [ "$HOST" == "scalelite.example.com" ]; then + err "You must specify a valid hostname (not the hostname given in the docs)." + fi + ;; + esac +done + +if [ ! -z "$HOST" ]; then + check_host $HOST fi -URL_HOST=$(grep URL_HOST .env | cut -d '=' -f2) -echo $URL_HOST +# We can proceed with the setup echo 'Create a new group with GID 2000...' groupadd -g 2000 scalelite-spool echo 'Add the bigbluebutton user to the group...' @@ -31,3 +57,13 @@ echo 'Add this key to /home/bigbluebutton/.ssh/authorized_keys in scalelite:' cat /home/bigbluebutton/.ssh/scalelite.pub echo 'done' + +check_host() { + if [ [ -z "$HOST" ] then + need_pkg dnsutils apt-transport-https net-tools + DIG_IP=$(dig +short $1 | grep '^[.0-9]*$' | tail -n1) + if [ -z "$DIG_IP" ]; then err "Unable to resolve $1 to an IP address using DNS lookup."; fi + get_IP $1 + if [ "$DIG_IP" != "$IP" ]; then err "DNS lookup for $1 resolved to $DIG_IP but didn't match local $IP."; fi + fi +} -- cgit v1.2.3