2
2
# -*- coding: utf-8 -*-
3
3
# ----------------------
4
4
# About exit codes:
5
- # 1000 : ULS exit normally
5
+ # 0 : ULS exit normally
6
6
# 1001: "/usr/share/uls/device.json" not found.
7
7
# 1002: ULS script path is invalid.
8
8
# 1003: Internet is unavailable for updating.
@@ -24,7 +24,7 @@ def ShowHelp():
24
24
print ("uls --getinfo: Refresh system information." )
25
25
print ("uls --update: Update ULS to latest version." )
26
26
print ("uls [ULS Script Path]: Run ULS script." )
27
- exit (1000 )
27
+ exit (0 )
28
28
29
29
# Getting system information & save to file.
30
30
def GetInfo ():
@@ -147,15 +147,15 @@ def RunScript(strPath):
147
147
148
148
# Check if device.json exists
149
149
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." )
151
151
exit (1001 )
152
152
153
153
# Prepare device.json
154
154
j = json .loads (open ('/usr/share/uls/device.json' , 'r' ).read ())
155
155
156
156
# Check if ULS script exists
157
157
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." )
159
159
exit (1002 )
160
160
161
161
# Read ULS script file
@@ -218,12 +218,12 @@ def Update():
218
218
219
219
# If Internet is unavailable, exit.
220
220
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.' )
222
222
exit (1003 )
223
223
224
224
# Now, do the update
225
225
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 )
227
227
228
228
# Main
229
229
if __name__ == '__main__' :
@@ -238,4 +238,4 @@ def Update():
238
238
Update ()
239
239
else :
240
240
RunScript (sys .argv [1 ])
241
- exit (1000 )
241
+ exit (0 )
0 commit comments