Wire-Py/install

132 lines
5.2 KiB
Plaintext
Raw Normal View History

#!/bin/bash
NORMAL='\033[0m'
GREEN='\033[1;32m'
RED='\033[31;1;42m'
BLUE='\033[30;1;34m'
2024-09-17 20:59:18 +02:00
install_file_with(){
clear
sudo apt install python3-tk && \
sudo cp -u wg_main.py start_wg.py wg_func.py wirepy.py /usr/bin/ && \
sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/.keys && sudo cp -u settings theme /etc/wire_py/ && \
sudo cp -uR wp-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \
sudo chown -R root:root /etc/wire_py && sudo chmod 755 /etc/wire_py && \
sudo ln -sf /usr/bin/wirepy.py /usr/local/bin/wirepy && \
sudo cp -u org.wirepy.policy /usr/share/polkit-1/actions/ && \
sudo cp -u Wire-Py.desktop /usr/share/applications/ && \
sudo cp -u wg_start.service /lib/systemd/system/ && \
sudo systemctl enable wg_start.service
}
install_arch_d(){
clear
sudo pacman -S --noconfirm tk python3 python-requests && \
sudo cp -u wg_main.py start_wg.py wg_func.py wirepy.py /usr/bin/ && \
sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/.keys && sudo cp -u settings theme /etc/wire_py/ && \
sudo cp -uR wp-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \
sudo chown -R root:root /etc/wire_py && sudo chmod 755 /etc/wire_py && \
sudo ln -sf /usr/bin/wirepy.py /usr/local/bin/wirepy && \
sudo cp -u org.wirepy.policy /usr/share/polkit-1/actions/ && \
sudo cp -u Wire-Py.desktop /usr/share/applications/ && \
sudo cp -u wg_start.service /lib/systemd/system/ && \
sudo systemctl enable wg_start.service
}
if grep -i 'debian' /etc/os-release > /dev/null 2>&1
then
groups > /tmp/isgroup
if grep 'sudo' /tmp/isgroup
then
install_file_with
else
echo -e "$BLUE"The installer found that they are not in the group sudo.""
echo -e "with "$RED"su -"$BLUE" "they can enter the root shell in which they then""
echo -e "enter "$GREEN""usermod -aG sudo $USER.""$BLUE""
echo -e ""after logging in from the system, they can then run Wire-Py install again." $NORMAL"
read -n 1 -s -r -p $"To close the Window press a button"
clear
exit 0
fi
elif grep -i 'mint\|ubuntu\|pop|' /etc/os-release > /dev/null 2>&1
then
install_file_with
elif grep -i 'arch' /etc/os-release > /dev/null 2>&1
then
groups > /tmp/isgroup
clear
if grep 'wheel' /tmp/isgroup
then
install_arch_d
else
echo "The installer found that they are not in the group sudo."
echo "The sudoers file must be edited with"
echo -e "$RED""su -""$NORMAL"
echo -e "$GREEN"""EDITOR=nano visudo"""$NORMAL"
echo "Find the line:"
echo "## Uncomment to allow members of group wheel to execute any command"
echo "remove '#' on # %wheel ALL=(ALL) ALL and save the file"
echo -e "then enter "$GREEN"gpasswd -a $USER wheel.""$NORMAL"
echo "after logging in from the system, they can then run Wire-Py install again."
read -n 1 -s -r -p $"To close the Window press a button"
clear
exit 0
fi
elif grep -i '|manjaro\|garuda\|endeavour|' /etc/os-release > /dev/null 2>&1
then
install_arch_d
elif grep -i 'fedora' /etc/os-release > /dev/null 2>&1
then
if ! which python3-tkinter &> /dev/null
then sudo dnf install python3-tkinter -y
sudo cp -u wg_main.py start_wg.py wg_func.py wirepy.py /usr/bin/ && \
sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/.keys && \
sudo cp -u settings theme /etc/wire_py/ && \
sudo cp -uR wp-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \
sudo chown -R root:root /etc/wire_py && sudo chmod 755 /etc/wire_py && \
sudo ln -sf /usr/bin/wirepy.py /usr/local/bin/wirepy && \
sudo cp -u org.wirepy.policy /usr/share/polkit-1/actions/ && \
sudo cp -u Wire-Py.desktop /usr/share/applications/ && \
sudo cp -u wg_start.service /lib/systemd/system/ && \
sudo systemctl enable wg_start.service
fi
elif grep -i 'suse' /etc/os-release > /dev/null 2>&1
then
if ! which python311-tk &> /dev/null
then sudo zypper install python311-tk
sudo cp -u wg_main.py start_wg.py wg_func.py wirepy.py /usr/bin/ && \
sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/.keys && \
sudo cp -u settings theme /etc/wire_py/ && \
sudo cp -uR wp-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \
sudo chown -R root:root /etc/wire_py && sudo chmod 755 /etc/wire_py && \
sudo ln -sf /usr/bin/wirepy.py /usr/local/bin/wirepy && \
sudo cp -u org.wirepy.policy /usr/share/polkit-1/actions/ && \
sudo cp -u Wire-Py.desktop /usr/share/applications/ && \
sudo cp -u wg_start.service /lib/systemd/system/ && \
sudo systemctl enable wg_start.service
fi
else
clear
echo $"Your System could not be determined."
echo
read -n 1 -s -r -p $"To close the window press a button"
clear
exit 0
fi
clear
read -n 1 -s -r -p $"To close the Window press a button"
clear