Compare commits
35 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 | |||
e337495d1c | |||
9ca75600bd | |||
789fc7d579 | |||
967f9142a6 | |||
383da79299 | |||
b64ac3bc1b | |||
3f56ad069f | |||
f7c4f52eb3 | |||
e332bc8c58 | |||
b00415ff2f | |||
7e82b9673b | |||
eb3b615fb6 | |||
a158bcbd89 | |||
200f068ed8 |
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/build
|
||||||
|
/dist
|
||||||
|
*.spec
|
||||||
|
test.py
|
||||||
|
*.tmp
|
||||||
|
*.tar.gz
|
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
|||||||
MIT License
|
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:
|
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:
|
||||||
|
|
||||||
|
124
installer.py
124
installer.py
@ -1,7 +1,7 @@
|
|||||||
# -----------------------read me?---------------------------
|
# -----------------------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`
|
# 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)
|
# (wget is a dependency for this python script that doesnt come with python by default)
|
||||||
@ -9,15 +9,12 @@
|
|||||||
|
|
||||||
# also, peep the organized code blocks!! am i cool or what?
|
# 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----------------------
|
# -----------------import dependencies----------------------
|
||||||
|
|
||||||
|
|
||||||
import wget; import os; import platform; import time
|
import wget; import os; import platform;
|
||||||
|
import time; import sys; import certifi
|
||||||
import shutil; import tarfile
|
import shutil; import tarfile
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@ -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-
|
# 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.
|
# -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):
|
def delete_directory_warn(directory_to_delete, warn=False):
|
||||||
#this defines a function to delete a directory (no shit)
|
#this defines a function to delete a directory (no shit)
|
||||||
try:
|
try:
|
||||||
@ -69,7 +71,7 @@ def compress_tar(folder_path, output_file):
|
|||||||
def extract_tar(tar_file_path, extract_to):
|
def extract_tar(tar_file_path, extract_to):
|
||||||
#this defines a function to decompress a tar.gz file
|
#this defines a function to decompress a tar.gz file
|
||||||
with tarfile.open(tar_file_path, 'r') as tar:
|
with tarfile.open(tar_file_path, 'r') as tar:
|
||||||
tar.extractall(extract_to)
|
tar.extractall(extract_to, filter="data")
|
||||||
|
|
||||||
def print_ascii_art():
|
def print_ascii_art():
|
||||||
#someone's gonna think im a furry or a femboy or some shit because of this.
|
#someone's gonna think im a furry or a femboy or some shit because of this.
|
||||||
@ -110,79 +112,121 @@ def print_ascii_art():
|
|||||||
print(" ....")
|
print(" ....")
|
||||||
print()
|
print()
|
||||||
|
|
||||||
def checkfor_and_delete_file(filepath):
|
def check_if_exists_and_delete_file(filepath):
|
||||||
#deletes old downloaded mod archives
|
#deletes old downloaded mod archives
|
||||||
if os.path.exists(filepath):
|
if os.path.exists(filepath):
|
||||||
print("Found previously downloaded archive, deleting...")
|
print("Found previously downloaded archive, deleting...")
|
||||||
os.remove(filepath)
|
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!------------------------
|
# --------------------the real shit!------------------------
|
||||||
|
|
||||||
|
|
||||||
|
print("[INFO]: Welcome! Installer Version: 0.1.4")
|
||||||
|
|
||||||
#detect operating system and find home, minecraft, & mod folders
|
#detect operating system and find home, minecraft, & mod folders
|
||||||
homedir = os.path.expanduser("~")
|
homedir = os.path.expanduser("~")
|
||||||
os.chdir(homedir)
|
os.chdir(homedir)
|
||||||
|
|
||||||
global mcfolder
|
global mcfolder
|
||||||
global modfolder
|
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":
|
if platform.system() == "Linux":
|
||||||
print("Operating system detected: Linux")
|
print("[INFO]: Operating system detected: Linux")
|
||||||
os.chdir("/.minecraft")
|
|
||||||
mcfolder = Path.cwd()
|
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/")
|
||||||
|
|
||||||
|
mcfolder = str(Path.cwd())
|
||||||
modfolder = mcfolder + '/mods'
|
modfolder = mcfolder + '/mods'
|
||||||
print("Changed current working directory to '" + str(mcfolder) + "'")
|
print("[INFO]: Changed current working directory to '" + str(mcfolder) + "'")
|
||||||
|
|
||||||
print("Backing up mod folder...")
|
time.sleep(1)
|
||||||
print()
|
print(); print("Backing up minecraft install...")
|
||||||
print("Don't close the window! This'll take a moment...")
|
print("Don't close the window! This'll take a moment...")
|
||||||
compress_tar(mcfolder, "mod-backup.tar.gz")
|
|
||||||
|
compress_tar(mcfolder, "backup.tar.gz")
|
||||||
|
|
||||||
elif platform.system() == "Windows":
|
elif platform.system() == "Windows":
|
||||||
print("Operating system detected: Windows")
|
print("Operating system detected: Windows")
|
||||||
os.chdir("AppData/Roaming/.minecraft")
|
|
||||||
mcfolder = Path.cwd()
|
|
||||||
print("Changed current working directory to '" + str(mcfolder) + "'")
|
|
||||||
|
|
||||||
win_check_folder_exists("mods")
|
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'
|
modfolder = str(mcfolder) + '/mods'
|
||||||
|
compress_tar(mcfolder, "backup.tar.gz")
|
||||||
|
|
||||||
print("Backing up mod folder...")
|
os.chdir(mcfolder)
|
||||||
print()
|
|
||||||
print("Don't close the window! This'll take a moment...")
|
|
||||||
compress_tar(mcfolder, "mod-backup.tar.gz")
|
|
||||||
|
|
||||||
os.chdir(mcfolder)
|
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
# unclear if this timeout is necessary for UX
|
# unclear if this timeout is necessary for UX
|
||||||
|
|
||||||
# clear out preexisting mods
|
# clear out preexisting mods
|
||||||
check_for_old_mod_archive("mods.tar.gz")
|
delete_file("mods.tar.gz")
|
||||||
delete_directory("mods")
|
delete_directory("mods")
|
||||||
print("Deleting mod folder contents... Done.")
|
print("Deleting mod folder contents...")
|
||||||
#shut up
|
|
||||||
os.mkdir(str("mods"))
|
os.mkdir(str("mods"))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# download mod archive from git repo and extract
|
# download mod archive from git repo and extract
|
||||||
print("Fetching mods...")
|
print("Fetching mods...")
|
||||||
wget.download('')
|
|
||||||
# this is insane. `wget` the fucking goat. who knew windows package manager was so cool?
|
|
||||||
|
|
||||||
extract_tar_archive('mods.tar.gz', 'mods')
|
os.environ['SSL_CERT_FILE'] = certifi.where()
|
||||||
# ('tarfile', 'directory to extract to')
|
# this line fixes SSL errors after compiling with PyInstaller as long as certifi is imported alongside it
|
||||||
|
|
||||||
ascii_art()
|
try:
|
||||||
# print boykisser to console
|
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()
|
||||||
|
|
||||||
print("sigma!")
|
extract_tar('mods.tar.gz', 'mods')
|
||||||
print("all done!")
|
# ('tarfile', 'directory to extract to')
|
||||||
|
|
||||||
|
print(""); print("all done!")
|
||||||
print("This window will exit and close in ten seconds. :)")
|
print("This window will exit and close in ten seconds. :)")
|
||||||
time.sleep(10)
|
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
|
||||||
|
time.sleep(1)
|
||||||
|
sys.exit
|
||||||
|
|
||||||
|
|
||||||
# --------------------the real shit!------------------------
|
# --------------------the real shit!------------------------
|
||||||
|
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