/usr/sbin/rhn_register is in rhn-client-tools 1.8.26-4.
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 | #! /usr/bin/python
#
# Red Hat Network registration tool
# Adapted from wrapper.py
# Copyright (c) 1999--2012 Red Hat, Inc. Distributed under GPLv2.
#
# Authors:
# Adrian Likins <alikins@redhat.com>
# Preston Brown <pbrown@redhat.com>
# James Bowes <jbowes@redhat.com>
# Daniel Benamy <dbenamy@redhat.com>
import sys
import os
import gettext
t = gettext.translation('rhn-client-tools', fallback=True)
_ = t.ugettext
sys.path.append("/usr/share/rhn/")
from up2date_client import up2dateLog
up2dateLog.initLog().set_app_name('rhn_register')
from up2date_client import up2dateAuth
from up2date_client import rhncli
from up2date_client import tui
from up2date_client import up2dateErrors
class RhnRegister(rhncli.RhnCli):
"""Runs rhn_register. Can run it in gui or tui mode depending on
availablility of gui, DISPLAY environment variable, and --nox switch.
"""
def __init__(self):
super(RhnRegister, self).__init__()
self.optparser.add_option("--nox", action="store_true", default=False,
help=_("Do not attempt to use X"))
def _get_ui(self):
try:
if os.access("/usr/share/rhn/up2date_client/gui.py", os.R_OK) and \
os.environ["DISPLAY"] != "" and \
not self.options.nox:
from up2date_client import gui
self.hasGui = True # Used by base class. Yech.
return gui
except:
pass
return tui
def main(self):
"""RhnCli (the base class) just sets stuff up and then calls this to run
the rest of the program.
"""
ui = self._get_ui()
ui.main()
# Check to see if the registration worked.
try:
if not up2dateAuth.getLoginInfo():
if not self._testRhnLogin():
sys.exit(1)
except up2dateErrors.RhnServerException:
sys.exit(1)
# Assuming registration worked, remember to save info (proxy setup,etc)
# from rhncli
self.saveConfig()
sys.exit(0)
if __name__ == "__main__":
app = RhnRegister()
app.run()
|