fix(src/utils): fix missing braces and improve conditional logic for rebuild_initramfs detection

Why: Ensure correct detection of EndeavourOS and provide clearer command building for initramfs.

- New Features: Added explicit multi‑condition detection with proper braces for EndeavourOS handling.
- Enhancements: Improved readability of systemd‑inhibit command construction.
- Bug Fixes: Resolved syntax issue that could cause command generation failure.
This commit is contained in:
sankalp committed 2026-03-12 00:27:46 +05:45
1 parent 8bd5b52b05
commit 05c8a3bd87
1 file changed
+10 -2
+10 -2
View File
@@ -69,7 +69,9 @@ pub fn rebuild_initramfs() {
command = vec!["update-initramfs", "-u", "-k", "all"];
} else if Path::new("/etc/redhat-release").exists() || Path::new("/usr/bin/zypper").exists() {
command = vec!["dracut", "--force", "--regenerate-all"];
} else if Path::new("/usr/lib/endeavouros-release").exists() && Path::new("/usr/bin/dracut").exists() {
} else if Path::new("/usr/lib/endeavouros-release").exists()
&& Path::new("/usr/bin/dracut").exists()
{
command = vec!["dracut-rebuild"];
} else if Path::new("/etc/altlinux-release").exists() {
command = vec!["make-initrd"];
@@ -79,7 +81,13 @@ pub fn rebuild_initramfs() {
if let Ok(which) = Command::new("which").arg("systemd-inhibit").output() {
if which.status.success() {
let mut new_cmd = vec!["systemd-inhibit", "--who=lapctl", "--why", "Rebuilding initramfs", "--"];
let mut new_cmd = vec![
"systemd-inhibit",
"--who=lapctl",
"--why",
"Rebuilding initramfs",
"--",
];
new_cmd.extend(command.iter());
command = new_cmd;
}