bigbluebutton-Github/build/packages-template/bbb-etherpad/before-install.sh
2021-08-13 12:53:18 +02:00

26 lines
1.0 KiB
Bash
Executable File

#!/bin/bash -e
addGroup etherpad ""
addUser etherpad "" etherpad /usr/share/etherpad-lite "etherpad user-daemon" "/bin/false"
if [ ! -f /usr/share/etherpad-lite/APIKEY.txt ]; then
mkdir -p /usr/share/etherpad-lite
openssl rand -base64 64 | head -n 1 | sed 's/=//g' | sed 's/+//g' | sed 's/\///g' | tr -d '\n' > /usr/share/etherpad-lite/APIKEY.txt
chown etherpad:etherpad /usr/share/etherpad-lite/
chown etherpad:etherpad /usr/share/etherpad-lite/APIKEY.txt
chmod 644 /usr/share/etherpad-lite/APIKEY.txt
fi
if [ -d /usr/share/etherpad-lite/node_modules ]; then
rm -r /usr/share/etherpad-lite/node_modules
fi
# Clean out old pads before upgrade
redis-cli keys pad:* | xargs -r redis-cli del
redis-cli keys sessionstorage:* | xargs -r redis-cli del
redis-cli keys globalAuthor:* | xargs -r redis-cli del
redis-cli keys token2author:* | xargs -r redis-cli del
redis-cli keys pad2readonly:* | xargs -r redis-cli del
redis-cli keys readonly2pad:* | xargs -r redis-cli del
redis-cli keys ueberDB:* | xargs -r redis-cli del