|
|
102e92 |
diff -up yum-3.4.3/docs/yum.conf.5.orig yum-3.4.3/docs/yum.conf.5
|
|
|
102e92 |
--- yum-3.4.3/docs/yum.conf.5.orig 2017-11-24 20:52:02.648462776 +0100
|
|
|
102e92 |
+++ yum-3.4.3/docs/yum.conf.5 2017-11-24 20:52:18.483380945 +0100
|
|
|
102e92 |
@@ -1016,6 +1016,15 @@ If set to False, 'yum update' will fail
|
|
|
102e92 |
names (package, group, rpm file). It will also fail if the provided name is a package
|
|
|
102e92 |
which is available, but not installed. Boolean (1, 0, True, False, yes, no). Defaults to True.
|
|
|
102e92 |
|
|
|
102e92 |
+.IP
|
|
|
102e92 |
+\fBshell_exit_status\fR
|
|
|
102e92 |
+Determines the exit status that should be returned by `yum shell' when it
|
|
|
102e92 |
+terminates after reading the `exit' command or EOF.
|
|
|
102e92 |
+Possible values are: 0, ?.
|
|
|
102e92 |
+If ? is set, the exit status is that of the last command executed before `exit'
|
|
|
102e92 |
+(bash-like behavior).
|
|
|
102e92 |
+Defaults to 0.
|
|
|
102e92 |
+
|
|
|
102e92 |
.SH "[repository] OPTIONS"
|
|
|
102e92 |
.LP
|
|
|
102e92 |
The repository section(s) take the following form:
|
|
|
102e92 |
diff -up yum-3.4.3/docs/yum-shell.8.orig yum-3.4.3/docs/yum-shell.8
|
|
|
102e92 |
--- yum-3.4.3/docs/yum-shell.8.orig 2011-06-28 22:27:22.000000000 +0200
|
|
|
102e92 |
+++ yum-3.4.3/docs/yum-shell.8 2017-11-24 20:52:18.483380945 +0100
|
|
|
102e92 |
@@ -31,6 +31,12 @@ information. There are a few additional
|
|
|
102e92 |
reset: reset (zero-out) the transaction
|
|
|
102e92 |
solve: run the dependency solver on the transaction
|
|
|
102e92 |
run: run the transaction
|
|
|
102e92 |
+.IP
|
|
|
102e92 |
+.IP "\fBexit\fP"
|
|
|
102e92 |
+ Causes the shell to exit, setting the exit status as specified by the
|
|
|
102e92 |
+ \fBshell_exit_status\fR option in \fIyum.conf(5)\fR.
|
|
|
102e92 |
+ This command is also triggered when EOF is read (usually the C-d keystroke
|
|
|
102e92 |
+ or end of script).
|
|
|
102e92 |
|
|
|
102e92 |
.PP
|
|
|
102e92 |
.SH "Examples"
|
|
|
102e92 |
diff -up yum-3.4.3/shell.py.orig yum-3.4.3/shell.py
|
|
|
102e92 |
--- yum-3.4.3/shell.py.orig 2017-11-24 20:52:02.580463129 +0100
|
|
|
102e92 |
+++ yum-3.4.3/shell.py 2017-11-24 20:52:18.483380945 +0100
|
|
|
102e92 |
@@ -126,6 +126,7 @@ class YumShell(cmd.Cmd):
|
|
|
102e92 |
|
|
|
102e92 |
:param line: the next line of input
|
|
|
102e92 |
"""
|
|
|
102e92 |
+ self.result = 0
|
|
|
102e92 |
if len(line) > 0 and line.strip()[0] == '#':
|
|
|
102e92 |
pass
|
|
|
102e92 |
else:
|
|
|
102e92 |
@@ -150,7 +151,8 @@ class YumShell(cmd.Cmd):
|
|
|
102e92 |
except Errors.YumBaseError:
|
|
|
102e92 |
pass
|
|
|
102e92 |
else:
|
|
|
102e92 |
- self.base.doCommands()
|
|
|
102e92 |
+ result, _ = self.base.doCommands()
|
|
|
102e92 |
+ self.result = result
|
|
|
102e92 |
|
|
|
102e92 |
def emptyline(self):
|
|
|
102e92 |
"""Do nothing on an empty line of input."""
|
|
|
102e92 |
@@ -211,13 +213,14 @@ class YumShell(cmd.Cmd):
|
|
|
102e92 |
self.base.shellUsage()
|
|
|
102e92 |
|
|
|
102e92 |
self.verbose_logger.info(msg)
|
|
|
102e92 |
+ self.result = 0
|
|
|
102e92 |
|
|
|
102e92 |
def do_EOF(self, line):
|
|
|
102e92 |
"""Exit the shell when EOF is reached.
|
|
|
102e92 |
|
|
|
102e92 |
:param line: unused
|
|
|
102e92 |
"""
|
|
|
102e92 |
- self.resultmsgs = ['Leaving Shell']
|
|
|
102e92 |
+ self.do_exit(line)
|
|
|
102e92 |
return True
|
|
|
102e92 |
|
|
|
102e92 |
def do_quit(self, line):
|
|
|
102e92 |
@@ -225,7 +228,7 @@ class YumShell(cmd.Cmd):
|
|
|
102e92 |
|
|
|
102e92 |
:param line: unused
|
|
|
102e92 |
"""
|
|
|
102e92 |
- self.resultmsgs = ['Leaving Shell']
|
|
|
102e92 |
+ self.do_exit(line)
|
|
|
102e92 |
return True
|
|
|
102e92 |
|
|
|
102e92 |
def do_exit(self, line):
|
|
|
102e92 |
@@ -233,6 +236,9 @@ class YumShell(cmd.Cmd):
|
|
|
102e92 |
|
|
|
102e92 |
:param line: unused
|
|
|
102e92 |
"""
|
|
|
102e92 |
+ # Make sure we don't go onto the next stage in yummain (result == 2)
|
|
|
102e92 |
+ if self.base.conf.shell_exit_status == '0' or self.result == 2:
|
|
|
102e92 |
+ self.result = 0
|
|
|
102e92 |
self.resultmsgs = ['Leaving Shell']
|
|
|
102e92 |
return True
|
|
|
102e92 |
|
|
|
102e92 |
@@ -254,6 +260,7 @@ class YumShell(cmd.Cmd):
|
|
|
102e92 |
:param line: the remainder of the line, containing the name of
|
|
|
102e92 |
a subcommand. If no subcommand is given, run the list subcommand.
|
|
|
102e92 |
"""
|
|
|
102e92 |
+ self.result = 0
|
|
|
102e92 |
(cmd, args, line) = self.parseline(line)
|
|
|
102e92 |
if cmd in ['list', None]:
|
|
|
102e92 |
self.verbose_logger.log(logginglevels.INFO_2,
|
|
|
102e92 |
@@ -267,11 +274,13 @@ class YumShell(cmd.Cmd):
|
|
|
102e92 |
(code, msgs) = self.base.buildTransaction()
|
|
|
102e92 |
except Errors.YumBaseError, e:
|
|
|
102e92 |
self.logger.critical('Error building transaction: %s', e)
|
|
|
102e92 |
+ self.result = 1
|
|
|
102e92 |
return False
|
|
|
102e92 |
|
|
|
102e92 |
if code == 1:
|
|
|
102e92 |
for msg in msgs:
|
|
|
102e92 |
self.logger.critical('Error: %s', msg)
|
|
|
102e92 |
+ self.result = 1
|
|
|
102e92 |
else:
|
|
|
102e92 |
self.verbose_logger.log(logginglevels.INFO_2,
|
|
|
102e92 |
'Success resolving dependencies')
|
|
|
102e92 |
@@ -292,6 +301,7 @@ class YumShell(cmd.Cmd):
|
|
|
102e92 |
value is given, print the current value. If a value is
|
|
|
102e92 |
supplied, set the option to the given value.
|
|
|
102e92 |
"""
|
|
|
102e92 |
+ self.result = 0
|
|
|
102e92 |
(cmd, args, line) = self.parseline(line)
|
|
|
102e92 |
# logs
|
|
|
102e92 |
if cmd in ['debuglevel', 'errorlevel']:
|
|
|
102e92 |
@@ -305,6 +315,7 @@ class YumShell(cmd.Cmd):
|
|
|
102e92 |
val = int(val)
|
|
|
102e92 |
except ValueError:
|
|
|
102e92 |
self.logger.critical('Value %s for %s cannot be made to an int', val, cmd)
|
|
|
102e92 |
+ self.result = 1
|
|
|
102e92 |
return
|
|
|
102e92 |
setattr(self.base.conf, cmd, val)
|
|
|
102e92 |
if cmd == 'debuglevel':
|
|
|
102e92 |
@@ -321,6 +332,7 @@ class YumShell(cmd.Cmd):
|
|
|
102e92 |
value = opts[0]
|
|
|
102e92 |
if value.lower() not in BOOLEAN_STATES:
|
|
|
102e92 |
self.logger.critical('Value %s for %s is not a Boolean', value, cmd)
|
|
|
102e92 |
+ self.result = 1
|
|
|
102e92 |
return False
|
|
|
102e92 |
value = BOOLEAN_STATES[value.lower()]
|
|
|
102e92 |
setattr(self.base.conf, cmd, value)
|
|
|
102e92 |
@@ -363,6 +375,7 @@ class YumShell(cmd.Cmd):
|
|
|
102e92 |
a subcommand and other parameters if required. If no
|
|
|
102e92 |
subcommand is given, run the list subcommand.
|
|
|
102e92 |
"""
|
|
|
102e92 |
+ self.result = 0
|
|
|
102e92 |
(cmd, args, line) = self.parseline(line)
|
|
|
102e92 |
if cmd in ['list', None]:
|
|
|
102e92 |
# Munge things to run the repolist command
|
|
|
102e92 |
@@ -380,7 +393,8 @@ class YumShell(cmd.Cmd):
|
|
|
102e92 |
except Errors.YumBaseError:
|
|
|
102e92 |
pass
|
|
|
102e92 |
else:
|
|
|
102e92 |
- self.base.doCommands()
|
|
|
102e92 |
+ result, _ = self.base.doCommands()
|
|
|
102e92 |
+ self.result = result
|
|
|
102e92 |
|
|
|
102e92 |
elif cmd == 'enable':
|
|
|
102e92 |
repos = self._shlex_split(args)
|
|
|
102e92 |
@@ -392,8 +406,10 @@ class YumShell(cmd.Cmd):
|
|
|
102e92 |
changed = self.base.repos.enableRepo(repo)
|
|
|
102e92 |
except Errors.ConfigError, e:
|
|
|
102e92 |
self.logger.critical(e)
|
|
|
102e92 |
+ self.result = 1
|
|
|
102e92 |
except Errors.RepoError, e:
|
|
|
102e92 |
self.logger.critical(e)
|
|
|
102e92 |
+ self.result = 1
|
|
|
102e92 |
|
|
|
102e92 |
else:
|
|
|
102e92 |
for repo in changed:
|
|
|
102e92 |
@@ -402,6 +418,7 @@ class YumShell(cmd.Cmd):
|
|
|
102e92 |
except Errors.RepoError, e:
|
|
|
102e92 |
self.logger.critical('Disabling Repository')
|
|
|
102e92 |
self.base.repos.disableRepo(repo)
|
|
|
102e92 |
+ self.result = 1
|
|
|
102e92 |
return False
|
|
|
102e92 |
|
|
|
102e92 |
self.base.up = None
|
|
|
102e92 |
@@ -413,8 +430,10 @@ class YumShell(cmd.Cmd):
|
|
|
102e92 |
offrepos = self.base.repos.disableRepo(repo)
|
|
|
102e92 |
except Errors.ConfigError, e:
|
|
|
102e92 |
self.logger.critical(e)
|
|
|
102e92 |
+ self.result = 1
|
|
|
102e92 |
except Errors.RepoError, e:
|
|
|
102e92 |
self.logger.critical(e)
|
|
|
102e92 |
+ self.result = 1
|
|
|
102e92 |
|
|
|
102e92 |
else:
|
|
|
102e92 |
# close the repos, too
|
|
|
102e92 |
@@ -432,36 +451,45 @@ class YumShell(cmd.Cmd):
|
|
|
102e92 |
print cmd
|
|
|
102e92 |
print args
|
|
|
102e92 |
print line
|
|
|
102e92 |
+ self.result = 0
|
|
|
102e92 |
|
|
|
102e92 |
def do_run(self, line):
|
|
|
102e92 |
"""Run the transaction.
|
|
|
102e92 |
|
|
|
102e92 |
:param line: unused
|
|
|
102e92 |
"""
|
|
|
102e92 |
+ self.result = 0
|
|
|
102e92 |
if len(self.base.tsInfo) > 0:
|
|
|
102e92 |
try:
|
|
|
102e92 |
(code, msgs) = self.base.buildTransaction()
|
|
|
102e92 |
if code == 1:
|
|
|
102e92 |
for msg in msgs:
|
|
|
102e92 |
self.logger.critical('Error: %s', msg)
|
|
|
102e92 |
+ self.result = 1
|
|
|
102e92 |
return False
|
|
|
102e92 |
|
|
|
102e92 |
returnval = self.base.doTransaction()
|
|
|
102e92 |
except Errors.YumBaseError, e:
|
|
|
102e92 |
self.logger.critical('Error: %s', e)
|
|
|
102e92 |
+ self.result = 1
|
|
|
102e92 |
except KeyboardInterrupt, e:
|
|
|
102e92 |
self.logger.critical('\n\nExiting on user cancel')
|
|
|
102e92 |
+ self.result = 1
|
|
|
102e92 |
except IOError, e:
|
|
|
102e92 |
if e.errno == 32:
|
|
|
102e92 |
self.logger.critical('\n\nExiting on Broken Pipe')
|
|
|
102e92 |
+ self.result = 1
|
|
|
102e92 |
else:
|
|
|
102e92 |
if returnval not in [0,1,-1]:
|
|
|
102e92 |
self.verbose_logger.info('Transaction encountered a serious error.')
|
|
|
102e92 |
+ self.result = 1
|
|
|
102e92 |
else:
|
|
|
102e92 |
if returnval == 1:
|
|
|
102e92 |
self.verbose_logger.info('There were non-fatal errors in the transaction')
|
|
|
102e92 |
+ self.result = 1
|
|
|
102e92 |
elif returnval == -1:
|
|
|
102e92 |
self.verbose_logger.info("Transaction didn't start")
|
|
|
102e92 |
+ self.result = 1
|
|
|
102e92 |
self.verbose_logger.log(logginglevels.INFO_2,
|
|
|
102e92 |
'Finished Transaction')
|
|
|
102e92 |
self.base.closeRpmDB()
|
|
|
102e92 |
diff -up yum-3.4.3/yum/config.py.orig yum-3.4.3/yum/config.py
|
|
|
102e92 |
--- yum-3.4.3/yum/config.py.orig 2017-11-24 20:52:02.648462776 +0100
|
|
|
102e92 |
+++ yum-3.4.3/yum/config.py 2017-11-24 20:52:18.484380940 +0100
|
|
|
102e92 |
@@ -931,6 +931,8 @@ class YumConf(StartupConf):
|
|
|
102e92 |
|
|
|
102e92 |
usr_w_check = BoolOption(True)
|
|
|
102e92 |
|
|
|
102e92 |
+ shell_exit_status = SelectionOption('0', ('0', '?'))
|
|
|
102e92 |
+
|
|
|
102e92 |
_reposlist = []
|
|
|
102e92 |
|
|
|
102e92 |
def dump(self):
|