Univention Bugzilla – Attachment 4206 Details for
Bug 25981
menu.lst Datei generieren
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
/boot/vmlinuz* → menu.lst
univention-grub-generate-menu-lst (text/plain), 3.73 KB, created by
Philipp Hahn
on 2012-02-21 19:56 CET
(
hide
)
Description:
/boot/vmlinuz* → menu.lst
Filename:
MIME Type:
Creator:
Philipp Hahn
Created:
2012-02-21 19:56 CET
Size:
3.73 KB
patch
obsolete
>#!/usr/bin/python2.6 ># -*- coding: utf-8 -*- ># ># Univention Grub menu.lst generator ># ># Copyright 2012 Univention GmbH ># ># http://www.univention.de/ ># ># All rights reserved. ># ># The source code of this program is made available ># under the terms of the GNU Affero General Public License version 3 ># (GNU AGPL V3) as published by the Free Software Foundation. ># ># Binary versions of this program provided by Univention to you as ># well as other copyrighted, protected or trademarked materials like ># Logos, graphics, fonts, specific documentations and configurations, ># cryptographic keys etc. are subject to a license agreement between ># you and Univention and not subject to the GNU AGPL V3. ># ># In the case you use this program under the terms of the GNU AGPL V3, ># the program is provided 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 Affero General Public License for more details. ># ># You should have received a copy of the GNU Affero General Public ># License with the Debian GNU/Linux or Univention distribution in file ># /usr/share/common-licenses/AGPL-3; if not, see ># <http://www.gnu.org/licenses/>. > >import os >import sys >import optparse >from shutil import copyfile >from glob import glob >from distutils.version import LooseVersion >import univention.config_registry as ucr > >configRegistry = ucr.ConfigRegistry() >configRegistry.load() > >f = open('/proc/cmdline') >try: > args = "%s splash=nosplash" % f.read().strip() >finally: > f.close() > >parser = optparse.OptionParser() >parser.add_option("-f", "--force", action="store_true", > dest="force", default=False, help="Force writing menu.lst") >parser.add_option("-n", "--dry-run", action="store_true", > dest="dry", default=False, help="Print to stdout instead of menu.lst") >parser.add_option("-c", "--commandline", "--append", action="store", > dest="args", default=args, help="Overwrite kernel command line arguments") >options, args = parser.parse_args() > >if configRegistry.is_false('grub/generate-menu-lst', False): > print >>sys.stderr, "Disables via grub/generate-menu-lst" > if options.force: > print >>sys.stderr, "Forced!" > else: > sys.exit(0) > >os.chdir("/boot") >if os.path.exists("grub/menu.lst"): > f = open("grub/menu.lst", "r") > for line in f: > if "auto-generated through univention-grub-generate-menu-lst" in line: > break > else: > print >>sys.stderr, "menu.lst already exists. This typically happens if you have updated from UCS 2.4" > print >>sys.stderr, "and haven't converted from chain loading" > if options.force: > print >>sys.stderr, "Forced!" > else: > sys.exit(0) > >kernels = glob("vmlinuz-*") >if not kernels: > print >>sys.stderr, "No kernels found matching /boot/vmlinuz-*." > sys.exit(0) > >if os.path.exists("grub/menu.lst"): > if options.dry: > print >>sys.stderr, "Skip moving!" > else: > copyfile("grub/menu.lst", "grub/menu.lst.bak") > >print >>sys.stderr, "Generating legacy menu.lst from current kernels" > >if options.dry: > out = sys.stdout >else: > out = open("grub/menu.lst", "w") >try: > print >>out, "# This Grub configuration is auto-generated through univention-grub-generate-menu-lst." > print >>out, "# It is used when booting UCS 3.0 as a Xen DomU with an older version of PyGrub." > print >>out, "" > print >>out, "default 0" > print >>out, "timeout %s" % configRegistry.get("grub/timeout", "5") > print >>out, "" > > for kernel in sorted(kernels, key=LooseVersion, reverse=True): > kver = kernel[8:] # vmlinuz- > initrd = "initrd.img-%s" % kver > print >>out, "title UCS, kernel %s" % kver > print >>out, "root (hd0,0)" > print >>out, "kernel /%s %s" % (kernel, options.args) > if os.path.exists(initrd): > print >>out, "initrd /%s" % initrd > print >>out, "" >finally: > out.close()
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
Attachments on
bug 25981
: 4206 |
4207