TG-Avatar-Alteration/SOURCES/tg-avatar-alteration
2021-03-02 12:52:21 +03:00

34 lines
1.2 KiB
Bash

#!/bin/bash
#
# tg-avatar-alteration is a service that automatically changes
# your telegram avatar during the day
# Copyright (C) 2021 GenZmeY
# mailto: genzmey@gmail.com
#
# tg-avatar-alteration is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
TgAaUser="tg-aa-user"
Conf="/etc/tg-avatar-alteration/config.py"
App="/usr/share/tg-avatar-alteration/main.py"
Cache="/var/cache/tg-avatar-alteration"
if [[ $(whoami) == "$TgAaUser" ]]; then
/usr/bin/python3 "$App" "$Conf" "$Cache"
elif [[ -n $(groups "${USER}" | grep -Fo 'wheel') ]] || [[ "${EUID}" -eq 0 ]]; then
sudo -u "${TgAaUser}" -s -- /usr/bin/tg-avatar-alteration
else
echo "You must be ${TgAaUser}, root or sudo-user to run this command"
fi