/usr/sbin/pki-upgrade is in pki-base 10.2.6+git20160317-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | #! /usr/bin/python
# Authors:
# Endi S. Dewata <edewata@redhat.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Copyright (C) 2013 Red Hat, Inc.
# All rights reserved.
#
import getopt
import signal
import sys
import pki
import pki.upgrade
# pylint: disable=W0613
def interrupt_handler(event, frame):
print
print
print 'Upgrade canceled.'
sys.exit(1)
def usage():
print 'Usage: pki-upgrade [OPTIONS]'
print
print ' --silent Upgrade in silent mode.'
print ' --status Show upgrade status only. Do not perform upgrade.'
print ' --revert Revert the last version.'
print
print ' -X Show advanced options.'
print ' -v, --verbose Run in verbose mode.'
print ' -h, --help Show this help message.'
def advancedOptions():
print
print 'WARNING: These options may render the system unusable.'
print
print ' --scriptlet-version <version> Run scriptlets for a specific version only.'
print ' --scriptlet-index <index> Run a specific scriptlet only.'
print
print ' --remove-tracker Remove tracker.'
print ' --reset-tracker Reset tracker to match package version.'
print ' --set-tracker <version> Set tracker to a specific version.'
def main(argv):
signal.signal(signal.SIGINT, interrupt_handler)
try:
opts, _ = getopt.getopt(argv[1:], 'hi:s:t:vX', [
'scriptlet-version=', 'scriptlet-index=',
'silent', 'status', 'revert',
'remove-tracker', 'reset-tracker', 'set-tracker=',
'verbose', 'help'])
except getopt.GetoptError as e:
print 'ERROR: ' + str(e)
usage()
sys.exit(1)
scriptlet_version = None
scriptlet_index = None
silent = False
status = False
revert = False
remove_tracker = False
reset_tracker = False
tracker_version = None
for o, a in opts:
if o == '--scriptlet-version':
scriptlet_version = a
elif o == '--scriptlet-index':
scriptlet_index = int(a)
elif o == '--silent':
silent = True
elif o == '--status':
status = True
elif o == '--revert':
revert = True
elif o == '--remove-tracker':
remove_tracker = True
elif o == '--reset-tracker':
reset_tracker = True
elif o == '--set-tracker':
tracker_version = pki.upgrade.Version(a)
elif o in ('-v', '--verbose'):
pki.upgrade.verbose = True
elif o in ('-h', '--help'):
usage()
sys.exit()
elif o == '-X':
usage()
advancedOptions()
sys.exit()
else:
print 'ERROR: unknown option ' + o
usage()
sys.exit(1)
if scriptlet_index and not scriptlet_version:
print 'ERROR: --scriptlet-index requires --scriptlet-version'
usage()
sys.exit(1)
try:
upgrader = pki.upgrade.PKIUpgrader(
version=scriptlet_version,
index=scriptlet_index,
silent=silent)
if status:
upgrader.status()
elif revert:
upgrader.revert()
elif remove_tracker:
upgrader.remove_tracker()
elif reset_tracker:
upgrader.reset_tracker()
elif tracker_version is not None:
upgrader.set_tracker(tracker_version)
else:
upgrader.upgrade()
except pki.PKIException as e:
print e.message
if __name__ == '__main__':
main(sys.argv)
|