#!/bin/sh if [ -f .env ]; then . ./.env else . ./.env.example fi echo 'Stopping LibreTranslate...' systemctl stop libretranslate echo 'Updating the LibreTranslate systemd service according to the .env file...' sed -e "{s|\$LT_DIR|$LT_DIR|;s|\$LT_USER|$LT_USER|}" libretranslate.service.example > libretranslate.service cp -v libretranslate.service /etc/systemd/system/ echo 'Updating the nginx site according to the .env file...' sed -e "{s|\$LT_DIR|$LT_DIR|;s|\$LT_DOMAIN|$LT_DOMAIN|}" nginx.example > nginx cp -v nginx /etc/nginx/sites-available/libretranslate cp $PWD/.env $LT_DIR/.env && chown -R $LT_USER $LT_DIR echo 'Updating LibreTranslate...' su -ls /bin/sh $LT_USER <