summaryrefslogtreecommitdiff
path: root/init-recordings-scalelite.sh
blob: 2613c5c74f8cd519731270dcb0851b1595672c3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash

source ./.env
SCALELITE_RECORDING_DIR=${SCALELITE_RECORDING_DIR-/mnt/scalelite-recordings/var/bigbluebutton}

echo 'Add the bigbluebutton user...'
id -u bigbluebutton &>/dev/null || useradd -m -d /home/bigbluebutton -s /bin/bash bigbluebutton
if [ ! -d "/home/bigbluebutton/.ssh" ]; then
  su - bigbluebutton -s /bin/bash -c 'mkdir ~/.ssh && touch ~/.ssh/authorized_keys'
fi

echo 'Create a new group with GID 2000...'
if grep -q scalelite-spool /etc/group; then
  echo "group scalelite-spool exists"
else
  echo "group scalelite-spool created"
  groupadd -g 2000 scalelite-spool
fi

echo 'Add the bigbluebutton user to the group...'
usermod -a -G scalelite-spool bigbluebutton

echo 'Create the directory structure for recording ...'
mkdir -p $SCALELITE_RECORDING_DIR/spool
mkdir -p $SCALELITE_RECORDING_DIR/recording/scalelite
mkdir -p $SCALELITE_RECORDING_DIR/published
mkdir -p $SCALELITE_RECORDING_DIR/unpublished
chown -R 1000:2000 $SCALELITE_RECORDING_DIR
chmod -R 0775 $SCALELITE_RECORDING_DIR

echo 'Create symbolic link to the directory structure for uploading ...'
if [ -d "/var/bigbluebutton" ]; then
  mv /var/bigbluebutton /var/.bigbluebutton
elif [ -e "/var/bigbluebutton" ]; then
  rm /var/bigbluebutton
fi
ln -s $SCALELITE_RECORDING_DIR /var/bigbluebutton