diff options
author | Jesus Federico <jesus@123it.ca> | 2020-11-28 14:29:28 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-28 14:29:28 -0500 |
commit | fb3d5f871cdfd696ebd8cfa56ac10960f68a355a (patch) | |
tree | a0d65d26f1c29746fe6675cdfa1dbc91838e679c | |
parent | 9d1edbb39bb04715358e39df13f38b72b2a7f1d5 (diff) | |
download | scalelite-run-itzks-fb3d5f871cdfd696ebd8cfa56ac10960f68a355a.tar.gz scalelite-run-itzks-fb3d5f871cdfd696ebd8cfa56ac10960f68a355a.tar.bz2 scalelite-run-itzks-fb3d5f871cdfd696ebd8cfa56ac10960f68a355a.zip |
Completed script for initialising bigbluiebutton (#5)
* scalelite host can be set up with paramaters
* updated script for bbb
* updated script for bbb
* completed script for initializing bigbluebutton
-rwxr-xr-x | init-recordings-bigbluebutton.sh | 71 |
1 files changed, 47 insertions, 24 deletions
diff --git a/init-recordings-bigbluebutton.sh b/init-recordings-bigbluebutton.sh index 7313ed6..10efc58 100755 --- a/init-recordings-bigbluebutton.sh +++ b/init-recordings-bigbluebutton.sh @@ -12,11 +12,12 @@ EXAMPLES: Sample options for setup a BigBlueButton server -s scalelite.example.com HERE +exit 0 } main() { export DEBIAN_FRONTEND=noninteractive - while builtin getopts "s" opt "${@}"; do + while builtin getopts "s:" opt "${@}"; do case $opt in s) @@ -26,16 +27,40 @@ main() { fi ;; esac -done -if [ ! -z "$HOST" ]; then - check_host $HOST -fi + done + + if [ ! -z "$HOST" ]; then + check_host $HOST + else + usage + fi +} + +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 + fi +} + +err() { + echo "$1" >&2 + exit 1 +} + +main "$@" || exit 1 # We can proceed with the setup -echo 'Create a new group with GID 2000...' -groupadd -g 2000 scalelite-spool +if grep -q scalelite-spool /etc/group +then + echo "Group <scalelite-spool> exists" +else + echo "Group <scalelite-spool> does not exist. Create it with GID 2000..." + groupadd -g 2000 scalelite-spool +fi echo 'Add the bigbluebutton user to the group...' usermod -a -G scalelite-spool bigbluebutton @@ -46,24 +71,22 @@ wget -O post_publish_scalelite.rb https://raw.githubusercontent.com/blindsidenet echo 'Add recording transfer settings...' cd /usr/local/bigbluebutton/core/scripts wget https://raw.githubusercontent.com/blindsidenetworks/scalelite/master/bigbluebutton/scalelite.yml -echo "spool_dir: bigbluebutton@$URL_HOST:/var/bigbluebutton/spool" | tee -a /usr/local/bigbluebutton/core/scripts +echo "spool_dir: bigbluebutton@$HOST:/var/bigbluebutton/spool" | tee -a /usr/local/bigbluebutton/core/scripts/scalelite.yml echo 'Generate ssh key pair...' -mkdir /home/bigbluebutton -chown bigbluebutton.bigbluebutton /home/bigbluebutton/ +if [ -z "/home/bigbluebutton" ]; then + mkdir /home/bigbluebutton + chown bigbluebutton.bigbluebutton /home/bigbluebutton/ +fi su - bigbluebutton -s /bin/bash -c "ssh-keygen -t ed25519 -N '' -f ~/.ssh/id_rsa" -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 -} +public_key=$(cat my_file) +set +x +echo +echo +echo "Add this key to /home/bigbluebutton/.ssh/authorized_keys in scalelite:" +echo +echo "$public_key" +echo +echo +exit 0 |