-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_dependencies.py
More file actions
144 lines (123 loc) · 3.45 KB
/
install_dependencies.py
File metadata and controls
144 lines (123 loc) · 3.45 KB
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
137
138
139
140
141
142
143
144
#!/usr/bin/env python3
import subprocess
import sys
import os
def detect_distro():
try:
with open('/etc/os-release', 'r') as f:
os_release = f.read().lower()
if 'ubuntu' in os_release or 'debian' in os_release:
return 'ubuntu'
elif 'fedora' in os_release:
return 'fedora'
elif 'arch' in os_release or 'manjaro' in os_release:
return 'arch'
except FileNotFoundError:
pass
print("Error: Could not detect distribution. Supported: Ubuntu, Fedora, Arch Linux")
sys.exit(1)
def run_command(cmd, use_sudo=True):
if use_sudo and os.geteuid() != 0:
cmd = ['sudo'] + cmd
print(f"Running: {' '. join(cmd)}")
try:
subprocess.run(cmd, check=True)
return True
except subprocess.CalledProcessError as e:
print(f"Error running command: {e}")
return False
def install_ubuntu():
print("Installing dependencies for Ubuntu/Debian...")
packages = [
'build-essential',
'meson',
'ninja-build',
'pkg-config',
'valac',
'libglib2.0-dev',
'libgee-0.8-dev',
'libgio2.0-cil-dev',
'libwayland-dev',
'libwayland-client0',
'libwayland-egl1',
'wayland-protocols',
'libegl1-mesa-dev',
'libgles2-mesa-dev',
'libgl1-mesa-dev',
'libfreetype6-dev',
'libxkbcommon-dev',
'wayfire',
]
cmd = ['apt-get', 'install', '-y'] + packages
return run_command(cmd)
def install_fedora():
print("Installing dependencies for Fedora...")
packages = [
'gcc',
'gcc-c++',
'make',
'meson',
'ninja-build',
'pkgconfig',
'vala',
'glib2-devel',
'libgee-devel',
'wayland-devel',
'wayland-protocols-devel',
'mesa-libEGL-devel',
'mesa-libGLES-devel',
'mesa-libGL-devel',
'freetype-devel',
'libxkbcommon-devel',
'wayfire',
]
cmd = ['dnf', 'install', '-y'] + packages
return run_command(cmd)
def install_arch():
print("Installing dependencies for Arch Linux...")
packages = [
'base-devel',
'meson',
'ninja',
'pkgconf',
'vala',
'glib2',
'libgee',
'wayland',
'wayland-protocols',
'mesa',
'glu',
'freetype2',
'libxkbcommon',
'wayfire',
]
cmd = ['pacman', '-S', '--needed', '--noconfirm'] + packages
return run_command(cmd)
def main():
print("ExyShell Dependency Installation Script")
print("=" * 50)
if os.geteuid() != 0:
print("Note: This script will use 'sudo' to install packages.")
print("You may be prompted for your password.")
print()
distro = detect_distro()
print(f"Detected distribution: {distro. capitalize()}")
print()
success = False
if distro == 'ubuntu':
success = install_ubuntu()
elif distro == 'fedora':
success = install_fedora()
elif distro == 'arch':
success = install_arch()
# Print result
print()
print("=" * 50)
if success:
print("✓ All dependencies installed successfully!")
else:
print("✗ Failed to install some dependencies.")
print("Please check the error messages above.")
sys.exit(1)
if __name__ == '__main__':
main()