Compare commits
21 Commits
Author | SHA1 | Date | |
---|---|---|---|
b3b929adda | |||
8ccf819e2a | |||
9d9c84e215 | |||
86141c5c5c | |||
c23a60bdc1 | |||
ea21bcd2a2 | |||
b69f7074a0 | |||
4bba1611cd | |||
d542397870 | |||
98c1324af0 | |||
4176263cb1 | |||
26a18d7877 | |||
69659a9787 | |||
09733aa472 | |||
d534d78d55 | |||
0026c06200 | |||
bbb14ce0c0 | |||
5569eceb8e | |||
0e8e4973c5 | |||
b727633f74 | |||
7ce1216f71 |
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 saru
|
||||
Copyright (c) 2025 Obie Hinojosa
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
|
96
installer.py
96
installer.py
@ -1,7 +1,7 @@
|
||||
# -----------------------read me?---------------------------
|
||||
|
||||
|
||||
# compiling this is super easy, just run `pip install wget` and `pip install pyinstaller` and then
|
||||
# compiling this is super easy, just run `pip install wget pyinstaller certifi` and then
|
||||
# compile with `python -m PyInstaller --onefile installer.py --icon image.ico`
|
||||
|
||||
# (wget is a dependency for this python script that doesnt come with python by default)
|
||||
@ -9,9 +9,6 @@
|
||||
|
||||
# also, peep the organized code blocks!! am i cool or what?
|
||||
|
||||
# something worthy of note: this code desperately needs to be refactored. right now literally
|
||||
# everything important happens under a big if elif statement and its pretty fucking stupid
|
||||
|
||||
|
||||
# -----------------import dependencies----------------------
|
||||
|
||||
@ -32,6 +29,11 @@ from pathlib import Path
|
||||
# as far as i can tell, i wanted to add an "option" to the function that toggled the warning m-
|
||||
# -essage, so i dont have to use all this space here defining functions i dont really need.
|
||||
|
||||
class customerror(Exception):
|
||||
def __init__(self, message):
|
||||
self.message = message
|
||||
super().__init__(self.message)
|
||||
|
||||
def delete_directory_warn(directory_to_delete, warn=False):
|
||||
#this defines a function to delete a directory (no shit)
|
||||
try:
|
||||
@ -110,54 +112,89 @@ def print_ascii_art():
|
||||
print(" ....")
|
||||
print()
|
||||
|
||||
def checkfor_and_delete_file(filepath):
|
||||
def check_if_exists_and_delete_file(filepath):
|
||||
#deletes old downloaded mod archives
|
||||
if os.path.exists(filepath):
|
||||
print("Found previously downloaded archive, deleting...")
|
||||
os.remove(filepath)
|
||||
else:
|
||||
pass
|
||||
|
||||
def check_for_launcher_files(filepath, launchername):
|
||||
#checks for evidence of 3rd party launchers and sets a variable flag if a launcher is installed
|
||||
if os.path.exists(filepath):
|
||||
global detectedlauncher
|
||||
detectedlauncher = str(launchername)
|
||||
print("[INFO]: Detected Minecraft launcher: " + str(launchername))
|
||||
else:
|
||||
print("[DBUG]: " + launchername + " not detected.")
|
||||
|
||||
|
||||
# --------------------the real shit!------------------------
|
||||
|
||||
|
||||
print("[INFO]: Welcome! Installer Version: 0.1.4")
|
||||
|
||||
#detect operating system and find home, minecraft, & mod folders
|
||||
homedir = os.path.expanduser("~")
|
||||
os.chdir(homedir)
|
||||
|
||||
global mcfolder
|
||||
global modfolder
|
||||
# `global` sets these variables to exist outside of the scope of these specific `if` statements.
|
||||
# `global` sets these variables to exist outside of the scope of these specific `if` statements.
|
||||
|
||||
if platform.system() == "Linux":
|
||||
print("Operating system detected: Linux")
|
||||
print("[INFO]: Operating system detected: Linux")
|
||||
|
||||
detectedlauncher = "OfficialLauncher"
|
||||
check_for_launcher_files(str(Path.cwd()) + "/.local/share/PrismLauncher", "PrismLauncherPackage")
|
||||
check_for_launcher_files(str(Path.cwd()) + "/.var/app/org.prismlauncher.PrismLauncher/data/PrismLauncher/", "PrismLauncherFlatpak")
|
||||
|
||||
if detectedlauncher == "OfficialLauncher":
|
||||
print("[INFO]: No 3rd party launchers detected, falling back to default official launcher directories")
|
||||
os.chdir(".minecraft")
|
||||
|
||||
if detectedlauncher == "PrismLauncherPackage":
|
||||
print("[INFO]: Using Prism Launcher (native) directory settings.")
|
||||
os.chdir(".local/share/PrismLauncher/instances/1.20.1/minecraft/")
|
||||
|
||||
if detectedlauncher == "PrismLauncherFlatpak":
|
||||
print("[INFO]: Using Prism Launcher (Flatpak) directory settings.")
|
||||
os.chdir(".var/app/org.prismlauncher.PrismLauncher/data/PrismLauncher/instances/1.20.1/minecraft/")
|
||||
|
||||
os.chdir(".minecraft")
|
||||
mcfolder = str(Path.cwd())
|
||||
modfolder = mcfolder + '/mods'
|
||||
print("Changed current working directory to '" + str(mcfolder) + "'")
|
||||
|
||||
time.sleep(1)
|
||||
print()
|
||||
print("Backing up minecraft install...")
|
||||
print("Don't close the window! This'll take a moment...")
|
||||
|
||||
compress_tar(mcfolder, "mod-backup.tar.gz")
|
||||
|
||||
elif platform.system() == "Windows":
|
||||
print("Operating system detected: Windows")
|
||||
|
||||
os.chdir("AppData/Roaming/.minecraft")
|
||||
mcfolder = str(Path.cwd())
|
||||
print("Changed current working directory to '" + str(mcfolder) + "'")
|
||||
print("[INFO]: Changed current working directory to '" + str(mcfolder) + "'")
|
||||
|
||||
time.sleep(1)
|
||||
print(); print("Backing up minecraft install...")
|
||||
print("Don't close the window! This'll take a moment...")
|
||||
|
||||
modfolder = str(mcfolder) + '/mods'
|
||||
compress_tar(mcfolder, "mod-backup.tar.gz")
|
||||
compress_tar(mcfolder, "backup.tar.gz")
|
||||
|
||||
os.chdir(mcfolder)
|
||||
elif platform.system() == "Windows":
|
||||
print("Operating system detected: Windows")
|
||||
|
||||
try:
|
||||
os.chdir("AppData/Roaming/.minecraft")
|
||||
except:
|
||||
print("[ERR!] Fatal: Minecraft directory not found. (Is Minecraft installed?)")
|
||||
print("[ERR!] Fatal: This window will close in 10 seconds...")
|
||||
print
|
||||
time.sleep(10)
|
||||
exit
|
||||
|
||||
mcfolder = str(Path.cwd())
|
||||
print("[INFO]: Changed current working directory to '" + str(mcfolder) + "'")
|
||||
|
||||
time.sleep(1)
|
||||
print(); print("Backing up minecraft install...")
|
||||
print("Don't close the window! This'll take a moment...")
|
||||
|
||||
modfolder = str(mcfolder) + '/mods'
|
||||
compress_tar(mcfolder, "backup.tar.gz")
|
||||
|
||||
os.chdir(mcfolder)
|
||||
time.sleep(2)
|
||||
# unclear if this timeout is necessary for UX
|
||||
|
||||
@ -165,7 +202,6 @@ time.sleep(2)
|
||||
delete_file("mods.tar.gz")
|
||||
delete_directory("mods")
|
||||
print("Deleting mod folder contents...")
|
||||
#shut up
|
||||
os.mkdir(str("mods"))
|
||||
|
||||
# download mod archive from git repo and extract
|
||||
@ -175,7 +211,7 @@ os.environ['SSL_CERT_FILE'] = certifi.where()
|
||||
# this line fixes SSL errors after compiling with PyInstaller as long as certifi is imported alongside it
|
||||
|
||||
try:
|
||||
wget.download('https://git.sarushinobie.dev/saru/family-minecraft-modpack/releases/download/0.0.1/mods.tar.gz')
|
||||
wget.download('https://git.sarushinobie.dev/saru/family-minecraft-modpack/releases/download/0.1.4/mods.tar.gz')
|
||||
# this is insane. `wget` the fucking goat. who knew windows package manager was so cool?
|
||||
except:
|
||||
print(); print("[ERR!] Fatal: Download failed! (Is Adolin online?)"); print()
|
||||
@ -183,9 +219,9 @@ except:
|
||||
extract_tar('mods.tar.gz', 'mods')
|
||||
# ('tarfile', 'directory to extract to')
|
||||
|
||||
print(); print("sigma!")
|
||||
print("all done!")
|
||||
print(""); print("all done!")
|
||||
print("This window will exit and close in ten seconds. :)")
|
||||
print("(unless you're on linux, then you get to do it on your own. like usual.)")
|
||||
time.sleep(9)
|
||||
print_ascii_art()
|
||||
# print boykisser to console
|
||||
|
19
installer.sh
Executable file
19
installer.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
# this is the quick installer for linux users (blurghh)
|
||||
|
||||
echo "[INFO]: Installer Quick Script for Linux"
|
||||
echo "[INFO]: Installer Version: 0.1.4"
|
||||
echo "[INFO]: Welcome!"
|
||||
|
||||
rm installer
|
||||
wget https://git.sarushinobie.dev/saru/family-minecraft-modpack/releases/download/0.1.4/installer
|
||||
chmod +x ./installer
|
||||
./installer
|
||||
rm installer
|
||||
|
||||
# just realized you have to chmod +x the "quick install"
|
||||
# script too, is there a point even?
|
||||
|
||||
# i mean, at least it makes sure to download the newest
|
||||
# installer version? *this* script shouldn't deprecate...
|
Loading…
x
Reference in New Issue
Block a user