gonets/debian/postinst
2025-06-09 14:43:25 +05:00

72 lines
No EOL
2.1 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
set -e
pip3 install \
pydbus==0.6.0 \
fastapi[standard]==0.115.11 \
pydantic==2.10.3 \
sdbus-networkmanager==2.0.0 \
uvicorn==0.32.1 \
websockets==14.1 \
uuid==1.30 \
scapy==2.6.1 \
netifaces==0.11.0 \
netaddr==1.3.0 \
dbus-python==1.3.2 \
python-pam==2.0.2 \
six==1.17.0 \
python-jose[cryptography]==3.4.0 \
storage==0.0.4.3 \
passlib[bcrypt]==1.7.4 \
python-multipart==0.0.20 \
bcrypt==4.3.0 \
--break-system-packages || {
echo "Ошибка: Не удалось установить Python-зависимости" >&2
exit 1
}
mkdir -p /etc/gonets/certs
openssl genrsa -out /etc/gonets/certs/gonets.key 2048
openssl req -new -key /etc/gonets/certs/gonets.key -out /etc/gonets/certs/gonets.csr -subj "/"
openssl x509 -req -days 365 -in /etc/gonets/certs/gonets.csr -signkey /etc/gonets/certs/gonets.key -out /etc/gonets/certs/gonets.crt
chmod 600 /etc/gonets/certs/gonets.key
chmod 644 /etc/gonets/certs/gonets.crt
if [ -d /usr/share/gonets/SRV ]; then
cd /usr/share/gonets/SRV
python3 config/init_config.py
else
echo "Ошибка: Директория /usr/share/gonets/SRV не существует" >&2
exit 1
fi
if [ -f /usr/share/gonets/FRONT/BUILD/chrome-sandbox ]; then
chown root /usr/share/gonets/FRONT/BUILD/chrome-sandbox
chmod 4755 /usr/share/gonets/FRONT/BUILD/chrome-sandbox
else
echo "Ошибка: Файл /usr/share/gonets/FRONT/BUILD/chrome-sandbox не существует" >&2
exit 1
fi
if [ -f /usr/share/gonets/FRONT/BUILD/gonets ]; then
chmod +x /usr/share/gonets/FRONT/BUILD/gonets
else
echo "Ошибка: Файл /usr/share/gonets/FRONT/BUILD/gonets не существует" >&2
exit 1
fi
if [ -f /usr/share/applications/gonets.desktop ]; then
chmod +x /usr/share/applications/gonets.desktop
else
echo "Ошибка: Файл /usr/share/applications/gonets.desktop не существует" >&2
exit 1
fi
systemctl daemon-reload
systemctl enable gonets.service
systemctl restart gonets.service
systemctl start gonets.service
exit 0