1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136 | diff --git a/install.py b/install.py
index e657a61..2ce1de9 100644
--- a/install.py
+++ b/install.py
@@ -1,4 +1,6 @@
import os
+import grp
+
os.system(
'sudo -k > /dev/null 2>&1 && sudo -v -p "[*]- Please enter password: " > /dev/null 2>&1'
@@ -24,52 +26,24 @@ def get_distro():
distro = get_distro()
-def install_pip():
- exit_code = os.system("pip3 --version > /dev/null 2>&1")
- if exit_code == 0:
- print("[*]- pip is installed !!")
- else:
- print("[*]- Pip not found. Installing pip...")
- print("[*]- wait...")
- if distro in ["ubuntu", "debian"]:
- os.system("sudo apt-get update")
- os.system("sudo apt-get install -y python3-pip > /dev/null 2>&1")
- print("[*]- pip installed Successfully !!")
- elif distro == "fedora":
- os.system("sudo dnf install -y python3-pip > /dev/null 2>&1")
- print("[*]- pip installed Successfully !!")
- elif distro in ["centos", "rhel"]:
- os.system("sudo yum install -y python3-pip > /dev/null 2>&1")
- print("[*]- pip installed Successfully !!")
- elif distro == "arch":
- os.system("sudo pacman -S --noconfirm python-pip > /dev/null 2>&1")
- print("[*]- pip installed Successfully !!")
- elif distro == "void":
- os.system("sudo xbps-install -y python3-pip > /dev/null 2>&1")
- print("[*]- pip installed Successfully !!")
- else:
- print("Unsupported distribution. Please install pip manually.")
- exit(1)
-
-
def install_system_deps():
if distro in ["ubuntu", "debian"]:
os.system("sudo apt-get update > /dev/null 2>&1")
- os.system("sudo apt-get install -y tk python python3-tk > /dev/null 2>&1")
+ os.system("sudo apt-get install -y tk python3 python3-tk > /dev/null 2>&1")
print("[*]- Dependencies: Done")
elif distro == "fedora":
- os.system("sudo dnf install -y tk python > /dev/null 2>&1")
+ os.system("sudo dnf install -y tk python3 > /dev/null 2>&1")
print("[*]- Dependencies: Done")
elif distro in ["centos", "rhel"]:
- os.system("sudo yum install -y python tk > /dev/null 2>&1")
+ os.system("sudo yum install -y python3 tk > /dev/null 2>&1")
print("[*]- Dependencies: Done")
elif distro == "arch":
- os.system("sudo pacman -S --noconfirm python tk > /dev/null 2>&1")
+ os.system("sudo pacman -S --noconfirm python3 tk > /dev/null 2>&1")
print("[*]- Dependencies: Done")
elif distro == "void":
os.system(
- "sudo xbps-install -y tk python python-tkinter python3-tkinter > /dev/null 2>&1"
+ "sudo xbps-install -y python python3-pip python3-tkinter > /dev/null 2>&1"
)
print("[*]- Dependencies: Done")
else:
@@ -77,27 +51,6 @@ def install_system_deps():
"[*]- Unsupported distribution. Please install system dependencies manually.\n [*]- dependencies:\n\t-python\n\t-tk\n\t-python-tkinter "
)
-
-def install_libs():
- try:
- os.system(
- "pip install --upgrade -y pip setuptools wheel --break-system-packages > /dev/null 2>&1"
- )
- print("[*]- Pip Upgraded Successfully !!")
- except OSError as e:
- print("[*]- Pip upgrade failed\ncheck pip_upgrade_error.txt for more info")
- os.system(f"echo {e} > pip_upgrade_error.txt")
-
- try:
- os.system(
- "pip install -r requirements.txt --quiet --only-binary=:all: --break-system-packages"
- )
- print("[*]- Install libs successful !!")
- except OSError as e:
- print("[*]- Install libs failed !!\ncheck lib_install_error.txt for more info")
- os.system(f"echo {e} > lib_install_error.txt")
-
-
def copy_file():
try:
os.system("cp ./src/pino.py pino > /dev/null 2>&1")
@@ -106,26 +59,28 @@ def copy_file():
)
os.system("chmod +x pino > /dev/null 2>&1")
os.system("sudo cp pino ./src/pino_start /usr/bin/ > /dev/null 2>&1")
-
os.system("rm pino > /dev/null 2>&1")
+
+ if not os.path.exists("/etc/pino"):
+ os.system("sudo mkdir /etc/pino")
+ os.system(f"sudo chown -R {os.getlogin()}:{grp.getgrgid(os.getgid()).gr_name} /etc/pino/ > /dev/null 2>&1")
+ os.system("sudo cp -r lib /etc/pino > /dev/null 2>&1")
except OSError as e:
print("Installing app failed\ncheck app_install_error.txt file for more info")
os.system(f"echo {e} > app_install_error.txt")
+
try:
- os.system("sudo mkdir /etc/pino/ > /dev/null 2>&1")
- os.system("mkdir -p ~/.config/pino/plugs/ > /dev/null 2>&1")
- os.system("cp ./plugs/* ~/.config/pino/plugs > /dev/null 2>&1")
- os.system(
- "sudo cp ./src/config.json ./src/notification.wav /etc/pino/ > /dev/null 2>&1"
- )
- os.system("cp /etc/pino/* ~/.config/pino/")
+ if not os.path.exists("~/.config/pino"):
+ os.makedirs(os.path.expanduser("~/.config/pino/plugs/"), exist_ok=True)
+ os.system("cp ./plugs/* ~/.config/pino/plugs/ > /dev/null 2>&1")
+ os.system("sudo cp ./src/config.json ./src/notification.wav /etc/pino/ > /dev/null 2>&1")
+ os.system("cp /etc/pino/* ~/.config/pino/ > /dev/null 2>&1")
print("\n[*]- Done")
except OSError as e:
print("Creating config files failed\ncheck config_error.txt for more info")
os.system(f"echo {e} > config_error.txt")
-install_pip()
-install_libs()
+
install_system_deps()
copy_file()
|