forked from felipenlunkes/run-ancient-unix
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRAU.py
More file actions
executable file
·118 lines (89 loc) · 3.56 KB
/
Copy pathRAU.py
File metadata and controls
executable file
·118 lines (89 loc) · 3.56 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
#!/usr/bin/python3
# Automated execution of UNIX systems, by Felipe Miguel Nery Lunkes
# Licenced under BSD-3-Clause
#
# Frontend for run.sh
from tkinter import *
import os, shutil
class RAU:
def __init__(self, win):
# Labels
self.lbl1=Label(win, text='Ancient UNIX running tool')
self.lbl2=Label(win, text='Select one of the options below to continue')
self.lbl3=Label(win, text='Configuration options')
self.lbl4=Label(win, text='Running options')
# Buttons
self.btn0=Button(win, text='Run Version 1 UNIX for PDP-11', command=self.runV1UNIX)
self.btn1=Button(win, text='Run Version 5 UNIX for PDP-11', command=self.runV5UNIX)
self.btn2=Button(win, text='Run Version 7 UNIX for PDP-11', command=self.runV7UNIX)
self.btn3=Button(win, text='Run 2.11BSD UNIX for PDP-11', command=self.run211BSD)
self.btn4=Button(win, text='Run Version 7 UNIX for x86', command=self.runV7UNIXx86)
self.btn5=Button(win, text='Install UNIX system images', command=self.installImages)
self.btn6=Button(win, text="Clear temporary files", command=self.clearTemp)
self.lbl1.place(x=170, y=5)
self.lbl2.place(x=100, y=50)
self.lbl3.place(x=180, y=100)
self.btn5.place(x=10, y=140)
self.btn6.place(x=250, y=140)
self.lbl4.place(x=195, y=200)
self.btn0.place(x=10, y=240)
self.btn1.place(x=250, y=240)
self.btn2.place(x=10, y=280)
self.btn3.place(x=250, y=280)
self.btn4.place(x=10, y=320)
def runCommand(self, cmd):
os.chdir(os.path.dirname(__file__))
bashcmd = f"bash -c './run.sh {cmd}; echo Press Enter to continue...; read'"
if shutil.which("gnome-terminal"):
os.system(f"gnome-terminal -- {bashcmd}")
return
if shutil.which("xfce4-terminal"):
os.system(f"xfce4-terminal --disable-server -e \"{bashcmd}\"")
return
if shutil.which("xterm"):
os.system(f"xterm -e {bashcmd}")
return
os.system(f"./run.sh {cmd}")
def runV1UNIX(self):
print(" > Version 1 UNIX (PDP-11) was selected to run.")
self.runCommand("v1UNIX")
self.complete()
def runV5UNIX(self):
print(" > Version 5 UNIX (PDP-11) was selected to run.")
self.runCommand("v5UNIX")
self.complete()
def runV7UNIX(self):
print(" > Version 7 UNIX (PDP-11) was selected to run.")
self.runCommand("v7UNIX")
self.complete()
def run211BSD(self):
print(" > 2.11BSD UNIX (PDP-11) was selected to run.")
self.runCommand("211BSDUNIX")
self.complete()
def runV7UNIXx86(self):
print(" > Version 7 UNIX (x86) was selected to run.")
self.runCommand("v7UNIXx86")
self.complete()
def installImages(self):
print(" > Installing UNIX system images...")
self.runCommand("installUNIX")
self.complete()
def clearTemp(self):
print(" > Clear temporary files.")
self.runCommand("clearTemp")
self.complete()
def complete(self):
print("Request completed.\n")
# Main code
version='v0.3'
window=Tk()
RunAncientUNIX=RAU(window)
window.title('Run ancient UNIX '+version)
window.geometry("500x400+10+10")
print("\nRun ancient UNIX frontend "+version)
print("Copyright (C) 2023 Felipe Miguel Nery Lunkes")
print("All rights reserved.")
print("Licensed under BSD-3-Clause license")
print("\nWaiting for user interaction...")
window.mainloop()
print("Finished by user.")