1
0
Fork 0

Update tools venv after git pull

This commit is contained in:
Félix Piédallu 2024-08-30 13:49:39 +02:00 committed by Salamandar
parent 6024c06a4a
commit b42702dd1f

View file

@ -3,6 +3,13 @@
workdir=$(realpath $(dirname "$0")) workdir=$(realpath $(dirname "$0"))
cd $workdir cd $workdir
function update_venv()
{
if [ -d "venv" ]; then
venv/bin/pip install -r requirements.txt
fi
}
function git_pull_and_update_cron_and_restart_services_if_needed() function git_pull_and_update_cron_and_restart_services_if_needed()
{ {
git pull &>/dev/null git pull &>/dev/null
@ -16,6 +23,8 @@ function git_pull_and_update_cron_and_restart_services_if_needed()
modified_after_service_start="$(find *.py translations/ templates/ assets/ -newermt "$(systemctl show --property=ActiveEnterTimestamp appstore | cut -d= -f2 | cut -d' ' -f2-3)")" modified_after_service_start="$(find *.py translations/ templates/ assets/ -newermt "$(systemctl show --property=ActiveEnterTimestamp appstore | cut -d= -f2 | cut -d' ' -f2-3)")"
if [ -n "$modified_after_service_start" ] if [ -n "$modified_after_service_start" ]
then then
update_venv
pushd assets >/dev/null pushd assets >/dev/null
./tailwindcss-linux-x64 --input tailwind-local.css --output tailwind.css --minify ./tailwindcss-linux-x64 --input tailwind-local.css --output tailwind.css --minify
popd >/dev/null popd >/dev/null
@ -32,6 +41,7 @@ function git_pull_and_update_cron_and_restart_services_if_needed()
modified_after_service_start="$(find *.py translations/ templates/ static/ -newermt "$(systemctl show --property=ActiveEnterTimestamp appgenerator | cut -d= -f2 | cut -d' ' -f2-3)")" modified_after_service_start="$(find *.py translations/ templates/ static/ -newermt "$(systemctl show --property=ActiveEnterTimestamp appgenerator | cut -d= -f2 | cut -d' ' -f2-3)")"
if [ -n "$modified_after_service_start" ] if [ -n "$modified_after_service_start" ]
then then
update_venv
pushd assets >/dev/null pushd assets >/dev/null
./tailwindcss-linux-x64 --input tailwind-local.css --output tailwind.css --minify ./tailwindcss-linux-x64 --input tailwind-local.css --output tailwind.css --minify
popd >/dev/null popd >/dev/null
@ -47,6 +57,7 @@ function git_pull_and_update_cron_and_restart_services_if_needed()
modified_after_service_start="$(find *.py translations/ templates/ -newermt "$(systemctl show --property=ActiveEnterTimestamp webhooks | cut -d= -f2 | cut -d' ' -f2-3)")" modified_after_service_start="$(find *.py translations/ templates/ -newermt "$(systemctl show --property=ActiveEnterTimestamp webhooks | cut -d= -f2 | cut -d' ' -f2-3)")"
if [ -n "$modified_after_service_start" ] if [ -n "$modified_after_service_start" ]
then then
update_venv
systemctl restart webhooks systemctl restart webhooks
sleep 3 sleep 3
fi fi
@ -57,11 +68,16 @@ function git_pull_and_update_cron_and_restart_services_if_needed()
modified_after_service_start="$(find *.py -newermt "$(systemctl show --property=ActiveEnterTimestamp webhooks | cut -d= -f2 | cut -d' ' -f2-3)")" modified_after_service_start="$(find *.py -newermt "$(systemctl show --property=ActiveEnterTimestamp webhooks | cut -d= -f2 | cut -d' ' -f2-3)")"
if [ -n "$modified_after_service_start" ] if [ -n "$modified_after_service_start" ]
then then
update_venv
systemctl restart webhooks systemctl restart webhooks
sleep 3 sleep 3
fi fi
popd >/dev/null popd >/dev/null
pushd tools/autoupdate_app_sources >/dev/null
update_venv
popd >/dev/null
systemctl --quiet is-active webhooks || sendxmpppy "[autoreadme] Uhoh, failed to (re)start the autoreadme service?" systemctl --quiet is-active webhooks || sendxmpppy "[autoreadme] Uhoh, failed to (re)start the autoreadme service?"
} }