Compare commits

...

21 Commits
0.1.1 ... main

Author SHA1 Message Date
b3b929adda Update LICENSE 2025-07-10 16:54:53 -05:00
8ccf819e2a remove previous installer before download 2025-05-31 12:03:25 -05:00
9d9c84e215 rename installer.sh because i liek it better 2025-05-31 11:59:21 -05:00
86141c5c5c update comments 2025-05-31 11:14:11 -05:00
c23a60bdc1 upload install.sh 2025-05-31 11:12:28 -05:00
ea21bcd2a2 correct installer version to match prospective release 2025-05-31 11:05:05 -05:00
b69f7074a0 Merge branch 'main' of https://git.sarushinobie.dev/saru/family-minecraft-modpack 2025-05-31 10:58:10 -05:00
4bba1611cd rewrite exit message and update mod link to 0.1.3 2025-05-31 10:58:10 -05:00
d542397870 correct typos 2025-05-29 04:34:06 -05:00
98c1324af0 add error handling to windows install branch 2025-05-29 04:28:54 -05:00
4176263cb1 rename backup tarball 2025-05-29 04:16:49 -05:00
26a18d7877 update wget.download tarball link 2025-05-28 22:51:54 -05:00
69659a9787 correct typo 2025-05-28 22:39:25 -05:00
09733aa472 correct prism launcher flatpak directories (again) 2025-05-28 22:33:38 -05:00
d534d78d55 correct prism launcher flatpak directory 2025-05-28 22:29:13 -05:00
0026c06200 revert bbb14ce0c0e49ea009682ea1b8ba0fdba15a9afe
revert correct prism launcher
2025-05-28 22:27:50 -05:00
bbb14ce0c0 correct prism launcher 2025-05-28 22:22:17 -05:00
5569eceb8e add support for both native and flatpak versions of prism launcher 2025-05-28 21:41:16 -05:00
0e8e4973c5 implement working 3rd party launcher detection 2025-05-28 21:20:26 -05:00
b727633f74 add custom exception and barebones error handling to launcher detection 2025-05-28 20:06:02 -05:00
7ce1216f71 add building blocks for 3rd party launcher support 2025-05-28 19:23:43 -05:00
3 changed files with 86 additions and 31 deletions

View File

@ -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:

View File

@ -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
View 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...