1 | #!/usr/bin/env python |
---|
2 | |
---|
3 | from clint import arguments |
---|
4 | from clint.textui import puts, indent, colored |
---|
5 | import lliurex.lliurexup |
---|
6 | import os |
---|
7 | import subprocess |
---|
8 | import sys |
---|
9 | import commands |
---|
10 | import datetime |
---|
11 | import time |
---|
12 | import signal |
---|
13 | signal.signal(signal.SIGINT,signal.SIG_IGN) |
---|
14 | |
---|
15 | class LliurexUpCli(object): |
---|
16 | def __init__(self): |
---|
17 | |
---|
18 | |
---|
19 | self.lliurexcore = lliurex.lliurexup.LliurexUpCore() |
---|
20 | log_msg="------------------------------------------\n"+"LLIUREX-UP-CLI STARTING AT: " + datetime.datetime.today().strftime("%d/%m/%y %H:%M:%S") +"\n------------------------------------------" |
---|
21 | self.log(log_msg) |
---|
22 | signal.signal(signal.SIGINT,self.handler_signal) |
---|
23 | self.checkInitialFlavour() |
---|
24 | |
---|
25 | #def __init__ |
---|
26 | |
---|
27 | def checkInitialFlavour(self): |
---|
28 | |
---|
29 | self.targetMetapackage=self.lliurexcore.checkInitialFlavour() |
---|
30 | log_msg="Initial check metapackage. Metapackage to install: " + str(self.targetMetapackage) |
---|
31 | self.log(log_msg) |
---|
32 | log_msg="Get initial flavours: " + str(self.lliurexcore.previousFlavours) |
---|
33 | self.log(log_msg) |
---|
34 | |
---|
35 | #def checkInitialFlavour |
---|
36 | |
---|
37 | |
---|
38 | def canConnectToLliurexNet(self): |
---|
39 | |
---|
40 | print(" [Lliurex-up]: Checking connection to lliurex.net") |
---|
41 | can_connect=self.lliurexcore.canConnectToLliurexNet() |
---|
42 | if can_connect: |
---|
43 | log_msg="Can connect to lliurex.net: True" |
---|
44 | self.log(log_msg) |
---|
45 | return True |
---|
46 | else: |
---|
47 | log_msg="Can connect to lliurex.net: False" |
---|
48 | self.log(log_msg) |
---|
49 | |
---|
50 | if "lliurex-meta-server" == self.targetMetapackage or "server" in self.lliurexcore.previousFlavours: |
---|
51 | self.lliurexcore.cleanEnvironment() |
---|
52 | self.lliurexcore.cleanLliurexUpLock() |
---|
53 | return False |
---|
54 | else: |
---|
55 | return True |
---|
56 | |
---|
57 | #def canConnectToLliurexNet |
---|
58 | |
---|
59 | def clientCheckingMirrorIsRunning(self): |
---|
60 | |
---|
61 | is_mirror_running_inserver=self.lliurexcore.clientCheckingMirrorIsRunning() |
---|
62 | |
---|
63 | if is_mirror_running_inserver['ismirrorrunning'] ==None: |
---|
64 | log_msg="Checking if mirror in server is being updated. Error: " + str(is_mirror_running_inserver['exception']) |
---|
65 | self.log(log_msg) |
---|
66 | else: |
---|
67 | if is_mirror_running_inserver['ismirrorrunning']: |
---|
68 | log_msg="Mirror is being udpated in server. Unable to update the system" |
---|
69 | self.log(log_msg) |
---|
70 | |
---|
71 | return is_mirror_running_inserver['ismirrorrunning'] |
---|
72 | |
---|
73 | |
---|
74 | #def clientCheckingMirrorIsRunning |
---|
75 | |
---|
76 | def initActionsScript(self,extra_args): |
---|
77 | |
---|
78 | print(" [Lliurex-up]: Checking system") |
---|
79 | |
---|
80 | if extra_args["unattendend_upgrade"]: |
---|
81 | command="DEBIAN_FRONTEND=noninteractive " + self.lliurexcore.initActionsScript(self.initActionsArg) |
---|
82 | |
---|
83 | else: |
---|
84 | command=self.lliurexcore.initActionsScript(self.initActionsArg) |
---|
85 | |
---|
86 | try: |
---|
87 | #os.system(command) |
---|
88 | subprocess.Popen(command,shell=True).communicate() |
---|
89 | log_msg="Exec Init-Actions" |
---|
90 | self.log(log_msg) |
---|
91 | except Exception as e: |
---|
92 | log_msg="Exec Init-Actions.Error: " +str(e) |
---|
93 | self.log(log_msg) |
---|
94 | print e |
---|
95 | |
---|
96 | #def initActionsScript |
---|
97 | |
---|
98 | def checkLliurexUp(self): |
---|
99 | |
---|
100 | print(" [Lliurex-up]: Looking for new version of Lliurex Up") |
---|
101 | |
---|
102 | is_lliurexup_updated=self.lliurexcore.isLliurexUpIsUpdated() |
---|
103 | |
---|
104 | |
---|
105 | if not is_lliurexup_updated: |
---|
106 | print (" [Lliurex-up]: Updating Lliurex Up") |
---|
107 | is_lliurexup_installed=self.lliurexcore.installLliurexUp() |
---|
108 | log_msg="Installing lliurex-up. Returncode: " + str(is_lliurexup_installed['returncode']) + ". Error: " + str(is_lliurexup_installed['stderrs']) |
---|
109 | self.log(log_msg) |
---|
110 | print (" [Lliurex-up]: Lliurex Up is now udpate and will be reboot now" ) |
---|
111 | time.sleep(3) |
---|
112 | self.lliurexcore.cleanLliurexUpLock() |
---|
113 | os.execv("/usr/sbin/lliurex-upgrade",sys.argv) |
---|
114 | |
---|
115 | else: |
---|
116 | log_msg="Checking lliurex-up. Is lliurex-up updated: "+ str(is_lliurexup_updated) |
---|
117 | self.log(log_msg) |
---|
118 | print (" [Lliurex-up]: Lliurex Up is updated.Nothing to do") |
---|
119 | |
---|
120 | #def checkLliurexUp |
---|
121 | |
---|
122 | def checkMirror(self,extra_args=None): |
---|
123 | |
---|
124 | print(" [Lliurex-up]: Checking if mirror is updated") |
---|
125 | |
---|
126 | is_mirror_updated=self.lliurexcore.lliurexMirrorIsUpdated() |
---|
127 | |
---|
128 | if is_mirror_updated !=None: |
---|
129 | is_mirror_running=self.lliurexcore.lliurexMirrorIsRunning() |
---|
130 | if is_mirror_running: |
---|
131 | print(" [Lliurex-up]: Updating mirror. Wait a moment please") |
---|
132 | command='lliurex-mirror update llx16' |
---|
133 | #os.system(command) |
---|
134 | subprocess.Popen(command,shell=True).communicate() |
---|
135 | |
---|
136 | else: |
---|
137 | if is_mirror_updated['action']=='update': |
---|
138 | log_msg="Checking mirror. Is mirror update: False" |
---|
139 | self.log(log_msg) |
---|
140 | if not is_mirror_running: |
---|
141 | if not extra_args["unattended_mirror"]: |
---|
142 | response=raw_input(' [LLiurex-up]: Do you want update mirror (yes/no): ').lower() |
---|
143 | else: |
---|
144 | response="yes" |
---|
145 | |
---|
146 | if response.startswith('y'): |
---|
147 | log_msg="Update lliurex-mirror: Yes" |
---|
148 | self.log(log_msg) |
---|
149 | print(" [Lliurex-up]: Updating mirror. Wait a moment please") |
---|
150 | command='lliurex-mirror update llx16' |
---|
151 | #os.system(command) |
---|
152 | subprocess.Popen(command,shell=True).communicate() |
---|
153 | |
---|
154 | else: |
---|
155 | log_msg="Update lliurex-mirror: No" |
---|
156 | self.log(log_msg) |
---|
157 | print(" [Lliurex-up]: Mirror update.Nothing to do") |
---|
158 | else: |
---|
159 | log_msg="Checking mirror. Is mirror update: None" |
---|
160 | self.log(log_msg) |
---|
161 | print(" [Lliurex-up]: Nothing to do with mirror") |
---|
162 | |
---|
163 | #def checkMirror |
---|
164 | |
---|
165 | def getLliurexVersionLocal(self): |
---|
166 | |
---|
167 | print(" [Lliurex-up]: Looking for LliurexVersion from local repository") |
---|
168 | |
---|
169 | self.version_update=self.lliurexcore.getLliurexVersionLocal() |
---|
170 | log_msg="Get LliurexVersion installed: " + str(self.version_update["installed"]) |
---|
171 | self.log(log_msg) |
---|
172 | log_msg="Get LliurexVersion candidate from Local repository: " + str(self.version_update["candidate"]) |
---|
173 | self.log(log_msg) |
---|
174 | |
---|
175 | #def getLliurexVersionLocal |
---|
176 | |
---|
177 | |
---|
178 | def getLliurexVersionLliurexNet(self): |
---|
179 | |
---|
180 | print(" [Lliurex-up]: Looking for LliurexVersion from lliurex.net") |
---|
181 | |
---|
182 | self.version_available=self.lliurexcore.getLliurexVersionLliurexNet() |
---|
183 | log_msg="Get LliurexVersion candidate from Lliurex Net: " + str(self.version_available["candidate"]) |
---|
184 | self.log(log_msg) |
---|
185 | |
---|
186 | #def getLliurexVersionLliurexNet |
---|
187 | |
---|
188 | def checkingInitialFlavourToInstall(self): |
---|
189 | |
---|
190 | print(" [Lliurex-up]: Checking if installation of metapackage is required") |
---|
191 | |
---|
192 | self.returncode_initflavour=0 |
---|
193 | |
---|
194 | if self.targetMetapackage == None: |
---|
195 | |
---|
196 | print " [Lliurex-up]: Installation of metapackage is not required" |
---|
197 | |
---|
198 | else: |
---|
199 | print " [Lliurex-up]: Installation of metapackage is required: " + str(self.targetMetapackage) |
---|
200 | is_flavour_installed=self.lliurexcore.installInitialFlavour(self.targetMetapackage) |
---|
201 | self.returncode_initflavour=is_flavour_installed['returncode'] |
---|
202 | error=is_flavour_installed['stderrs'] |
---|
203 | log_msg="Install initial metapackage:" + self.targetMetapackage + ": Returncode: " + str(self.returncode_initflavour) + " Error: " + str(error) |
---|
204 | self.log(log_msg) |
---|
205 | print " [Lliurex-up]: Metapackage is now installed: " + str(self.returncode_initflavour) + " Error: " + str(error) |
---|
206 | |
---|
207 | #def checkingInitialFlavourToInstall |
---|
208 | |
---|
209 | def getPackagesToUpdate(self): |
---|
210 | |
---|
211 | print(" [Lliurex-up]: Looking for new updates") |
---|
212 | packages=self.lliurexcore.getPackagesToUpdate() |
---|
213 | log_msg="Get packages to update. Number of packages: "+ str(len(packages)) |
---|
214 | self.log(log_msg) |
---|
215 | |
---|
216 | self.newpackages=0 |
---|
217 | self.listpackages="" |
---|
218 | if (len(packages))>0: |
---|
219 | for item in packages: |
---|
220 | if packages[item]["install"]==None: |
---|
221 | self.newpackages=int(self.newpackages) + 1 |
---|
222 | self.listpackages=str(self.listpackages) + item +" " |
---|
223 | |
---|
224 | return packages |
---|
225 | |
---|
226 | #def getPackagesToUpdate |
---|
227 | |
---|
228 | def checkingIncorrectFlavours(self): |
---|
229 | |
---|
230 | incorrectFlavours=self.lliurexcore.checkIncorrectFlavours() |
---|
231 | log_msg="Checking incorrect metapackages. Others metapackages detected: " + str(incorrectFlavours) |
---|
232 | self.log(log_msg) |
---|
233 | |
---|
234 | return incorrectFlavours |
---|
235 | |
---|
236 | #def checkingIncorrectFlavours |
---|
237 | |
---|
238 | def checkPreviousUpgrade(self): |
---|
239 | |
---|
240 | error=False |
---|
241 | if self.returncode_initflavour!=0: |
---|
242 | error=True |
---|
243 | |
---|
244 | else: |
---|
245 | if self.version_update["candidate"]!=None: |
---|
246 | if self.version_update["installed"]!=self.version_update["candidate"]: |
---|
247 | error=True |
---|
248 | else: |
---|
249 | if self.version_update["installed"]!=self.version_available["candidate"]: |
---|
250 | error=True |
---|
251 | |
---|
252 | return error |
---|
253 | |
---|
254 | #def checkPreviousUpgrade |
---|
255 | |
---|
256 | def preActionsScript(self,extra_args): |
---|
257 | |
---|
258 | print(" [Lliurex-up]: Preparing system to update") |
---|
259 | |
---|
260 | if extra_args["unattendend_upgrade"]: |
---|
261 | command="DEBIAN_FRONTEND=noninteractive " + self.lliurexcore.preActionsScript() |
---|
262 | else: |
---|
263 | command=self.lliurexcore.preActionsScript() |
---|
264 | |
---|
265 | try: |
---|
266 | #os.system(command) |
---|
267 | subprocess.Popen(command,shell=True).communicate() |
---|
268 | log_msg="Exec Pre-Actions" |
---|
269 | self.log(log_msg) |
---|
270 | |
---|
271 | except Exception as e: |
---|
272 | log_msg="Exec Pre-Actions. Error " +str(e) |
---|
273 | self.log(log_msg) |
---|
274 | print e |
---|
275 | |
---|
276 | #def preActionsScript |
---|
277 | |
---|
278 | def distUpgrade(self,extra_args): |
---|
279 | |
---|
280 | print(" [Lliurex-up]: Downloading and installing packages") |
---|
281 | |
---|
282 | if extra_args["unattendend_upgrade"]: |
---|
283 | command="DEBIAN_FRONTEND=noninteractive " + self.lliurexcore.distUpgradeProcess() |
---|
284 | else: |
---|
285 | command=self.lliurexcore.distUpgradeProcess() |
---|
286 | |
---|
287 | try: |
---|
288 | #os.system(command) |
---|
289 | subprocess.Popen(command,shell=True).communicate() |
---|
290 | log_msg="Exec Dist-uggrade" |
---|
291 | self.log(log_msg) |
---|
292 | |
---|
293 | except Exception as e: |
---|
294 | log_msg="Exec Dist-uggrade.Error : " +str(e) |
---|
295 | self.log(log_msg) |
---|
296 | print e |
---|
297 | |
---|
298 | #def distUpgrade |
---|
299 | |
---|
300 | def postActionsScript(self,extra_args): |
---|
301 | |
---|
302 | print(" [Lliurex-up]: Ending the update") |
---|
303 | |
---|
304 | if extra_args["unattendend_upgrade"]: |
---|
305 | command="DEBIAN_FRONTEND=noninteractive " + self.lliurexcore.postActionsScript()+'| tee ' + self.lliurexcore.errorpostaction_token |
---|
306 | else: |
---|
307 | command=self.lliurexcore.postActionsScript()+'| tee ' + self.lliurexcore.errorpostaction_token |
---|
308 | |
---|
309 | try: |
---|
310 | subprocess.Popen(command,shell=True).communicate() |
---|
311 | #os.system(command) |
---|
312 | log_msg="Exec Post-Actions" |
---|
313 | self.log(log_msg) |
---|
314 | except Exception as e: |
---|
315 | print e |
---|
316 | |
---|
317 | #def postActionsScript |
---|
318 | |
---|
319 | |
---|
320 | def checkingFinalFlavourToInstall(self): |
---|
321 | |
---|
322 | print(" [Lliurex-up]: Checking final metapackage") |
---|
323 | |
---|
324 | #self.flavourToInstall=self.lliurexcore.checkFinalFlavour() |
---|
325 | self.flavourToInstall=self.lliurexcore.checkFlavour() |
---|
326 | |
---|
327 | log_msg="Final check metapackage. Metapackage to install: " + str(self.flavourToInstall) |
---|
328 | self.log(log_msg) |
---|
329 | |
---|
330 | if self.flavourToInstall!=None: |
---|
331 | print (" [Lliurex-up]: Install of metapackage is required: " + str(self.flavourToInstall)) |
---|
332 | |
---|
333 | command=self.lliurexcore.installFinalFlavour(self.flavourToInstall) |
---|
334 | try: |
---|
335 | #os.system(command) |
---|
336 | subprocess.Popen(command,shell=True).communicate() |
---|
337 | |
---|
338 | except Exception as e: |
---|
339 | print e |
---|
340 | else: |
---|
341 | print (" [Lliurex-up]: Metapackage is correct. Nothing to do") |
---|
342 | |
---|
343 | #def checkingFinalFlavourToInstall |
---|
344 | |
---|
345 | def checkFinalUpgrade(self): |
---|
346 | |
---|
347 | print(" [Lliurex-up]: Checking Dist-upgrade ") |
---|
348 | error=self.lliurexcore.checkErrorDistUpgrade() |
---|
349 | |
---|
350 | if error: |
---|
351 | print(" [Lliurex-up]: The updated process is endend with errors") |
---|
352 | log_msg="Dist-upgrade process ending with errors" |
---|
353 | |
---|
354 | else: |
---|
355 | print(" [Lliurex-up]: The system is now update") |
---|
356 | log_msg="Dist-upgrade process ending OK" |
---|
357 | |
---|
358 | self.log(log_msg) |
---|
359 | |
---|
360 | #def checkFinalUpgrade |
---|
361 | |
---|
362 | def handler_signal(self,signal,frame): |
---|
363 | |
---|
364 | print("\n [Lliurex-up]: Cancel process with Ctr+c signal") |
---|
365 | log_msg="Cancel process with Ctr+c signal" |
---|
366 | self.log(log_msg) |
---|
367 | self.lliurexcore.cleanEnvironment() |
---|
368 | self.lliurexcore.cleanLliurexUpLock() |
---|
369 | sys.exit(1) |
---|
370 | |
---|
371 | #def handler_signal |
---|
372 | |
---|
373 | def log(self,msg): |
---|
374 | |
---|
375 | log_file="/var/log/lliurex-up.log" |
---|
376 | f=open(log_file,"a+") |
---|
377 | f.write(msg + '\n') |
---|
378 | f.close() |
---|
379 | |
---|
380 | #def log |
---|
381 | |
---|
382 | |
---|
383 | def main(self,mode,extra_args=None): |
---|
384 | |
---|
385 | if mode=="sai": |
---|
386 | self.initActionsArg="initActionsSai" |
---|
387 | |
---|
388 | else: |
---|
389 | mode="nomal" |
---|
390 | self.initActionsArg="initActions" |
---|
391 | |
---|
392 | log_msg="Mode of execution: " + str(mode) |
---|
393 | self.log(log_msg) |
---|
394 | log_msg="Extra args: " + str(extra_args) |
---|
395 | self.log(log_msg) |
---|
396 | |
---|
397 | if not self.canConnectToLliurexNet(): |
---|
398 | print(" [Lliurex-up]: Unable to connect to lliurex.net") |
---|
399 | self.lliurexcore.cleanEnvironment() |
---|
400 | self.lliurexcore.cleanLliurexUpLock() |
---|
401 | return 1 |
---|
402 | |
---|
403 | clientCheckingMirror=self.clientCheckingMirrorIsRunning() |
---|
404 | if clientCheckingMirror!=False: |
---|
405 | if clientCheckingMirror: |
---|
406 | print(" [Lliurex-up]: Mirror is being udpated in server. Unable to update the system") |
---|
407 | else: |
---|
408 | print(" [Lliurex-up]: Unable to connect with server") |
---|
409 | |
---|
410 | self.lliurexcore.cleanEnvironment() |
---|
411 | self.lliurexcore.cleanLliurexUpLock() |
---|
412 | return 1 |
---|
413 | |
---|
414 | self.initActionsScript(extra_args) |
---|
415 | self.checkLliurexUp() |
---|
416 | |
---|
417 | if extra_args["mirror"]: |
---|
418 | self.checkMirror(extra_args) |
---|
419 | |
---|
420 | self.getLliurexVersionLocal() |
---|
421 | self.getLliurexVersionLliurexNet() |
---|
422 | self.checkingInitialFlavourToInstall() |
---|
423 | self.packages=self.getPackagesToUpdate() |
---|
424 | |
---|
425 | if len(self.packages)>0: |
---|
426 | if not self.checkingIncorrectFlavours(): |
---|
427 | print self.listpackages |
---|
428 | print(" [Lliurex-up]: Number of packages to update: " + str(len(self.packages)) + " (" + str(self.newpackages) + " news)" ) |
---|
429 | if not extra_args["unattendend_upgrade"]: |
---|
430 | response=raw_input(' [LLiurex-up]: Do you want to update the system (yes/no)): ').lower() |
---|
431 | else: |
---|
432 | response="yes" |
---|
433 | |
---|
434 | if response.startswith('y'): |
---|
435 | self.preActionsScript(extra_args) |
---|
436 | self.distUpgrade(extra_args) |
---|
437 | self.postActionsScript(extra_args) |
---|
438 | self.checkingFinalFlavourToInstall() |
---|
439 | self.checkFinalUpgrade() |
---|
440 | self.lliurexcore.cleanEnvironment() |
---|
441 | self.lliurexcore.cleanLliurexUpLock() |
---|
442 | |
---|
443 | |
---|
444 | else: |
---|
445 | log_msg="Cancel the update" |
---|
446 | self.log(log_msg) |
---|
447 | print(" [Lliurex-up]: Cancel the update") |
---|
448 | self.lliurexcore.cleanEnvironment() |
---|
449 | self.lliurexcore.cleanLliurexUpLock() |
---|
450 | |
---|
451 | return 0 |
---|
452 | else: |
---|
453 | print("[Lliurex-up]: Updated abort for incorrect flavours detected in new update") |
---|
454 | self.lliurexcore.cleanEnvironment() |
---|
455 | self.lliurexcore.cleanLliurexUpLock() |
---|
456 | |
---|
457 | return 1 |
---|
458 | else: |
---|
459 | if not self.checkPreviousUpgrade(): |
---|
460 | print(" [Lliurex-up]: Your systems is updated. Nothing to do") |
---|
461 | self.lliurexcore.cleanEnvironment() |
---|
462 | self.lliurexcore.cleanLliurexUpLock() |
---|
463 | |
---|
464 | return 0 |
---|
465 | else: |
---|
466 | print(" [Lliurex-up]: Updated abort. An error occurred checking new updates") |
---|
467 | self.lliurexcore.cleanEnvironment() |
---|
468 | self.lliurexcore.cleanLliurexUpLock() |
---|
469 | |
---|
470 | return 1 |
---|
471 | #def main |
---|
472 | |
---|
473 | |
---|
474 | def usage(): |
---|
475 | puts("Usage") |
---|
476 | with indent(4): |
---|
477 | puts("lliurex-upgrade [FLAGS...]") |
---|
478 | puts("Flags") |
---|
479 | with indent(4): |
---|
480 | puts("-h --help: Show help") |
---|
481 | puts("-s --sai: Update the system without pinning") |
---|
482 | puts("-u --unattended: Update the system in unattended mode. Does not require confirmation to update mirror and system") |
---|
483 | puts("-n --no-mirror: Update the system without checking mirror") |
---|
484 | |
---|
485 | sys.exit(1) |
---|
486 | |
---|
487 | #def usage |
---|
488 | |
---|
489 | def free_space_check(): |
---|
490 | |
---|
491 | if ((os.statvfs("/").f_bfree * os.statvfs("/").f_bsize) / (1024*1024*1024)) < 2: #less than 2GB available? |
---|
492 | print " [Lliurex-up]: There's not enough space on disk to upgrade (2 GB needed)" |
---|
493 | |
---|
494 | sys.exit(1) |
---|
495 | |
---|
496 | #def free_space_check |
---|
497 | |
---|
498 | def islliurexup_running(): |
---|
499 | |
---|
500 | if os.path.exists('/var/run/lliurexUp.lock'): |
---|
501 | print " [Lliurex-up]: Lliurex Up is now running " |
---|
502 | sys.exit(1) |
---|
503 | |
---|
504 | #def isllliurexup_running |
---|
505 | |
---|
506 | |
---|
507 | if __name__ == '__main__': |
---|
508 | if os.geteuid() != 0: |
---|
509 | print " [Lliurex-up]: You need be root!" |
---|
510 | sys.exit(1) |
---|
511 | |
---|
512 | islliurexup_running() |
---|
513 | free_space_check() |
---|
514 | mode=None |
---|
515 | options=0 |
---|
516 | extra_args={} |
---|
517 | extra_args["mirror"]=True |
---|
518 | extra_args["unattended_mirror"]=False |
---|
519 | extra_args["unattendend_upgrade"]=False |
---|
520 | |
---|
521 | args=arguments.Args().copy |
---|
522 | |
---|
523 | if args.contains(["-h", "--help"]): |
---|
524 | usage() |
---|
525 | |
---|
526 | if args.contains(["-s", "--sai"]): |
---|
527 | mode="sai" |
---|
528 | options=1 |
---|
529 | |
---|
530 | if args.contains(["-u", "--unattended"]): |
---|
531 | extra_args["unattendend_upgrade"]=True |
---|
532 | extra_args["unattended_mirror"]=True |
---|
533 | options=1 |
---|
534 | |
---|
535 | if args.contains(["-n", "--no-mirror"]): |
---|
536 | extra_args["mirror"]=False |
---|
537 | options=1 |
---|
538 | else: |
---|
539 | if len(args)>0 and options==0: |
---|
540 | usage() |
---|
541 | |
---|
542 | lliurexupcli = LliurexUpCli() |
---|
543 | sys.exit(lliurexupcli.main(mode,extra_args)) |
---|