Files
zapret.installer/installer.sh

35 lines
984 B
Bash
Raw Normal View History

#!/bin/sh
2025-03-20 16:21:00 +03:00
set -e
if [ "$(id -u)" -eq 0 ]; then
SUDO=""
else
if command -v sudo &> /dev/null; then
SUDO="sudo"
elif command -v doas &> /dev/null; then
SUDO="doas"
else
echo "Скрипт не может быть выполнен не от суперпользователя."
exit 1
fi
fi
2025-03-20 15:58:49 +03:00
if [ ! -d "/opt/zapret.installer" ]; then
cd /opt || exit
$SUDO git clone https://github.com/Snowy-Fluffy/zapret.installer.git
2025-03-20 15:58:49 +03:00
else
cd "/opt/zapret.installer" || exit
if ! $SUDO git pull; then
2025-03-20 15:58:49 +03:00
echo "Ошибка при обновлении. Удаляю репозиторий и клонирую заново..."
cd /opt || exit
$SUDO rm -rf "/opt/zapret.installer"
$SUDO git clone https://github.com/Snowy-Fluffy/zapret.installer.git
cd "/opt/zapret.installer" || exit
2025-03-20 15:58:49 +03:00
fi
2025-03-20 04:05:10 +03:00
fi
2025-03-20 18:31:49 +03:00
$SUDO chmod +x /opt/zapret.installer/zapret-control.sh
bash /opt/zapret.installer/zapret-control.sh
2025-03-20 04:05:10 +03:00