-
Notifications
You must be signed in to change notification settings - Fork 0
/
ak_installer.py
604 lines (585 loc) · 17.4 KB
/
ak_installer.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
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
#!/usr/bin/env python3
#Version 1.40
import os
import requests
import time
import zipfile
import sys
def notepad_plus():
try:
url = "https://notepad-plus-plus.org/repository/7.x/7.6.6/npp.7.6.6.Installer.exe"
get = requests.get(url)
print("Getting url....")
contents = get.content
print("Getting url...Done")
time.sleep(1)
print("Opening file...")
time.sleep(1)
f = open("notepad++.exe", "wb")
print("Opening file...Done")
time.sleep(1)
print("Writing file...")
f.write(contents)
time.sleep(1)
print("Writing file...Done")
time.sleep(1)
print("Closing file...")
f.close()
print("Closing file...Done")
time.sleep(1)
cwd = os.getcwd()
print("Changing to current directory...")
time.sleep(1)
os.chdir(cwd)
print("Changing directory...Done")
time.sleep(1)
print("Starting installation...")
os.system("notepad++.exe")
print("Beginning installation")
os.system("del notepad++.exe")
time.sleep(30)
exit()
except OSError as e:
print(e)
print("Something went wrong")
exit()
except KeyboardInterrupt:
print("Dont interrupt")
pass
def sublime():
try:
url = "https://download.sublimetext.com/Sublime%20Text%20Build%203207%20Setup.exe"
print("Getting url...")
requester = requests.get(url)
contents = requester.content
print("Getting the url...Done")
time.sleep(1)
print("Opening file...")
time.sleep(1)
f = open("sublime.exe", "wb")
print("Opening file...Done")
time.sleep(1)
print("Writing into file...")
f.write(contents)
print("Writing into file...Done")
time.sleep(1)
print("Closing file...")
f.close()
print("Closing file...Done")
time.sleep(1)
print("Getting current directory...")
cwd = os.getcwd()
print("Getting current directory...Done")
os.chdir(cwd)
print("Initialzing installation...Done")
time.sleep(1)
os.system("sublime.exe")
print("Install menu")
os.system("del sublime.exe")
time.sleep(30)
exit()
except OSError as e:
print("Something went wrong exitting")
print(e)
exit()
except KeyboardInterrupt:
print("Don't interrupt")
pass
def python3():
try:
url = "https://www.python.org/ftp/python/3.7.3/python-3.7.3-amd64.exe"
print("Getting url...")
requested = requests.get(url)
contents = requested.content
print("Getting url...Done")
time.sleep(1)
print("Opening file...")
time.sleep(1)
f = open("python3.exe", "wb")
time.sleep(1)
print("Opening file...")
time.sleep(1)
print("Opening file...Done")
time.sleep(1)
print("Writing contents...")
f.write(contents)
print("Writing contents...Done")
time.sleep(1)
print("Closing...")
f.close()
time.sleep(1)
print("Closing...Done")
time.sleep(1)
print("Getting current directory...")
cwd = os.getcwd()
print("Getting current directory...Done")
os.chdir(cwd)
print("Initalizing installation...")
time.sleep(1)
print("Initialzing installation...Done")
os.system("python3.exe")
print("Install menu done")
os.system("del python3.exe")
time.sleep(30)
exit()
except OSError as e:
print(e)
print("Something went wrong exitting")
exit()
except KeyboardInterrupt:
print("Dont interrupt")
pass
def python2():
try:
url = "https://www.python.org/ftp/python/2.7.16/python-2.7.16.amd64.msi"
print("Getting url...")
requested = requests.get(url)
contents = requested.content
print("Getting url...Done")
time.sleep(1)
print("Opening file...")
time.sleep(1)
f = open("python_2.msi", "wb")
print("Opening file...Done")
time.sleep(1)
print("Writing contents...")
f.write(contents)
time.sleep(1)
print("Writing contents...Done")
time.sleep(1)
print("Closing file...")
f.close()
time.sleep(1)
cwd = os.getcwd()
time.sleep(1)
print("Closing file...Done")
os.chdir(cwd)
time.sleep(1)
print("Initializing")
os.system("python2.msi")
print("Initializing...Done")
os.system("del python2.msi")
time.sleep(30)
exit()
except OSError as e:
print(e)
print("Something went wrong exitting")
exit()
except KeyboardInterrupt:
print("Dont interrupt")
pass
def python2L():
try:
url = "https://www.python.org/ftp/python/2.7.16/Python-2.7.16.tgz"
print("Getting url...")
requested = requests.get(url)
contents = requested.content
print("Getting url...Done")
time.sleep(1)
print("Creating file...")
f = open("python2.tgz","wb")
print("Creating file...Done")
time.sleep(1)
print("Writing contents...")
time.sleep(1)
f.write(contents)
print("Writing contents...Done")
time.sleep(1)
print("Closing file...")
f.close()
time.sleep(1)
print("Closing file...Done")
cwd = os.getcwd()
os.chdir(cwd)
os.system("mv python2.tgz /opt/python2.tgz")
print("Moving file to optional area")
time.sleep(1)
os.chdir("/opt")
print("Untarring file")
time.sleep(1)
os.system("tar xvf python2.tgz")
print("Untared")
os.chdir("Python-2.7.16")
os.system("chmod +x configure")
print("Configuring")
time.sleep(1)
os.system("./configure")
print("Initializing")
time.sleep(30)
exit()
except OSError as e:
print("Something went wrong")
print(e)
exit()
except KeyboardInterrupt:
print("Dont interrupt")
pass
def python3L():
try:
url = "https://www.python.org/ftp/python/3.7.1/Python-3.7.1rc1.tgz"
requested = requests.get(url)
print("Getting url this may take a second")
contents = requested.content
print("Got url")
f = open("python3_linux.tgz", "wb")
print("Creating file for store")
time.sleep(1)
f.write(contents)
f.close()
os.mkdir("/opt/python3")
print("Made a directory for python3..")
os.system("mv python3_linux.tgz /opt/python3")
print("Moving file")
time.sleep(1)
os.chdir("/opt/python3")
print("Untarring...")
time.sleep(1)
os.system("tar xvf python3_linux.tgz")
print("Untared...")
os.chdir("/opt/python3/Python-3.7.1rc1")
os.system("chmod +x configure")
os.system("./configure")
print("Done")
time.sleep(30)
exit()
except OSError:
print("Something went wrong initializing")
exit()
except KeyboardInterrupt:
print("Dont interrupt")
pass
def Pycharm():
try:
url = "https://download-cf.jetbrains.com/python/pycharm-community-2019.1.1.exe"
requested = requests.get(url)
print("Getting url this may take a second....")
contents = requested.content
print("Got url...")
time.sleep(2)
f = open("pycharm.exe","wb")
print("Saving file")
time.sleep(1)
f.write(contents)
print("Saved contents")
time.sleep(1)
f.close()
print("Closed file")
time.sleep(1)
cwd = os.getcwd()
os.chdir(cwd)
os.system("pycharm.exe")
print("Initializing.....")
os.system("del pycharm.exe")
time.sleep(30)
exit()
except OSError as e:
print("Something went wrong")
print(e)
exit()
except KeyboardInterrupt:
print("Interrupt detected")
pass
def PycharmL():
try:
url = "https://download-cf.jetbrains.com/python/pycharm-community-2019.1.1.tar.gz"
print("Checking url")
requested = requests.get(url)
time.sleep(1)
print("Getting url")
contents = requested.content
print("Got url")
f = open("pycharm.tar.gz","wb")
time.sleep(1)
print("Writing into file")
f.write(contents)
f.close()
time.sleep(1)
print("Closing file")
cwd = os.getcwd()
os.chdir(cwd)
time.sleep(1)
print("Changed to current directory")
time.sleep(1)
os.system("mv pycharm.tar.gz /opt")
time.sleep(1)
print("Moved file to /opt")
os.chdir("/opt")
time.sleep(1)
print("Changed directory to /opt")
time.sleep(1)
print("Starting untarring process")
os.system("tar xvf pycharm.tar.gz")
time.sleep(1)
print("Untarred")
time.sleep(1)
print("Changing to pycharm directory")
os.chdir("/opt/pycharm-community-2019.1.1")
time.sleep(1)
print("Changed directory")
time.sleep(1)
print("Changing to bin")
os.chdir("/opt/pycharm-community-2019.1.1/bin")
time.sleep(1)
print("Making sure jdk is installed or pycharm won't work")
time.sleep(1)
os.system("apt-get install default-jdk")
time.sleep(1)
print("Starting install")
os.system("chmod +x pycharm.sh")
os.system("./pycharm.sh")
print("Installing")
time.sleep(30)
exit()
except OSError as e:
print("Something went wrong")
print(e)
exit()
except KeyboardInterrupt:
print("Dont interrupt")
pass
def atom():
try:
print("Looking for url")
url = "https://atom-installer.github.com/v1.36.1/atom-amd64.deb?s=1556217353&ext=.deb"
requested = requests.get(url)
time.sleep(1)
print("Getting url")
contents = requested.content
time.sleep(1)
print("Got url")
time.sleep(1)
print("Opening file")
f = open("atom.deb","wb")
f.write(contents)
time.sleep(1)
print("Wrote to file")
f.close()
time.sleep(1)
print("Closed file")
cwd = os.getcwd()
os.chdir(cwd)
time.sleep(1)
print("Moving file")
os.system("mv atom.deb /opt")
time.sleep(1)
print("Moved file to /opt")
os.system("sudo dpkg -i /opt/atom.deb")
time.sleep(1)
print("Dpkg done")
time.sleep(30)
exit()
except OSError as e:
print("Something went wrong")
print(e)
exit()
except KeyboardInterrupt:
print("Dont interrupt")
pass
def virtualbox():
try:
print("Looking for url...")
url = "https://download.virtualbox.org/virtualbox/6.0.6/VirtualBox-6.0.6-130049-Win.exe"
requested = requests.get(url)
contents = requested.content
print("Looking for url....Done")
time.sleep(1)
cwd = os.getcwd()
os.chdir(cwd)
print("Writing to file....")
f = open("virtualbox.exe","wb")
f.write(contents)
f.close()
time.sleep(1)
print("Writing file....Done")
time.sleep(1)
print("Initializing install menu...")
os.system("virtualbox.exe")
print("Initializing install menu...Done")
os.system("del virtualbox.exe")
time.sleep(10)
exit()
except OSError:
print("Something went wrong")
exit()
except KeyboardInterrupt:
print("Dont interrupt")
pass
def virtualboxL():
try:
print("Looking for url....")
url = "https://download.virtualbox.org/virtualbox/6.0.6/VirtualBox-6.0.6-130049-Linux_amd64.run"
requested = requests.get(url)
contents = requested.content
cwd = os.getcwd()
print("Looking for url....Done")
time.sleep(1)
print("Writing to file...")
f = open("virtualbox.run","wb")
f.write(contents)
f.close()
time.sleep(1)
print("Writing to file...Done")
time.sleep(1)
print("Moving file to /opt directory...")
os.system("mv virtualbox.run /opt")
time.sleep(1)
print("Moved file to /opt directory...Done")
time.sleep(1)
print("Initializing menu....")
os.system("virtualbox.run")
time.sleep(1)
print("Initializing menu...Done")
time.sleep(10)
exit()
except OSError:
print("Something went wrong")
exit()
except KeyboardInterrupt:
print("Dont interrupt")
pass
def chromium():
try:
url = "https://storage.googleapis.com/chromium-browser-snapshots/Win_x64/657721/mini_installer.exe"
print("Getting url...")
time.sleep(1)
requested = requests.get(url)
contents = requested.content
print("Getting url....Done")
time.sleep(1)
cwd = os.getcwd()
os.chdir(cwd)
print("Writing to file...")
f = open("chromium.exe","wb")
f.write(contents)
f.close()
print("Writing to file...Done")
time.sleep(1)
print("Initializing menu...")
os.system("chromium.exe")
print("Intializing menu...Done")
os.system("del chromium.exe")
time.sleep(10)
exit()
except OSError:
print("Something went wrong")
exit()
except KeyboardInterrupt:
print("You can't interrupt")
pass
def chromiumL():
try:
print("Downloading for you")
os.system("sudo apt-get update")
os.system("sudo apt install chromium chromium-l10n")
print("Done")
time.sleep(10)
exit()
except OSError:
print("Something went wrong")
exit()
except KeyboardInterrupt:
print("You cant interrupt")
pass
def vscodeL():
try:
print("Starting setup")
os.system("sudo apt-get install snap")
print("Got snap")
os.system("sudo systemctl enable --now snapd.socket")
print("Enabled socket")
os.system("sudo ln -s /var/lib/snapd/snap /snap")
print("Enabled gateway")
time.sleep(1)
print("Installing")
os.system("sudo snap install --classic code")
print("Done just type snap run code to run it doesn't run with root")
except OSError:
print("Something went wrong")
exit()
except KeyboardInterrupt:
print("Dont interrupt")
exit()
def discordL():
try:
url = "https://dl.discordapp.net/apps/linux/0.0.9/discord-0.0.9.tar.gz"
print("Getting url....")
requested = requests.get(url)
contents = requested.content
print("Getting url...Done")
time.sleep(1)
print("Writing to file...")
f = open("discord.tar.gz","wb")
f.write(contents)
f.close()
print("Writing file...Done")
cwd = os.getcwd()
os.system("apt-get install tar")
os.chdir(cwd)
os.system("tar xvf discord.tar.gz")
print("Untarred")
os.system("mv Discord /opt")
time.sleep(1)
print("Moved to /opt")
os.chdir("/opt")
time.sleep(1)
print("Changed to /opt")
time.sleep(1)
print("Moved discord is stored in /opt/Discord")
print("To start it drag the file on the desktop called discord into your terminal and press enter")
exit()
except OSError:
print("Something went wrong")
exit()
except KeyboardInterrupt:
print("Dont interrupt")
pass
def initialize(choose):
if choose == "get notepad++ windows":
notepad_plus()
elif choose == "get sublime windows":
sublime()
elif choose == "get python3 windows":
python3()
elif choose == "get python2 windows":
python2()
elif choose == "get python3 linux":
python3L()
elif choose == "get python2 linux":
python2L()
elif choose == "get pycharm windows":
Pycharm()
elif choose == "get pycharm linux":
PycharmL()
elif choose == "get atom linux":
atom()
elif choose == "get virtualbox linux":
virtualboxL()
elif choose == "get virtualbox windows":
virtualbox()
elif choose == "get chromium windows":
chromium()
elif choose == "get chromium linux":
chromiumL()
elif choose == "get vscode linux":
vscodeL()
elif choose == "get discord linux":
discordL()
elif choose == "list":
f = open("list.txt","r")
contents = f.read()
print("This list you have")
print(contents)
f.close()
exit()
elif choose == "update":
update()
else:
print("""Uses
get - Will get the program you are asking for and then put your os
Eg get notepad++ windows
Remember ths is in beta stages so has limited amount of options
list-Will show you all the programs you can install at the moment
Version 1.40
""")
choice = ' '.join(sys.argv[1:])
initialize(choice)