This repository has been archived by the owner on Jan 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathupdate-scripts
89 lines (78 loc) · 3.63 KB
/
update-scripts
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
#!/usr/bin/env python3
# This is an old updater script that was in use before the Eupnea Project started hosting their own repos.
# This script only exists to update old v1.0 depthboot systems to v1.1
import json
import os
import sys
from urllib.request import urlretrieve
from functions import *
if __name__ == "__main__":
# Restart script as root
if not os.geteuid() == 0:
sudo_args = ['sudo', sys.executable] + sys.argv + [os.environ]
os.execlpe('sudo', *sudo_args)
set_verbose(True) # always run verbose
# delete old scripts tmp dir
rmdir("/tmp/scripts-update")
# Make new tmp dir
mkdir("/tmp/scripts-update")
# delete old scripts
rmfile("/usr/local/bin/collect-logs")
rmfile("/usr/local/bin/functions.py")
rmfile("/usr/local/bin/install-ectool")
rmfile("/usr/local/bin/install-ectool.py")
rmfile("/usr/local/bin/install-to-internal")
rmfile("/usr/local/bin/manage-kernels")
rmfile("/usr/local/bin/modify-cmdline")
rmfile("/usr/local/bin/postinstall")
rmfile("/usr/local/bin/setup-zram")
rmfile("/usr/local/bin/update-scripts")
rmfile("/usr/local/bin/setup-audio")
# Delete old configs
rmdir("/etc/eupnea")
# Disable old systemd services
bash("systemctl disable eupnea-postinstall.service")
bash("systemctl disable eupnea-update.timer")
bash("systemctl disable eupnea-update.service")
# Delete old systemd services
rmfile("/etc/systemd/system/eupnea-postinstall.service")
rmfile("/etc/systemd/system/eupnea-update.timer")
rmfile("/etc/systemd/system/eupnea-update.service")
# Remove scripts versions from eupnea.json
with open("/etc/eupnea.json", "r") as file:
eupnea_json = json.load(file)
del eupnea_json["postinstall_version"]
del eupnea_json["audio_version"]
# Set new depthboot version
eupnea_json["depthboot_version"] = "1.1.0"
# Write new json to /etc/eupnea.json
with open("/etc/eupnea.json", "w") as file:
json.dump(eupnea_json, file)
# install new scripts and "eupnea-system update" package via package manager
match eupnea_json["distro_name"]:
case "pop-os" | "ubuntu" | "debian":
mkdir("/usr/local/share/keyrings", create_parents=True)
# download public key
urlretrieve(f"https://eupnea-linux.github.io/apt-repo/public.key",
filename="/usr/local/share/keyrings/eupnea.key")
with open("/etc/apt/sources.list.d/eupnea.list", "w") as file:
file.write("deb [signed-by=/usr/local/share/keyrings/eupnea.key] https://eupnea-linux.github.io/"
"apt-repo/debian_ubuntu kinetic main")
bash("apt-get update -y")
bash("apt-get install -y eupnea-utils eupnea-system")
case "fedora":
bash("dnf config-manager --add-repo https://eupnea-linux.github.io/rpm-repo/eupnea.repo")
bash("dnf update -y")
bash("dnf install -y eupnea-utils eupnea-system")
case "arch":
urlretrieve(f"https://eupnea-linux.github.io/arch-repo/public_key.gpg", filename="/tmp/eupnea.key")
bash("pacman-key --add /tmp/eupnea.key")
bash("pacman-key --lsign-key 94EB01F3608D3940CE0F2A6D69E3E84DF85C8A12")
# add repo to pacman.conf
with open("/etc/pacman.conf", "a") as file:
file.write("[eupnea]\nServer = https://eupnea-linux.github.io/arch-repo/repodata/$arch\n")
bash("pacman --noconfirm -Syy")
bash("pacman -S --noconfirm eupnea-utils eupnea-system cgpt-vboot-utils")
case _:
print("Unsupported distro")
exit(1)