-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall_customization.py
More file actions
38 lines (29 loc) · 884 Bytes
/
Copy pathinstall_customization.py
File metadata and controls
38 lines (29 loc) · 884 Bytes
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
import sys
import os
def clean_line(line):
if '#' in line:
return line.split('#')[0].strip()
else:
return line.strip()
def apt_command(line):
if '|' in line:
package_name, ppa = line.strip().split('|')
os.system(f'sudo add-apt-repository {ppa}')
os.system('sudo apt update')
else:
package_name = line.strip()
os.system(f'sudo apt-get install {package_name}')
def manual_install(line):
os.system(f'sudo {line}')
do_install = {\
'APT':apt_command,
'CLI':manual_install\
}
os.system('sudo apt update')
with open('list_of_apps.txt', 'r') as fin:
for line in fin:
if line[0] == '#':
mode = line.strip().replace('#', '')
continue
line = clean_line(line)
do_install[mode](line)