Skip to content

Commit b846900

Browse files
authored
v5: +"sys.osbase", +More!
1 parent d34b5ba commit b846900

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

uls.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding: utf-8 -*-
33
# ----------------------
44
# About exit codes:
5-
# 1000: ULS exit normally
5+
# 0: ULS exit normally
66
# 1001: "/usr/share/uls/device.json" not found.
77
# 1002: ULS script path is invalid.
88
# 1003: Internet is unavailable for updating.
@@ -24,7 +24,7 @@ def ShowHelp():
2424
print("uls --getinfo: Refresh system information.")
2525
print("uls --update: Update ULS to latest version.")
2626
print("uls [ULS Script Path]: Run ULS script.")
27-
exit(1000)
27+
exit(0)
2828

2929
# Getting system information & save to file.
3030
def GetInfo():
@@ -147,15 +147,15 @@ def RunScript(strPath):
147147

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

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

156156
# Check if ULS script exists
157157
if not os.path.isfile(strPath):
158-
print("ULS script not found. Ensure you entered the correct path.")
158+
print("ERR_1002: ULS script path invalid. Ensure you entered the correct path.")
159159
exit(1002)
160160

161161
# Read ULS script file
@@ -218,12 +218,12 @@ def Update():
218218

219219
# If Internet is unavailable, exit.
220220
if strPing == '1':
221-
print('Internet is unavailable. Check your connection before running update.')
221+
print('ERR_1003: Internet is unavailable. Check your connection before running update.')
222222
exit(1003)
223223

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

228228
# Main
229229
if __name__ == '__main__':
@@ -238,4 +238,4 @@ def Update():
238238
Update()
239239
else:
240240
RunScript(sys.argv[1])
241-
exit(1000)
241+
exit(0)

0 commit comments

Comments
 (0)