View | Details | Raw Unified | Return to bug 48123
Collapse All | Expand All

(-)a/base/univention-updater/python/univention-repository-update (-1 / +60 lines)
 Lines 45-50   import univention.updater.repository as urepo Link Here 
45
from univention.updater.mirror import UniventionMirror, makedirs
45
from univention.updater.mirror import UniventionMirror, makedirs
46
from univention.updater.errors import UpdaterException, VerificationError
46
from univention.updater.errors import UpdaterException, VerificationError
47
from univention.updater.locking import UpdaterLock
47
from univention.updater.locking import UpdaterLock
48
try:
49
    from typing import IO  # noqa F401
50
except ImportError:
51
    pass
48
52
49
configRegistry = ConfigRegistry()
53
configRegistry = ConfigRegistry()
50
configRegistry.load()
54
configRegistry.load()
 Lines 192-197   def update_net(options): Link Here 
192
            print >> ver, 'VERSION=%d.%d' % (min_version.major, min_version.minor)
196
            print >> ver, 'VERSION=%d.%d' % (min_version.major, min_version.minor)
193
            print >> ver, 'PATCHLEVEL=%d' % (min_version.patchlevel,)
197
            print >> ver, 'PATCHLEVEL=%d' % (min_version.patchlevel,)
194
198
199
    if options.pxe:
200
        copy_pxe(mirror, options.teefile)
201
202
203
def copy_pxe(mirror, out):  # type: (UniventionMirror, IO) -> None
204
    '''
205
    setup network installation (PXE)
206
207
    :param mirror UniventionMirror: an UniventionMirror instance.
208
    :param out: File for error output.
209
    '''
210
    if mirror.current_version.major < 4:
211
        print >> out, 'WARNING: The usage of this DVD for PXE reinstallation is not possible.'
212
        print >> out, '         Please use an UCS installation DVD with UCS 4.0-0 or later.'
213
        return
214
    if mirror.server.baseurl.hostname != 'updates.software-univention.de':
215
        print >> out, 'WARNING: Download of PXE files from %s may not work' % (mirror.server.baseurl.public())
216
217
    version = mirror.get_ucs_version()
218
    pxedir = '/var/lib/univention-client-boot'
219
    installerdir = os.path.join(pxedir, 'installer', version)
220
    makedirs(installerdir)
221
222
    # copy kernel and initrd to /var/lib/univention-client-boot/installer/<major>.<minor>-<patchlevel>/
223
    # and create/refresh symlinks in /var/lib/univention-client-boot/ to these files
224
    arch = mirror.architectures[0]
225
    for fn in ['linux', 'initrd.gz']:
226
        dstfn = os.path.join(installerdir, fn)
227
        if os.path.exists(dstfn):
228
            continue
229
230
        uri = '/'.join(('pxe', version, arch, 'gtk', 'debian-installer', arch, fn))
231
        try:
232
            code, size, content = mirror.server.access(None, filename=uri, get=True)
233
        except UpdaterException as ex:
234
            print >> out, 'WARNING: Failed download %s: %s' % (uri, ex)
235
            continue
236
237
        try:
238
            with open(dstfn, 'w') as stream:
239
                stream.write(content)
240
        except EnvironmentError as ex:
241
            print >> out, 'WARNING: Failed to write %s: %s' % (dstfn, ex)
242
            continue
243
244
        symlinkfn = os.path.join(pxedir, fn)
245
        try:
246
            if os.path.islink(symlinkfn):
247
                os.remove(symlinkfn)
248
            os.symlink(os.path.relpath(dstfn, pxedir), symlinkfn)
249
        except EnvironmentError as ex:
250
            print >> out, 'WARNING: Failed to update %s: %s' % (symlinkfn, ex)
251
195
252
196
def parse_args():
253
def parse_args():
197
    for mount_point_default in ('/cdrom', '/media/cdrom', '/media/cdrom0'):
254
    for mount_point_default in ('/cdrom', '/media/cdrom', '/media/cdrom0'):
 Lines 227-232   def parse_args(): Link Here 
227
        '-u', '--updateto', action='store',
284
        '-u', '--updateto', action='store',
228
        dest='update_to', default='',
285
        dest='update_to', default='',
229
        help='if given the repository is updated to the specified version but not higher')
286
        help='if given the repository is updated to the specified version but not higher')
287
    parser.add_option(
288
        '--pxe', '-p', action='store_true',
289
        help='download PXE network installer files')
230
290
231
    (options, arguments) = parser.parse_args()
291
    (options, arguments) = parser.parse_args()
232
292
233
- 

Return to bug 48123