2020-07-03 03:01:37 +08:00
|
|
|
#!/bin/bash
|
|
|
|
if [ "$EUID" -ne 0 ]; then
|
|
|
|
echo "Please run this script as root ( or with sudo )" ;
|
|
|
|
exit 1;
|
|
|
|
fi;
|
|
|
|
|
2021-03-30 23:24:49 +08:00
|
|
|
cd "$(dirname "$0")"
|
|
|
|
|
2020-07-03 03:01:37 +08:00
|
|
|
DOCKER_CHECK=`docker --version &> /dev/null && echo 1 || echo 0`
|
|
|
|
|
|
|
|
if [ "$DOCKER_CHECK" = "0" ]; then
|
|
|
|
echo "Docker not found";
|
|
|
|
apt update;
|
|
|
|
apt install apt-transport-https ca-certificates curl software-properties-common
|
|
|
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
|
2022-03-15 03:04:23 +08:00
|
|
|
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
|
2020-07-03 03:01:37 +08:00
|
|
|
apt update
|
|
|
|
apt install docker-ce -y
|
|
|
|
systemctl enable docker
|
|
|
|
systemctl start docker
|
|
|
|
systemctl status docker
|
|
|
|
else
|
|
|
|
echo "Docker already installed";
|
|
|
|
fi
|
|
|
|
|
2021-03-23 21:59:27 +08:00
|
|
|
IMAGE_CHECK=`docker image inspect bbb-soffice &> /dev/null && echo 1 || echo 0`
|
2020-07-03 03:01:37 +08:00
|
|
|
if [ "$IMAGE_CHECK" = "0" ]; then
|
|
|
|
echo "Docker image doesn't exists, building"
|
2021-03-23 21:59:27 +08:00
|
|
|
docker build -t bbb-soffice docker/
|
2020-07-03 03:01:37 +08:00
|
|
|
else
|
|
|
|
echo "Docker image already exists";
|
|
|
|
fi
|
|
|
|
|
2021-03-23 21:59:27 +08:00
|
|
|
FOLDER_CHECK=`[ -d /usr/share/bbb-libreoffice-conversion/ ] && echo 1 || echo 0`
|
2020-07-03 03:01:37 +08:00
|
|
|
if [ "$FOLDER_CHECK" = "0" ]; then
|
|
|
|
echo "Install folder doesn't exists, installing"
|
2023-09-12 21:41:55 +08:00
|
|
|
install -Dm755 assets/convert-local.sh /usr/share/bbb-libreoffice-conversion/convert.sh
|
|
|
|
install -Dm755 assets/convert-cool.sh /usr/share/bbb-libreoffice-conversion/convert-cool.sh
|
|
|
|
install -Dm755 assets/etherpad-export.sh /usr/share/bbb-libreoffice-conversion/etherpad-export.sh
|
2021-03-23 21:59:27 +08:00
|
|
|
chown -R root /usr/share/bbb-libreoffice-conversion/
|
2020-07-03 03:01:37 +08:00
|
|
|
else
|
|
|
|
echo "Install folder already exists"
|
|
|
|
fi;
|
|
|
|
|
2021-03-23 21:59:27 +08:00
|
|
|
FILE_SUDOERS_CHECK=`[ -f /etc/sudoers.d/zzz-bbb-docker-libreoffice ] && echo 1 || echo 0`
|
|
|
|
if [ "$FILE_SUDOERS_CHECK" = "0" ]; then
|
|
|
|
echo "Sudoers file doesn't exists, installing"
|
|
|
|
cp assets/zzz-bbb-docker-libreoffice /etc/sudoers.d/zzz-bbb-docker-libreoffice
|
2021-09-09 00:52:08 +08:00
|
|
|
chmod 0440 /etc/sudoers.d/zzz-bbb-docker-libreoffice
|
2021-12-06 19:47:25 +08:00
|
|
|
chown root:root /etc/sudoers.d/zzz-bbb-docker-libreoffice
|
2021-03-23 21:59:27 +08:00
|
|
|
else
|
|
|
|
echo "Sudoers file already exists"
|
|
|
|
fi;
|
|
|
|
|
2021-04-30 04:39:27 +08:00
|
|
|
aptInstalledList=$(apt list --installed 2>&1)
|
|
|
|
fontInstalled=0
|
|
|
|
|
|
|
|
for font in fonts-arkpandora fonts-crosextra-carlito fonts-crosextra-caladea fonts-noto fonts-noto-cjk fonts-liberation fonts-arkpandora
|
|
|
|
do
|
|
|
|
if [[ $(echo $aptInstalledList | grep $font | wc -l) = "0" ]]; then
|
|
|
|
echo "Font $font doesn't exists, installing"
|
|
|
|
apt-get install -y --no-install-recommends $font
|
|
|
|
fontInstalled=1
|
|
|
|
else
|
|
|
|
echo "Font $font already installed"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ $fontInstalled = "1" ]; then
|
|
|
|
dpkg-reconfigure fontconfig && fc-cache -f -s -v
|
|
|
|
fi
|