-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0.1.1_CLI_Install.txt
167 lines (157 loc) · 5.22 KB
/
0.1.1_CLI_Install.txt
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
"""
This program is an installer for Orange OS LE, you can find more information in the README
Copyright (C) 2022 Michael Halpin
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
import sys, os
print("Welcome to the Orange OS LE install script.")
print("We will ask you a few questions to make sure you get a great configuration.")
hard_drive = input("Please input your disk drive file, like /dev/sda: ")
host_name = input(
"Please enter the name you want to give your computer (a.k.a your hostname): "
)
keyboard_layout = input("Now enter your keyboard layout, like uk or us: ")
language = input(
'Now please enter your locale language. This should be something like "en_US": '
)
time_zone = input(
"Now we need your timezone, this is usually in the format of <Continent>/<City>, e.g Europe/Paris: "
)
location = input(
"Finally, we need to know what country you live in. If you don't want to answer this, enter worldwide."
).capitalize()
user_config = open("user_configuration.json", "w")
user_config.write(
f"""{'{'}
"additional-repositories": "",
"audio": "pipewire",
"bootloader": "grub-install",
"filesystem": "ext4",
"HSM": null,
"config_version": "2.5.0",
"debug": false,
"harddrives": [
"{hard_drive}"
],
"kernels": [
"linux"
],
"swap": true,
"keyboard-language": "{keyboard_layout}",
"mirror-region": "{location}",
"hostname": "{host_name}",
"keyboard-layout": "{keyboard_layout}",
"mount_point": null,
"nic": {'{'}
"dhcp": true,
"dns": null,
"gateway": null,
"iface": null,
"ip": null,
"type": "iso"
{'}'},
"ntp": true,
"plugin": null,
"profile": {'{'}
"path": "/usr/lib/python3.10/site-packages/archinstall/profiles/minimal.py"
{'}'},
"script": "guided",
"silent": false,
"sys-language": "{language}",
"sys-encoding": "utf-8",
"timezone": "{time_zone}",
"version": "2.5.0",
"packages": ["git", "python3"],
"custom-commands": [
"pacman -S xorg xorg-server --noconfirm",
"pacman -S gnome --noconfirm",
"systemctl enable gdm.service"
]
{'}'}"""
)
user_config.close()
print("Okay, now we are going to setup users for you.")
user_creds = open("user_credentials.json", "w")
user_creds.write(
"""{
"!users": ["""
)
users_no = int(input("First, how many users do you want the system to hold: "))
for x in range(0, users_no):
user_creds.write("{\n")
username = input(f"Ok what the you want the username of user {x + 1} to be: ")
password = input(f"Now, what password do you want to give {username}: ")
superuser = input(
f"Lastly do you want {username} to be a superuser? Leave blank if you don't: "
)
user_creds.write(f'"!password": "{password}",\n')
if superuser:
user_creds.write('"sudo": true,\n')
else:
user_creds.write('"sudo": false,\n')
user_creds.write(f'"username": "{username}"\n')
user_creds.write("}")
if x == users_no - 1:
user_creds.write("\n")
else:
user_creds.write(",\n")
user_creds.write("]\n}")
user_creds.close()
print("Now we will setup the disks for you. Unfourtuanatley, we can't offer to let you")
print("do the disk partioning, but we might offer this in future.")
input(
"This will delete all data on the disk you have chosen,\nso if you don't want this, press Ctrl/Command C. Otherwise press enter. "
)
user_disks = open("user_disk_layout.json", "w")
user_disks.write(
f"""{'{'}
"{hard_drive}": {'{'}
"partitions": [
{'{'}
"boot": true,
"encrypted": false,
"filesystem": {'{'}
"format": "fat32"
{'}'},
"mountpoint": "/boot",
"size": "{'203MiB' if not os.path.exists("/sys/firmware/efi") else '512MiB'}",
"start": "{'3MiB' if not os.path.exists("/sys/firmware/efi") else '1MiB'}",
"type": "primary",
"wipe": true
{'}'},
{'{'}
"encrypted": false,
"filesystem": {'{'}
"format": "ext4",
"mount_options": []
{'}'},
"mountpoint": "/",
"size": "100%",
"start": "{'206MiB' if not os.path.exists("/sys/firmware/efi") else '513MiB'}",
"type": "primary",
"wipe": true
{'}'}
],
"wipe": true
{'}'}
{'}'}"""
)
user_disks.close()
def install():
# thanks to @UniqueName12345 for this idea.
try:
os.system(
"sudo archinstall --silent --config ./user_configuration.json --creds ./user_credentials.json --disk_layouts ./user_disk_layout.json"
)
except:
install()
install()