first commit
This commit is contained in:
23
syslinux-mkconfig
Executable file
23
syslinux-mkconfig
Executable file
@ -0,0 +1,23 @@
|
||||
#!/usr/bin/python
|
||||
from distutils.version import LooseVersion
|
||||
import glob
|
||||
import os
|
||||
syslinuxCfgPath = "/boot/EFI/syslinux/syslinux.cfg"
|
||||
options = "APPEND root=PARTUUID=6ce9f430-9a06-d64f-ad4e-806594365431 rootflags=subvol=bedrock"
|
||||
baseName = "bedrock"
|
||||
os.chdir("/boot")
|
||||
lv = [LooseVersion(v) for v in glob.iglob("vmlinuz-*")]
|
||||
lv.sort()
|
||||
lv.reverse()
|
||||
for i in range(len(lv)):
|
||||
if i + 1 < len(lv) and str(lv[i]).replace(".old", "") == str(lv[i + 1]):
|
||||
cache = lv[i]
|
||||
lv[i] = lv[i + 1]
|
||||
lv[i + 1] = cache
|
||||
versionName = baseName + "/" + str(lv[i])
|
||||
if i == 0:
|
||||
config = "ONTIMEOUT " + versionName + "\nTIMEOUT 10\nUI vesamenu.c32\nMENU TITLE Boot bedrock\nMENU RESOLUTION 1920 1080"
|
||||
config = config + "\nLABEL " + versionName + "\nMENU LABEL " + versionName + "\nLINUX /" + str(lv[i]) + "\n" + options
|
||||
syslinuxCfg = open(syslinuxCfgPath, "w")
|
||||
syslinuxCfg.write(config)
|
||||
syslinuxCfg.close
|
||||
Reference in New Issue
Block a user