# This script is called directly after the installation of the .deb package # It is used to setup the django application and the caddy server sudo mkdir -p /var/www/libre-workspace-static/ sudo chmod -R 777 /var/www/libre-workspace-static/ # Execute the migration script to migrate the old folder structure to the new one sudo bash /usr/lib/libre-workspace/portal/unix/unix_scripts/migrate_to_new_folderstructure_2025.sh # If the /etc/libre-workspace/portal/portal.conf file does not exist, then copy the example file if [ ! -f /etc/libre-workspace/portal/portal.conf ]; then sudo cp /etc/libre-workspace/portal/portal.conf.example /etc/libre-workspace/portal/portal.conf fi mkdir -p /var/lib/libre-workspace/portal/ cd /var/lib/libre-workspace/portal/ python3 -m venv venv cd - if [ ! -f /usr/bin/python ]; then sudo ln -s /usr/bin/python3 /usr/bin/python fi mkdir -p /var/lib/libre-workspace/modules/ source /var/lib/libre-workspace/portal/venv/bin/activate pip install --upgrade pip pip install -r /usr/lib/libre-workspace/portal/requirements.txt # Make sure that the database is up to date (sometimes e.g. oidc_provider needs to be updated) cd /usr/lib/libre-workspace/portal/ python3 manage.py makemigrations --no-input python manage.py migrate --no-input # Get the current IP-Adress IP=`hostname -I | cut -d' ' -f1` # If caddy file does not has # PORTAL-ENTRY, then add it if ! grep -q "# PORTAL-ENTRY" /etc/caddy/Caddyfile; then ...caddy setup... fi # Setup apt repository if not already done if [ -f /etc/apt/sources.list.d/libre-workspace-stable.list ] || ... ...repo setup... fi systemctl daemon-reload # Generate a unique SECRET_KEY if still using the insecure default if grep -q "django-insecure" /usr/lib/libre-workspace/portal/lac/settings.py; then SECRET_KEY=$(libre-workspace-generate-secret 50) sed -i "s/SECRET_KEY = '.*'/SECRET_KEY = '$SECRET_KEY'/" /usr/lib/libre-workspace/portal/lac/settings.py fi # Disable Django admin panel sed -i "s/ADMIN_ENABLED = True/ADMIN_ENABLED = False/" /usr/lib/libre-workspace/portal/lac/settings.py systemctl restart libre-workspace-portal