fix grub config

This commit is contained in:
Aiden McClelland
2026-01-27 15:27:49 -07:00
parent c96a5b7754
commit a81c01b232
4 changed files with 129 additions and 59 deletions

View File

@@ -292,8 +292,8 @@ fi
if [ "${IB_TARGET_PLATFORM}" = "raspberrypi" ]; then if [ "${IB_TARGET_PLATFORM}" = "raspberrypi" ]; then
ln -sf /usr/bin/pi-beep /usr/local/bin/beep ln -sf /usr/bin/pi-beep /usr/local/bin/beep
KERNEL_VERSION=${RPI_KERNEL_VERSION} sh /boot/config.sh > /boot/config.txt KERNEL_VERSION=${RPI_KERNEL_VERSION} sh /boot/config.sh > /boot/config.txt
mkinitramfs -c gzip -o initrd.img-${RPI_KERNEL_VERSION}-rpi-v8 ${RPI_KERNEL_VERSION}-rpi-v8 mkinitramfs -c gzip -o /boot/initrd.img-${RPI_KERNEL_VERSION}-rpi-v8 ${RPI_KERNEL_VERSION}-rpi-v8
mkinitramfs -c gzip -o initrd.img-${RPI_KERNEL_VERSION}-rpi-2712 ${RPI_KERNEL_VERSION}-rpi-2712 mkinitramfs -c gzip -o /boot/initrd.img-${RPI_KERNEL_VERSION}-rpi-2712 ${RPI_KERNEL_VERSION}-rpi-2712
fi fi
useradd --shell /bin/bash -G startos -m start9 useradd --shell /bin/bash -G startos -m start9

View File

@@ -1,51 +1,51 @@
desktop-image: "/boot/grub/splash.png" desktop-image: "../splash.png"
title-color: "#ffffff" title-color: "#ffffff"
title-font: "Unifont Regular 16" title-font: "Unifont Regular 16"
title-text: "" title-text: "StartOS Boot Menu with GRUB"
message-font: "Unifont Regular 16" message-font: "Unifont Regular 16"
terminal-font: "Unifont Regular 16" terminal-font: "Unifont Regular 16"
#help bar at the bottom #help bar at the bottom
+ label { + label {
top = 100%-50 top = 100%-50
left = 0 left = 0
width = 100% width = 100%
height = 20 height = 20
text = "Use the ^ and v keys to select which entry is highlighted." text = "@KEYMAP_SHORT@"
align = "center" align = "center"
color = "#ffffff" color = "#ffffff"
font = "Unifont Regular 16" font = "Unifont Regular 16"
} }
#boot menu #boot menu
+ boot_menu { + boot_menu {
left = 10% left = 10%
width = 80% width = 80%
top = 52% top = 52%
height = 48%-80 height = 48%-80
item_color = "#a8a8a8" item_color = "#a8a8a8"
item_font = "Unifont Regular 16" item_font = "Unifont Regular 16"
selected_item_color= "#ffffff" selected_item_color= "#ffffff"
selected_item_font = "Unifont Regular 16" selected_item_font = "Unifont Regular 16"
item_height = 16 item_height = 16
item_padding = 0 item_padding = 0
item_spacing = 4 item_spacing = 4
icon_width = 0 icon_width = 0
icon_heigh = 0 icon_heigh = 0
item_icon_space = 0 item_icon_space = 0
} }
#progress bar #progress bar
+ progress_bar { + progress_bar {
id = "__timeout__" id = "__timeout__"
left = 15% left = 15%
top = 100%-80 top = 100%-80
height = 16 height = 16
width = 70% width = 70%
font = "Unifont Regular 16" font = "Unifont Regular 16"
text_color = "#000000" text_color = "#000000"
fg_color = "#ffffff" fg_color = "#ffffff"
bg_color = "#a8a8a8" bg_color = "#a8a8a8"
border_color = "#ffffff" border_color = "#ffffff"
text = "The highlighted entry will be executed automatically in %d seconds." text = "@TIMEOUT_NOTIFICATION_LONG@"
} }

View File

@@ -400,21 +400,52 @@ async fn disk_info(disk: PathBuf) -> DiskInfo {
.map_err(|e| { .map_err(|e| {
tracing::warn!( tracing::warn!(
"{}", "{}",
t!("disk.util.could-not-get-partition-table", disk = disk.display(), error = e.source) t!(
"disk.util.could-not-get-partition-table",
disk = disk.display(),
error = e.source
)
) )
}) })
.unwrap_or_default(); .unwrap_or_default();
let vendor = get_vendor(&disk) let vendor = get_vendor(&disk)
.await .await
.map_err(|e| tracing::warn!("{}", t!("disk.util.could-not-get-vendor", disk = disk.display(), error = e.source))) .map_err(|e| {
tracing::warn!(
"{}",
t!(
"disk.util.could-not-get-vendor",
disk = disk.display(),
error = e.source
)
)
})
.unwrap_or_default(); .unwrap_or_default();
let model = get_model(&disk) let model = get_model(&disk)
.await .await
.map_err(|e| tracing::warn!("{}", t!("disk.util.could-not-get-model", disk = disk.display(), error = e.source))) .map_err(|e| {
tracing::warn!(
"{}",
t!(
"disk.util.could-not-get-model",
disk = disk.display(),
error = e.source
)
)
})
.unwrap_or_default(); .unwrap_or_default();
let capacity = get_capacity(&disk) let capacity = get_capacity(&disk)
.await .await
.map_err(|e| tracing::warn!("{}", t!("disk.util.could-not-get-capacity", disk = disk.display(), error = e.source))) .map_err(|e| {
tracing::warn!(
"{}",
t!(
"disk.util.could-not-get-capacity",
disk = disk.display(),
error = e.source
)
)
})
.unwrap_or_default(); .unwrap_or_default();
DiskInfo { DiskInfo {
logicalname: disk, logicalname: disk,
@@ -431,21 +462,49 @@ async fn part_info(part: PathBuf) -> PartitionInfo {
let mut start_os = BTreeMap::new(); let mut start_os = BTreeMap::new();
let label = get_label(&part) let label = get_label(&part)
.await .await
.map_err(|e| tracing::warn!("{}", t!("disk.util.could-not-get-label", part = part.display(), error = e.source))) .map_err(|e| {
tracing::warn!(
"{}",
t!(
"disk.util.could-not-get-label",
part = part.display(),
error = e.source
)
)
})
.unwrap_or_default(); .unwrap_or_default();
let capacity = get_capacity(&part) let capacity = get_capacity(&part)
.await .await
.map_err(|e| tracing::warn!("{}", t!("disk.util.could-not-get-capacity-part", part = part.display(), error = e.source))) .map_err(|e| {
tracing::warn!(
"{}",
t!(
"disk.util.could-not-get-capacity-part",
part = part.display(),
error = e.source
)
)
})
.unwrap_or_default(); .unwrap_or_default();
let mut used = None; let mut used = None;
match TmpMountGuard::mount(&BlockDev::new(&part), ReadOnly).await { match TmpMountGuard::mount(&BlockDev::new(&part), ReadOnly).await {
Err(e) => tracing::warn!("{}", t!("disk.util.could-not-collect-usage-info", error = e.source)), Err(e) => tracing::warn!(
"{}",
t!("disk.util.could-not-collect-usage-info", error = e.source)
),
Ok(mount_guard) => { Ok(mount_guard) => {
used = get_used(mount_guard.path()) used = get_used(mount_guard.path())
.await .await
.map_err(|e| { .map_err(|e| {
tracing::warn!("{}", t!("disk.util.could-not-get-usage", part = part.display(), error = e.source)) tracing::warn!(
"{}",
t!(
"disk.util.could-not-get-usage",
part = part.display(),
error = e.source
)
)
}) })
.ok(); .ok();
match recovery_info(mount_guard.path()).await { match recovery_info(mount_guard.path()).await {
@@ -453,11 +512,21 @@ async fn part_info(part: PathBuf) -> PartitionInfo {
start_os = a; start_os = a;
} }
Err(e) => { Err(e) => {
tracing::error!("{}", t!("disk.util.error-fetching-backup-metadata", error = e)); tracing::error!(
"{}",
t!("disk.util.error-fetching-backup-metadata", error = e)
);
} }
} }
if let Err(e) = mount_guard.unmount().await { if let Err(e) = mount_guard.unmount().await {
tracing::error!("{}", t!("disk.util.error-unmounting-partition", part = part.display(), error = e)); tracing::error!(
"{}",
t!(
"disk.util.error-unmounting-partition",
part = part.display(),
error = e
)
);
} }
} }
} }

View File

@@ -23,22 +23,23 @@ if [ -f /etc/default/grub ]; then
sed -i '/\(^\|#\)GRUB_CMDLINE_LINUX=/c\GRUB_CMDLINE_LINUX="boot=startos console=ttyS0,115200n8 console=tty0"' /etc/default/grub sed -i '/\(^\|#\)GRUB_CMDLINE_LINUX=/c\GRUB_CMDLINE_LINUX="boot=startos console=ttyS0,115200n8 console=tty0"' /etc/default/grub
sed -i '/\(^\|#\)GRUB_CMDLINE_LINUX_DEFAULT=/c\GRUB_CMDLINE_LINUX_DEFAULT=""' /etc/default/grub sed -i '/\(^\|#\)GRUB_CMDLINE_LINUX_DEFAULT=/c\GRUB_CMDLINE_LINUX_DEFAULT=""' /etc/default/grub
sed -i '/\(^\|#\)GRUB_DISTRIBUTOR=/c\GRUB_DISTRIBUTOR="StartOS v$(cat /usr/lib/startos/VERSION.txt)"' /etc/default/grub sed -i '/\(^\|#\)GRUB_DISTRIBUTOR=/c\GRUB_DISTRIBUTOR="StartOS v$(cat /usr/lib/startos/VERSION.txt)"' /etc/default/grub
# Set a GRUB variable, replacing if it exists (even commented) or appending if not
grub_set() {
sed -i '/\(^\|#\)'"$1"'=/d' /etc/default/grub
printf '%s="%s"\n' "$1" "$2" >> /etc/default/grub
}
# Enable both graphical and serial terminal output # Enable both graphical and serial terminal output
sed -i '/\(^\|#\)GRUB_TERMINAL_INPUT=/c\GRUB_TERMINAL_INPUT="console serial"' /etc/default/grub grub_set GRUB_TERMINAL_INPUT 'console serial'
sed -i '/\(^\|#\)GRUB_TERMINAL_OUTPUT=/c\GRUB_TERMINAL_OUTPUT="gfxterm serial"' /etc/default/grub grub_set GRUB_TERMINAL_OUTPUT 'gfxterm serial'
# Remove GRUB_TERMINAL if present (replaced by INPUT/OUTPUT above) # Remove GRUB_TERMINAL if present (replaced by INPUT/OUTPUT above)
sed -i '/^\(#\|\)GRUB_TERMINAL=/d' /etc/default/grub sed -i '/^\(#\|\)GRUB_TERMINAL=/d' /etc/default/grub
# Serial console settings # Serial console settings
if grep '^GRUB_SERIAL_COMMAND=' /etc/default/grub > /dev/null; then grub_set GRUB_SERIAL_COMMAND 'serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1'
sed -i '/\(^\|#\)GRUB_SERIAL_COMMAND=/c\GRUB_SERIAL_COMMAND="serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1"' /etc/default/grub
else
echo 'GRUB_SERIAL_COMMAND="serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1"' >> /etc/default/grub
fi
# Graphics mode and splash background # Graphics mode and splash background
sed -i '/\(^\|#\)GRUB_GFXMODE=/c\GRUB_GFXMODE=800x600' /etc/default/grub grub_set GRUB_GFXMODE 800x600
sed -i '/\(^\|#\)GRUB_GFXPAYLOAD_LINUX=/c\GRUB_GFXPAYLOAD_LINUX=keep' /etc/default/grub grub_set GRUB_GFXPAYLOAD_LINUX keep
sed -i '/\(^\|#\)GRUB_BACKGROUND=/c\GRUB_BACKGROUND="/boot/grub/splash.png"' /etc/default/grub grub_set GRUB_BACKGROUND '/boot/grub/splash.png'
sed -i '/\(^\|#\)GRUB_THEME=/c\GRUB_THEME="/boot/grub/startos-theme/theme.txt"' /etc/default/grub grub_set GRUB_THEME '/boot/grub/startos-theme/theme.txt'
# Copy splash image and theme to boot partition # Copy splash image and theme to boot partition
if [ -f /usr/lib/startos/splash.png ]; then if [ -f /usr/lib/startos/splash.png ]; then
mkdir -p /boot/grub mkdir -p /boot/grub