PortProton_2.0/portproton
2025-03-05 17:08:59 +03:00

24 lines
952 B
Bash
Executable File
Raw Permalink 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.

#!/usr/bin/env bash
##### CHECK ROOT #####
if [[ $(id -u) -eq 0 ]] ; then
echo "Перезапустите $0 от обычного пользователя!"
exit 1
fi
##### DEFAULT VARIABLES #####
SCRIPT_NAME="$(basename "$0")"
if [[ "$(realpath "$0")" == "/usr/bin/$SCRIPT_NAME" ]] ; then
USER_WORK_PATH="$HOME/.local/share/$SCRIPT_NAME"
# чуть позже определимся с PYTHON_WORK_PATH, в зависимости от варианта обновления PP
PYTHON_WORK_PATH=
else
# для теста создаем и используем каталог test-portproton для исключения взаимодействия с текущей версией
USER_WORK_PATH="$HOME/test-$SCRIPT_NAME"
# используем всё из репозитория
PYTHON_WORK_PATH="$(dirname "$(realpath "$0")")"
fi
export USER_WORK_PATH PYTHON_WORK_PATH
"$PYTHON_WORK_PATH/$SCRIPT_NAME.py" "$@"