Skip to content

Commit

Permalink
new fixes and upgrading system
Browse files Browse the repository at this point in the history
  • Loading branch information
Linkus authored and Linkus committed Jun 4, 2021
1 parent bf7cba0 commit c408d4a
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 72 deletions.
1 change: 0 additions & 1 deletion installed.json

This file was deleted.

Binary file removed nano
Binary file not shown.
1 change: 0 additions & 1 deletion pain.json

This file was deleted.

33 changes: 26 additions & 7 deletions spark
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,8 @@ def install(package,force=False, spec_ver=None):
if dpack == None:
print("Could not install {} :/".format(dep))
quit()
get_src(dpack['url'],dep)
unpack(dep)
local = get_src(dpack['url'],dep,dpack['version'])
unpack(dep,local)
build(dep,dpack['build'])
#print(dep,dpack)
if spec:
Expand All @@ -532,8 +532,8 @@ def install(package,force=False, spec_ver=None):
add_installed(dep)
#input()
if 'url' in pack:
get_src(pack['url'],package)
unpack(package)
local = get_src(pack['url'],package,pack['version'])
unpack(package,local)
build(package,pack['build'])
else:
print("Detected a test package! Skipping download. Building...")
Expand Down Expand Up @@ -624,14 +624,22 @@ def uninstall(package,force=False):


# Get package source
def get_src(uri,packname):
def get_src(uri,packname,version):
print("Checking if source is available locally ...",end=" ")
inst = glob.glob("/usr/spark/tmp/"+packname+"*")
if inst:
print(valid+"✔"+reset)
if version in inst[0]:
return "local"
print("Downloading source from ",uri,"...")
os.system("cd /usr/spark/tmp && rm -r "+packname+"* > /dev/null")
os.system("cd /usr/spark/tmp && wget -q "+uri)
return None

def unpack(packname):
def unpack(packname,local):
os.system("cd /usr/spark/tmp")
os.system("cd /usr/spark/tmp && tar xf "+packname+"*")
if not local:
os.system("cd /usr/spark/tmp && tar xf "+packname+"*")
os.system("mkdir -p ~/.local/_dist")
os.system("rm -r ~/.local/_dist/"+packname)
os.system("mkdir -p ~/.local/_dist/"+packname)
Expand Down Expand Up @@ -836,6 +844,14 @@ def list_versions(name):
print('version|size')
print(bit,'\t',pack['altver'][bit]['size'])

def update_spark():
version = check_installed("spark")
add_installed("spark",version)
os.system(f"cd /usr/spark/ && rm -r spark && wget https://github.com/HUSKI3/Spark/releases/download/{version}/spark > /dev/null && chmod +x spark")
os.system("rm -rf /bin/spark")
os.system("ln -sf /usr/spark/spark /bin/spark")


def main(*argv):
# Check arguments
argv=argv[0]
Expand Down Expand Up @@ -868,6 +884,9 @@ def main(*argv):
elif "-u" in argv or "update" in argv:
run_checks()
update()
elif "-up" in argv or "upgrade" in argv:
run_checks()
update_spark()
elif "-d" in argv or "dimension" in argv:
run_checks()
add_dimension(argv[-1])
Expand Down
63 changes: 0 additions & 63 deletions system.py

This file was deleted.

0 comments on commit c408d4a

Please sign in to comment.