Skip to content

Commit 2e2af0a

Browse files
correzione vmlinux per systemd-boot (#437)
1 parent 11142b4 commit 2e2af0a

File tree

2 files changed

+18
-27
lines changed

2 files changed

+18
-27
lines changed

src/classes/ovary.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -941,13 +941,8 @@ export default class Ovary {
941941
async initrdDracut() {
942942
Utils.warning(`creating ${path.basename(this.settings.initrdImg)} using dracut on ISO/live`)
943943
const kernelVersion = shx.exec('uname -r', { silent: true }).stdout.trim()
944-
const conf = path.resolve(__dirname, `../../dracut/dracut.conf`)
945944
const confdir = path.resolve(__dirname, `../../dracut/dracut.conf.d`)
946-
if (this.familyId === 'aldos') {
947-
await exec(`dracut --force --confdir ${confdir} ${this.settings.iso_work}live/${this.settings.initrdImg}`, Utils.setEcho(true))
948-
} else {
949-
await exec(`dracut --confdir ${confdir} ${this.settings.iso_work}live/${this.settings.initrdImg}`, this.echo)
950-
}
945+
await exec(`dracut --confdir ${confdir} ${this.settings.iso_work}live/${this.settings.initrdImg}`, this.echo)
951946
}
952947

953948
/**

src/classes/utils.tsx

+17-21
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export default class Utils {
142142
let distro = new Distro()
143143
let vmlinuz = ''
144144

145-
// find vmlinuz in /proc/cmdline
145+
// find BOOT_IMAGE /proc/cmdline
146146
const cmdline = fs.readFileSync('/proc/cmdline', 'utf8').split(" ")
147147
cmdline.forEach(cmd => {
148148
if (cmd.includes('BOOT_IMAGE')) {
@@ -161,6 +161,22 @@ export default class Utils {
161161
}
162162
})
163163

164+
165+
/**
166+
* BOOT_IMAGE not found in /proc/cmdline
167+
* sample: initrd=\initramfs-6.11.10-300.fc41.x86_64.img root=/dev/sda3 rw
168+
*/
169+
if (vmlinuz === '') {
170+
cmdline.forEach(cmd => {
171+
if (cmd.includes('initrd=')) {
172+
let initrd = cmd.substring(cmd.indexOf('initramfs-')+10)
173+
let version = initrd.substring(0, initrd.indexOf('.img'))
174+
vmlinuz = `/boot/efi/vmlinuz-${version}`
175+
console.log(vmlinuz)
176+
}
177+
})
178+
}
179+
164180
// btrfs: eg: /@root/boot/vmlinuz
165181
if (vmlinuz.indexOf('@')) {
166182
let subvolumeEnd = vmlinuz.indexOf('/', vmlinuz.indexOf('@'))
@@ -172,26 +188,6 @@ export default class Utils {
172188
vmlinuz = `/boot/vmlinuz-${kernelVersion}`
173189
}
174190

175-
/**
176-
* If vmlinuz not found
177-
*/
178-
if (vmlinuz === '') {
179-
let version = 'linux'
180-
if (distro.familyId === 'debian') {
181-
cmdline.forEach(cmd => {
182-
if (cmd.includes('initrd.img')) {
183-
version = cmd.substring(cmd.indexOf('initrd.img') + 10)
184-
}
185-
})
186-
} else if (distro.distroId === 'Manjaro') {
187-
cmdline.forEach(cmd => {
188-
if (cmd.includes('initrd.img')) {
189-
version = cmd.substring(cmd.indexOf('initrd.img') + 10)
190-
}
191-
})
192-
}
193-
vmlinuz = '/boot/vmlinuz-' + version
194-
}
195191

196192
/**
197193
* if not exists exit

0 commit comments

Comments
 (0)