Installers will support other systems again

Installer is now finished clean with wrong password
Rename wg_main to wirepy
This commit is contained in:
Désiré Werner Menrath 2025-04-07 12:46:45 +02:00
parent 13832d916f
commit 5302aae807
5 changed files with 149 additions and 123 deletions

View File

@ -8,6 +8,15 @@ My standard System: Linux Mint 22 Cinnamon
- for loops with lists replaced by List Comprehensions
- Crypt and Decrypt Config Files in ~/.config/wire_py
### Added
07-04-0725
- Installers will support other systems again
- Installer is now finished clean with wrong password
- Rename wg_main to wirepy
### Added
03-03-2025

View File

@ -1,7 +1,7 @@
[Desktop Entry]
Type=Application
Name=Wire-Py
Exec=/usr/local/bin/wg_main.py
Exec=/usr/local/bin/wirepy.py
Terminal=false
Categories=Network;
Icon=/usr/share/icons/wp-icons/128/wg_vpn.png

View File

@ -1,4 +1,4 @@
""" Classes Method and functions for lx apps """
''' Classes Method and functions for lx apps '''
import gettext
import locale
@ -15,7 +15,7 @@ import requests
APP = 'wirepy'
LOCALE_DIR = "/usr/share/locale/"
LOCALE_DIR = '/usr/share/locale/'
locale.bindtextdomain(APP, LOCALE_DIR)
gettext.bindtextdomain(APP, LOCALE_DIR)
gettext.textdomain(APP)
@ -110,7 +110,7 @@ class UOS:
def username():
logname = str(Path.home())[6:]
file = Path.home() / '/tmp/.loguser'
with open(file, "w") as f:
with open(file, 'w') as f:
f.write(logname)

100
install
View File

@ -9,29 +9,41 @@ install_file_with(){
mkdir -p ~/.config/wire_py && touch ~/.config/wire_py/keys && cp -u settings ~/.config/wire_py/ && \
mkdir -p ~/.config/systemd/user && cp -u wg_start.service ~/.config/systemd/user/ && \
systemctl --user enable wg_start.service
sudo cp -f org.sslcrypt.policy /usr/share/polkit-1/actions/ && \
sudo cp -f org.sslcrypt.policy /usr/share/polkit-1/actions/
if [ $? -ne 0 ]
then
systemctl --user disable wg_start.service
rm -r ~/.config/wire_py && rm -r ~/.config/systemd
exit 0
else
sudo apt install python3-tk && \
sudo cp -fv wg_main.py start_wg.py cls_mth_fc.py ssl_encrypt.py ssl_decrypt.py /usr/local/bin/ && \
sudo cp -fv wirepy.py start_wg.py cls_mth_fc.py ssl_encrypt.py ssl_decrypt.py /usr/local/bin/ && \
sudo cp -uR wp-icons lx-icons /usr/share/icons/ && sudo cp -uR TK-Themes /usr/share/ && \
sudo cp -u languages/de/*.mo /usr/share/locale/de/LC_MESSAGES/ && \
sudo ln -sf /usr/local/bin/wg_main.py /usr/local/bin/wirepy && \
sudo cp -f Wire-Py.desktop /usr/share/applications/
fi
}
install_arch_d(){
clear
mkdir -p ~/.config/wire_py && touch ~/.config/wire_py/keys && cp -u settings ~/.config/wire_py/ && \
mkdir -p ~/.config/systemd/user && cp -u wg_start.service ~/.config/systemd/user/ && \
systemctl --user enable wg_start.service
sudo cp -f org.sslcrypt.policy /usr/share/polkit-1/actions/
if [ $? -ne 0 ]
then
systemctl --user disable wg_start.service
rm -r ~/.config/wire_py && rm -r ~/.config/systemd
exit 0
else
sudo pacman -S --noconfirm tk python3 python-requests && \
sudo cp -u wg_main.py start_wg.py cls_mth_fc.py && \
sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/keys && sudo cp -u settings /etc/wire_py/ && \
sudo cp -fv wirepy.py start_wg.py cls_mth_fc.py ssl_encrypt.py ssl_decrypt.py /usr/local/bin/ && \
sudo cp -uR wp-icons lx-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 cp -u languages/de/*.mo /usr/share/locale/de/LC_MESSAGES/ && \
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 org.sslcrypt.policy /usr/share/polkit-1/actions/ && \
sudo cp -u wg_start.service /lib/systemd/system/ && \
sudo systemctl enable wg_start.service
sudo cp -f Wire-Py.desktop /usr/share/applications/
fi
}
if grep -i 'debian' /etc/os-release > /dev/null 2>&1
@ -40,9 +52,7 @@ if grep -i 'debian' /etc/os-release > /dev/null 2>&1
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""
@ -50,14 +60,13 @@ if grep -i 'debian' /etc/os-release > /dev/null 2>&1
read -n 1 -s -r -p $"To close the Window press a button"
clear
exit 0
fi
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
@ -85,41 +94,47 @@ 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 cls_mth_fc.py && \
sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/keys && \
sudo cp -u settings /etc/wire_py/ && \
sudo cp -u languages/de/*.mo /usr/share/locale/de/LC_MESSAGES/ && \
clear
mkdir -p ~/.config/wire_py && touch ~/.config/wire_py/keys && cp -u settings ~/.config/wire_py/ && \
mkdir -p ~/.config/systemd/user && cp -u wg_start.service ~/.config/systemd/user/ && \
systemctl --user enable wg_start.service
sudo cp -f org.sslcrypt.policy /usr/share/polkit-1/actions/
if [ $? -ne 0 ]
then
systemctl --user disable wg_start.service
rm -r ~/.config/wire_py && rm -r ~/.config/systemd
exit 0
else
sudo dnf install python3-tkinter -y
sudo cp -fv wirepy.py start_wg.py cls_mth_fc.py ssl_encrypt.py ssl_decrypt.py /usr/local/bin/ && \
sudo cp -uR wp-icons lx-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
sudo cp -u languages/de/*.mo /usr/share/locale/de/LC_MESSAGES/ && \
sudo cp -f Wire-Py.desktop /usr/share/applications/
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 cls_mth_fc.py && \
sudo mkdir -p /etc/wire_py && sudo touch /etc/wire_py/keys && \
sudo cp -u settings /etc/wire_py/ && \
sudo cp -u languages/de/*.mo /usr/share/locale/de/LC_MESSAGES/ && \
clear
mkdir -p ~/.config/wire_py && touch ~/.config/wire_py/keys && cp -u settings ~/.config/wire_py/ && \
mkdir -p ~/.config/systemd/user && cp -u wg_start.service ~/.config/systemd/user/ && \
systemctl --user enable wg_start.service
sudo cp -f org.sslcrypt.policy /usr/share/polkit-1/actions/
if [ $? -ne 0 ]
then
systemctl --user disable wg_start.service
rm -r ~/.config/wire_py && rm -r ~/.config/systemd
exit 0
else
sudo zypper install python311-tk && \
sudo cp -fv wirepy.py start_wg.py cls_mth_fc.py ssl_encrypt.py ssl_decrypt.py /usr/local/bin/ && \
sudo cp -uR wp-icons lx-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
sudo cp -u languages/de/*.mo /usr/share/locale/de/LC_MESSAGES/ && \
sudo cp -f Wire-Py.desktop /usr/share/applications/
fi
else
clear
echo $"Your System could not be determined."
@ -127,6 +142,7 @@ else
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"

View File

@ -25,13 +25,13 @@ wg_tips = Tipi.if_tip(wg_set)
dirname = Path('/tmp/tlecdcwg/')
''' 1 = 1. Year, 09 = Month of the Year, 2924 = Day and Year of the Year '''
version = 'v. 2.03.0325'
version = 'v. 2.04.0725'
res = GiteaUpdate.api_down('https://git.ilunix.de/api/v1/repos/punix/Wire-Py/releases', version)
''' Translate '''
APP = 'wirepy'
LOCALE_DIR = "/usr/share/locale/"
LOCALE_DIR = '/usr/share/locale/'
locale.bindtextdomain(APP, LOCALE_DIR)
gettext.bindtextdomain(APP, LOCALE_DIR)
gettext.textdomain(APP)
@ -62,7 +62,8 @@ def signalHandler(signum, frame):
signal.signal(signal.SIGINT, signalHandler)
signal.signal(signal.SIGTERM, signalHandler)
signal.signal(signal.SIGHUP, signalHandler)
class MainWindow(tk.Tk):
class Wirepy(tk.Tk):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@ -153,7 +154,7 @@ class FrameWidgets(ttk.Frame):
''' Set dark or light '''
def theme_change_light():
if self.tk.call("ttk::style", "theme", "use") == "water-dark":
if self.tk.call('ttk::style', 'theme', 'use') == 'water-dark':
''' Set light theme '''
self.tk.call('set_theme', 'light')
with open(wg_set, 'r') as theme_set2:
@ -164,7 +165,7 @@ class FrameWidgets(ttk.Frame):
self.color_label()
def theme_change_dark():
if not self.tk.call("ttk::style", "theme", "use") == "water-dark":
if not self.tk.call('ttk::style', 'theme', 'use') == 'water-dark':
''' Set dark theme '''
self.tk.call('set_theme', 'dark')
with open(wg_set, 'r') as theme_set2:
@ -178,7 +179,7 @@ class FrameWidgets(ttk.Frame):
def link_btn():
webbrowser.open('https://git.ilunix.de/punix/Wire-Py')
"""img_w, img_i, w_title, w_txt , txt2, com hand over"""
''' img_w, img_i, w_title, w_txt , txt2, com hand over '''
iw = r'/usr/share/icons/wp-icons/48/wg_vpn.png'
ii = r'/usr/share/icons/wp-icons/48/wg_msg.png'
wt = _('Info')
@ -202,11 +203,11 @@ class FrameWidgets(ttk.Frame):
self.version_lb.grid(column=0, row=0, rowspan=4, padx=10)
def version_enter(event):
""" The mouse moves into the Version widget """
''' The mouse moves into the Version widget '''
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, f'Version: {version[2:]}')
def version_leave(_):
""" The mouse moves from the entry widget """
''' The mouse moves from the entry widget '''
''' Remove Tool-Tip '''
window.my_tool_tip.destroy()
@ -214,11 +215,11 @@ class FrameWidgets(ttk.Frame):
self.options_btn.grid(column=1, columnspan=1, row=0)
def sets_enter(event):
""" The mouse moves into the entry widget """
''' The mouse moves into the entry widget '''
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, _('Click for Settings'))
def sets_leave(_):
""" The mouse moves from the entry widget """
''' The mouse moves from the entry widget '''
''' Remove Tool-Tip '''
window.my_tool_tip.destroy()
@ -256,11 +257,11 @@ class FrameWidgets(ttk.Frame):
self.updates_lb.configure(text=_('Update search off'))
def disable_enter(event):
""" The mouse moves into the entry widget """
''' The mouse moves into the entry widget '''
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, _('Updates you have disabled'))
def disable_leave(_):
""" The mouse moves from the entry widget """
''' The mouse moves from the entry widget '''
''' Remove Tool-Tip '''
window.my_tool_tip.destroy()
@ -272,11 +273,11 @@ class FrameWidgets(ttk.Frame):
self.updates_lb.configure(text=_('No Updates'))
def congratulations_enter(event):
""" The mouse moves into the entry widget """
''' The mouse moves into the entry widget '''
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, _('Congratulations! Wire-Py is up to date'))
def congratulations_leave(_):
""" The mouse moves from the entry widget """
''' The mouse moves into the entry widget '''
''' Remove Tool-Tip '''
window.my_tool_tip.destroy()
@ -291,11 +292,11 @@ class FrameWidgets(ttk.Frame):
self.update_btn.grid(column=4, columnspan=3, row=0, padx=0)
def download_enter(event):
""" The mouse moves into the entry widget """
''' The mouse moves into the entry widget '''
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, _('Click to download new version'))
def download_leave(_):
""" The mouse moves from the entry widget """
''' The mouse moves into the entry widget '''
''' Remove Tool-Tip '''
window.my_tool_tip.destroy()
@ -393,7 +394,7 @@ class FrameWidgets(ttk.Frame):
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, _('You must first import\na Wireguard tunnel'))
def list_empty_leave(_):
""" The mouse moves from the entry widget """
''' The mouse moves into the entry widget '''
''' Remove Tool-Tip '''
window.my_tool_tip.destroy()
@ -402,7 +403,7 @@ class FrameWidgets(ttk.Frame):
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, _('Select a Tunnel'))
def list_not_empty_leave(_):
""" The mouse moves from the entry widget """
''' The mouse moves into the entry widget '''
''' Remove Tool-Tip '''
window.my_tool_tip.destroy()
@ -442,7 +443,7 @@ class FrameWidgets(ttk.Frame):
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, _('Click to import a Wireguard Tunnel'))
def imp_leave(_):
""" The mouse moves from the entry widget """
''' The mouse moves into the entry widget '''
''' Remove Tool-Tip '''
window.my_tool_tip.destroy()
@ -488,7 +489,7 @@ class FrameWidgets(ttk.Frame):
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, _('No tunnels to start in the list'))
def empty_list_start_leave(_):
""" The mouse moves from the entry widget """
''' The mouse moves into the entry widget '''
''' Remove Tool-Tip '''
window.my_tool_tip.destroy()
@ -550,7 +551,7 @@ class FrameWidgets(ttk.Frame):
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, _('No tunnels to delete in the list'))
def empty_list_leave(_):
""" The mouse moves from the entry widget """
''' The mouse moves into the entry widget '''
''' Remove Tool-Tip '''
window.my_tool_tip.destroy()
@ -560,7 +561,7 @@ class FrameWidgets(ttk.Frame):
_('Click to delete a Wireguard Tunnel\nSelect from the list!'))
def del_leave(_):
""" The mouse moves from the entry widget """
''' The mouse moves into the entry widget '''
''' Remove Tool-Tip '''
window.my_tool_tip.destroy()
@ -580,7 +581,7 @@ class FrameWidgets(ttk.Frame):
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, _('No Tunnels in List for Export'))
def empty_list_leave(_):
""" The mouse moves from the entry widget """
''' The mouse moves into the entry widget '''
''' Remove Tool-Tip '''
window.my_tool_tip.destroy()
@ -590,7 +591,7 @@ class FrameWidgets(ttk.Frame):
_(' Click to export all\nWireguard Tunnel to Zipfile'))
def exp_leave(_):
""" The mouse moves from the entry widget """
''' The mouse moves into the entry widget '''
''' Remove Tool-Tip '''
window.my_tool_tip.destroy()
@ -608,7 +609,7 @@ class FrameWidgets(ttk.Frame):
self.lb_rename.config(state='disable')
def rename_no_active_leave(_):
""" The mouse moves from the entry widget """
''' The mouse moves into the entry widget '''
''' Remove Tool-Tip '''
window.my_tool_tip.destroy()
@ -623,7 +624,7 @@ class FrameWidgets(ttk.Frame):
_('To rename a tunnel, you need to\nselect a tunnel from the list'))
def rename_leave(_):
""" The mouse moves from the entry widget """
''' The mouse moves into the entry widget '''
''' Remove Tool-Tip '''
window.my_tool_tip.destroy()
@ -729,7 +730,7 @@ class FrameWidgets(ttk.Frame):
'tunnel in the list,to use the autostart'))
def chk_leave(_):
""" The mouse moves from the entry widget """
''' The mouse moves into the entry widget '''
''' Remove Tool-Tip '''
window.my_tool_tip.destroy()
@ -740,7 +741,7 @@ class FrameWidgets(ttk.Frame):
_('To use the autostart, enable this Checkbox'))
def chk_a_leave(_):
""" The mouse moves from the entry widget """
''' The mouse moves into the entry widget '''
''' Remove Tool-Tip '''
window.my_tool_tip.destroy()
@ -757,7 +758,7 @@ class FrameWidgets(ttk.Frame):
_('To use the autostart, a tunnel must be selected from the list'))
def chk_a_leave(_):
""" The mouse moves from the entry widget """
''' The mouse moves into the entry widget '''
''' Remove Tool-Tip '''
window.my_tool_tip.destroy()
@ -849,7 +850,7 @@ class FrameWidgets(ttk.Frame):
'Checkbox'))
def chk_a_leave(_):
""" The mouse moves from the entry widget """
''' The mouse moves into the entry widget '''
''' Remove Tool-Tip '''
window.my_tool_tip.destroy()
@ -859,7 +860,7 @@ class FrameWidgets(ttk.Frame):
_('List of available tunnels'))
def list_info_leave(_):
""" The mouse moves from the entry widget """
''' The mouse moves into the entry widget '''
''' Remove Tool-Tip '''
window.my_tool_tip.destroy()
@ -870,7 +871,7 @@ class FrameWidgets(ttk.Frame):
'Tunnel\nSelect from the list!'))
def del_leave(_):
""" The mouse moves from the entry widget """
''' The mouse moves into the entry widget '''
''' Remove Tool-Tip '''
window.my_tool_tip.destroy()
@ -881,7 +882,7 @@ class FrameWidgets(ttk.Frame):
'all\nWireguard Tunnel to Zipfile'))
def exp_leave(_):
""" The mouse moves from the entry widget """
''' The mouse moves into the entry widget '''
''' Remove Tool-Tip '''
window.my_tool_tip.destroy()
@ -892,7 +893,7 @@ class FrameWidgets(ttk.Frame):
'select a tunnel from the list'))
def rename_leave(_):
""" The mouse moves from the entry widget """
''' The mouse moves into the entry widget '''
''' Remove Tool-Tip '''
window.my_tool_tip.destroy()
@ -1045,7 +1046,7 @@ class FrameWidgets(ttk.Frame):
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, _('Click to stop selected Wireguard Tunnel'))
def stop_leave(_):
""" The mouse moves from the entry widget """
''' The mouse moves into the entry widget '''
''' Remove Tool-Tip '''
window.my_tool_tip.destroy()
@ -1062,7 +1063,7 @@ class FrameWidgets(ttk.Frame):
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, _('No tunnels to start in the list'))
def empty_list_start_leave(_):
""" The mouse moves from the entry widget """
''' The mouse moves into the entry widget '''
''' Remove Tool-Tip '''
window.my_tool_tip.destroy()
@ -1071,7 +1072,7 @@ class FrameWidgets(ttk.Frame):
window.my_tool_tip = MyToolTip(event.x_root, event.y_root, _('Click to start selected Wireguard Tunnel'))
def start_leave(_):
""" The mouse moves from the entry widget """
''' The mouse moves into the entry widget '''
''' Remove Tool-Tip '''
window.my_tool_tip.destroy()
@ -1193,7 +1194,7 @@ class MyToolTip(tk.Toplevel):
if __name__ == '__main__':
window = MainWindow()
window = Wirepy()
"""
the hidden files are hidden in Filedialog
"""