-
Notifications
You must be signed in to change notification settings - Fork 4
/
install.py
93 lines (81 loc) · 3.71 KB
/
install.py
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
import os
import subprocess
def checkForRoot(): # Checks whether root priviledges have been provided .
if subprocess.getoutput("whoami") != "root":
print("Please execute the program as root!!")
print("Exiting..")
exit()
else:
installPreBuildDependencies()
def installPreBuildDependencies(): # Installing the pre-build dependencies
print("Installing dependencies.....\n\nThis may take a few moments.....")
if subprocess.getstatusoutput("pip3")[0] != 0:
os.system("sudo apt install python3-pip -y")
if subprocess.getstatusoutput("sudo python3 -m pyfiglet")[0] not in [0]:
os.system("sudo pip3 install pyfiglet")
if subprocess.getstatusoutput("sudo python3 -m termcolor") not in [0]:
os.system("sudo pip3 install termcolor")
os.system("clear")
installBuildDependencies()
def installBuildDependencies(): # install the build dependencies
from pyfiglet import Figlet
from termcolor import colored
banner = Figlet(font="big")
print(colored(banner.renderText("Linux Dynamic Wallpapers"), color="yellow"))
print("\n")
print(colored("By Amal Thomas", color="red"))
print("\n\n")
print(
colored("Installing Build libraries. This may take some time.", color="green")
)
os.system(
"sudo apt-get install x11-xserver-utils python3-pyqt5 python3-pyqt5.qtwebengine python3-pyqt5.qtwebchannel libqt5webkit5-dev feh cron -y"
)
os.system("pip3 install Flask pywebview argparse qtpy")
print(colored("Installing files. This may take a while.", color="green"))
if os.path.exists("/usr/share/linuxDynamicWallpapers"):
os.system("sudo rm -rf /usr/share/linuxDynamicWallpapers")
os.system("sudo mkdir -p /usr/share/linuxDynamicWallpapers")
else:
os.system("sudo mkdir -p /usr/share/linuxDynamicWallpapers")
os.system("sudo cp -r ./data /usr/share/linuxDynamicWallpapers")
os.system("sudo cp -r ./static /usr/share/linuxDynamicWallpapers")
os.system("sudo cp -r ./templates /usr/share/linuxDynamicWallpapers")
os.system("sudo cp -r ./images /usr/share/linuxDynamicWallpapers")
os.system("sudo cp -r ./dwl.sh /usr/share/linuxDynamicWallpapers")
os.system("sudo cp -r ./setdwl.sh /usr/share/linuxDynamicWallpapers")
os.system("sudo cp -r ./main.py /usr/share/linuxDynamicWallpapers")
os.system("sudo chmod +x /usr/share/linuxDynamicWallpapers/dwl.sh")
os.system("sudo chmod +x /usr/share/linuxDynamicWallpapers/setdwl.sh")
os.system("sudo chmod 777 /usr/share/linuxDynamicWallpapers/data/data.dat")
if os.path.exists("/usr/bin/dwl"):
os.system("sudo rm -rf /usr/bin/dwl")
os.system("sudo ln -s /usr/share/linuxDynamicWallpapers/dwl.sh /usr/bin/dwl")
if os.path.exists("/usr/bin/setdwl"):
os.system("sudo rm -rf /usr/bin/setdwl")
os.system(
"sudo ln -s /usr/share/linuxDynamicWallpapers/setdwl.sh /usr/bin/setdwl"
)
else:
os.system("sudo ln -s /usr/share/linuxDynamicWallpapers/dwl.sh /usr/bin/dwl")
os.system(
"sudo ln -s /usr/share/linuxDynamicWallpapers/setdwl.sh /usr/bin/setdwl"
)
os.system("clear")
print(colored("Finished!!", color="green"))
print("\n")
print(
colored(
"Linux Dynamic Wallpapers have been installed in your system.\n\n",
color="blue",
)
)
print(colored("To use it now, just type dwl in the terminal", color="green"))
def cleanUp(): # Clean up the installation files. Not executing as of now
os.system("rm -rf ./data")
os.system("rm -rf ./static")
os.system("rm -rf ./templates")
os.system("rm -rf ./images")
os.system("rm -rf *")
if __name__ == "__main__":
checkForRoot()