Skip to content

Commit

Permalink
v5: +"sys.osbase", +More!
Browse files Browse the repository at this point in the history
  • Loading branch information
Catboy96 authored Apr 1, 2017
1 parent d34b5ba commit b846900
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions uls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
# ----------------------
# About exit codes:
# 1000: ULS exit normally
# 0: ULS exit normally
# 1001: "/usr/share/uls/device.json" not found.
# 1002: ULS script path is invalid.
# 1003: Internet is unavailable for updating.
Expand All @@ -24,7 +24,7 @@ def ShowHelp():
print("uls --getinfo: Refresh system information.")
print("uls --update: Update ULS to latest version.")
print("uls [ULS Script Path]: Run ULS script.")
exit(1000)
exit(0)

# Getting system information & save to file.
def GetInfo():
Expand Down Expand Up @@ -147,15 +147,15 @@ def RunScript(strPath):

# Check if device.json exists
if not os.path.isfile('/usr/share/uls/device.json'):
print("'device.json' not found. Run 'uls --getinfo' to generate.")
print("ERR_1001: 'device.json' not found. Run 'uls --getinfo' to generate.")
exit(1001)

# Prepare device.json
j = json.loads(open('/usr/share/uls/device.json', 'r').read())

# Check if ULS script exists
if not os.path.isfile(strPath):
print("ULS script not found. Ensure you entered the correct path.")
print("ERR_1002: ULS script path invalid. Ensure you entered the correct path.")
exit(1002)

# Read ULS script file
Expand Down Expand Up @@ -218,12 +218,12 @@ def Update():

# If Internet is unavailable, exit.
if strPing == '1':
print('Internet is unavailable. Check your connection before running update.')
print('ERR_1003: Internet is unavailable. Check your connection before running update.')
exit(1003)

# Now, do the update
os.system("wget -O https://raw.githubusercontent.com/CYRO4S/Universal-Linux-Script/master/uls_update.sh && bash uls_update.sh")
exit(1000)
exit(0)

# Main
if __name__ == '__main__':
Expand All @@ -238,4 +238,4 @@ def Update():
Update()
else:
RunScript(sys.argv[1])
exit(1000)
exit(0)

0 comments on commit b846900

Please sign in to comment.