Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 603848 Details for
Bug 705994
sys-kernel/genkernelmenu - New TUI override system for genkernel makes tweaking even easier!
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
genkernelmenu.py
genkernelmenu.py (text/x-python), 4.51 KB, created by
dugz
on 2020-01-21 06:57:19 UTC
(
hide
)
Description:
genkernelmenu.py
Filename:
MIME Type:
Creator:
dugz
Created:
2020-01-21 06:57:19 UTC
Size:
4.51 KB
patch
obsolete
>#!/bin/env python3 ># ># genkernelmenu.py for genkernel by z6np 2020 ># > >import glob, gzip, platform, os > >try: > from dialog import Dialog >except: > print("\nThis program requires: dev-python/pythondialog\nPlease emerge it and try again.\n") > >def curcfg(): > tcfg="/tmp/config-genmenu" > gzcfg=gzip.GzipFile("/proc/config.gz",'rb') > s = gzcfg.read() > gzcfg.close() > tmpcfg=open(tcfg,'wb') > tmpcfg.write(s) > tmpcfg.close() > return tcfg > >def getsetting(line,key): > if key.upper() in line: > if line[0] != '#': > t = line.split('=')[-1].strip('\n"').lower() > if 'yes' == t: > return(True) > elif 'no' == t: > return(False) > ># Main Program >d = Dialog(dialog="dialog", autowidgetsize=True) >bgtitle="Override menu for genkernel" >d.set_background_title(bgtitle) >sysver=platform.release().split('-') >tlocver="-"+sysver[2] >textver="-"+"-".join(sysver[3:]) if len(sysver) >= 4 else "" > ># Kernel Settings Part >kcfg=locver=extver="" >while True: > code, ktag = d.menu("Kernel Settings", extra_button=True, extra_label="Continue", > choices=[("cfgfile", "Select a specific kernel config"), > ("locver", f"Override the local version: {locver}"), > ("extver", f"Change the extra version: {extver}")]) > if code==Dialog.CANCEL: > exit(1) > elif code==Dialog.EXTRA: > break > elif ktag=="cfgfile": > d.set_background_title("Override kernel config file... ") > kccode, cfgtag = d.menu("Select a config", > choices=[("running", "Generate from the kernel's /proc/config.gz"), > ("saved", "Choose a config file from the filesystem")]) > if kccode!=Dialog.CANCEL: > kcfg='/etc/kernels/' > if cfgtag=="running": > kcfg=curcfg() > else: > klist=glob.glob("/etc/kernels/*config*") > klist.sort(key=os.path.getmtime) > kcfg=klist[-1] if len(klist)>0 else "/usr/src/linux/.config" > d.set_background_title("Press SPACE to copy selection to input box") > ty, tx = d.maxsize() > codef, kcfg=d.fselect(kcfg, ty-14, tx-6) > elif ktag=="locver": > codev, locver = d.inputbox("Set a kernel local version", init=tlocver) > elif ktag=="extver": > codei, extver = d.inputbox("Specify a kernel extra version", init=textver) > tmptitle="Config: "+kcfg if kcfg != "" else bgtitle > d.set_background_title(tmptitle) > ># Make settings section - simply add things here >msettings=[["menuconfig", "Run menuconfig before compiling", False], > ["clean", "Clean the kernel sources before building", False], > ["mrproper", "Return the kernel sources to pristine state", False], > ["symlink", "Manage symlinks in /boot for installed images", False], > ["install", "Install the kernel after building", False], > ["oldconfig", "Implies --no-clean and runs a 'make oldconfig'", False], > ["static", "Build a static (monolithic kernel)", False]] >with open('/etc/genkernel.conf','r') as gconf: > for cline in gconf.readlines(): > for s in msettings: > dstate = getsetting(cline,s[0]) > if dstate != None: > s[2] = dstate > gconf.close() >mdefs = {} >for ii in msettings: > mdefs[ii[0]]=ii[2] >code, opts = d.checklist("Available Make Options", choices=msettings) >if code==Dialog.CANCEL: > exit(1) >options='' >for c in (msettings): > c1='' > if c[0] in opts: > if not mdefs[c[0]]: > c1=" --"+c[0] > else: > if mdefs[c[0]]: > c1=" --no-"+c[0] > options+=c1 > ># Actions Section >code, action = d.menu("Actions", > choices=[("all", "Build all steps"), > ("bzImage", "Build only the kernel"), > ("initramfs", "Build only the ramdisk/initramfs"), > ("kernel", "Build only the kernel and modules")]) >if code==Dialog.CANCEL: > exit(1) > ># Processing Section >if kcfg != "": kcfg=f' --kernel-config="{kcfg}"' >if locver != "": locver=f' --kernel-localversion="{locver}"' >if extver != "": extver=f' --kernel-append-localversion="{extver}"' >gcommand="genkernel"+kcfg+locver+extver+options+" "+action > ># Execute Section >d.set_background_title("Review the generated commandline...") >excode = d.yesno(gcommand, yes_label="Run", no_label="Quit") >os.system("clear") >if excode == Dialog.CANCEL: > print(f"\nWould have run the following:\n\n{gcommand}\n") > exit(1) >os.system(gcommand)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 705994
: 603848