mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
fix grub config
This commit is contained in:
@@ -292,8 +292,8 @@ fi
|
||||
if [ "${IB_TARGET_PLATFORM}" = "raspberrypi" ]; then
|
||||
ln -sf /usr/bin/pi-beep /usr/local/bin/beep
|
||||
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 initrd.img-${RPI_KERNEL_VERSION}-rpi-2712 ${RPI_KERNEL_VERSION}-rpi-2712
|
||||
mkinitramfs -c gzip -o /boot/initrd.img-${RPI_KERNEL_VERSION}-rpi-v8 ${RPI_KERNEL_VERSION}-rpi-v8
|
||||
mkinitramfs -c gzip -o /boot/initrd.img-${RPI_KERNEL_VERSION}-rpi-2712 ${RPI_KERNEL_VERSION}-rpi-2712
|
||||
fi
|
||||
|
||||
useradd --shell /bin/bash -G startos -m start9
|
||||
|
||||
@@ -1,51 +1,51 @@
|
||||
desktop-image: "/boot/grub/splash.png"
|
||||
desktop-image: "../splash.png"
|
||||
title-color: "#ffffff"
|
||||
title-font: "Unifont Regular 16"
|
||||
title-text: ""
|
||||
title-text: "StartOS Boot Menu with GRUB"
|
||||
message-font: "Unifont Regular 16"
|
||||
terminal-font: "Unifont Regular 16"
|
||||
|
||||
#help bar at the bottom
|
||||
+ label {
|
||||
top = 100%-50
|
||||
left = 0
|
||||
width = 100%
|
||||
height = 20
|
||||
text = "Use the ^ and v keys to select which entry is highlighted."
|
||||
align = "center"
|
||||
color = "#ffffff"
|
||||
font = "Unifont Regular 16"
|
||||
top = 100%-50
|
||||
left = 0
|
||||
width = 100%
|
||||
height = 20
|
||||
text = "@KEYMAP_SHORT@"
|
||||
align = "center"
|
||||
color = "#ffffff"
|
||||
font = "Unifont Regular 16"
|
||||
}
|
||||
|
||||
#boot menu
|
||||
+ boot_menu {
|
||||
left = 10%
|
||||
width = 80%
|
||||
top = 52%
|
||||
height = 48%-80
|
||||
item_color = "#a8a8a8"
|
||||
item_font = "Unifont Regular 16"
|
||||
selected_item_color= "#ffffff"
|
||||
selected_item_font = "Unifont Regular 16"
|
||||
item_height = 16
|
||||
item_padding = 0
|
||||
item_spacing = 4
|
||||
icon_width = 0
|
||||
icon_heigh = 0
|
||||
item_icon_space = 0
|
||||
left = 10%
|
||||
width = 80%
|
||||
top = 52%
|
||||
height = 48%-80
|
||||
item_color = "#a8a8a8"
|
||||
item_font = "Unifont Regular 16"
|
||||
selected_item_color= "#ffffff"
|
||||
selected_item_font = "Unifont Regular 16"
|
||||
item_height = 16
|
||||
item_padding = 0
|
||||
item_spacing = 4
|
||||
icon_width = 0
|
||||
icon_heigh = 0
|
||||
item_icon_space = 0
|
||||
}
|
||||
|
||||
#progress bar
|
||||
+ progress_bar {
|
||||
id = "__timeout__"
|
||||
left = 15%
|
||||
top = 100%-80
|
||||
height = 16
|
||||
width = 70%
|
||||
font = "Unifont Regular 16"
|
||||
text_color = "#000000"
|
||||
fg_color = "#ffffff"
|
||||
bg_color = "#a8a8a8"
|
||||
border_color = "#ffffff"
|
||||
text = "The highlighted entry will be executed automatically in %d seconds."
|
||||
}
|
||||
id = "__timeout__"
|
||||
left = 15%
|
||||
top = 100%-80
|
||||
height = 16
|
||||
width = 70%
|
||||
font = "Unifont Regular 16"
|
||||
text_color = "#000000"
|
||||
fg_color = "#ffffff"
|
||||
bg_color = "#a8a8a8"
|
||||
border_color = "#ffffff"
|
||||
text = "@TIMEOUT_NOTIFICATION_LONG@"
|
||||
}
|
||||
@@ -400,21 +400,52 @@ async fn disk_info(disk: PathBuf) -> DiskInfo {
|
||||
.map_err(|e| {
|
||||
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();
|
||||
let vendor = get_vendor(&disk)
|
||||
.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();
|
||||
let model = get_model(&disk)
|
||||
.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();
|
||||
let capacity = get_capacity(&disk)
|
||||
.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();
|
||||
DiskInfo {
|
||||
logicalname: disk,
|
||||
@@ -431,21 +462,49 @@ async fn part_info(part: PathBuf) -> PartitionInfo {
|
||||
let mut start_os = BTreeMap::new();
|
||||
let label = get_label(&part)
|
||||
.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();
|
||||
let capacity = get_capacity(&part)
|
||||
.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();
|
||||
let mut used = None;
|
||||
|
||||
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) => {
|
||||
used = get_used(mount_guard.path())
|
||||
.await
|
||||
.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();
|
||||
match recovery_info(mount_guard.path()).await {
|
||||
@@ -453,11 +512,21 @@ async fn part_info(part: PathBuf) -> PartitionInfo {
|
||||
start_os = a;
|
||||
}
|
||||
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 {
|
||||
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
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
23
debian/startos/postinst
vendored
23
debian/startos/postinst
vendored
@@ -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_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
|
||||
# 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
|
||||
sed -i '/\(^\|#\)GRUB_TERMINAL_INPUT=/c\GRUB_TERMINAL_INPUT="console serial"' /etc/default/grub
|
||||
sed -i '/\(^\|#\)GRUB_TERMINAL_OUTPUT=/c\GRUB_TERMINAL_OUTPUT="gfxterm serial"' /etc/default/grub
|
||||
grub_set GRUB_TERMINAL_INPUT 'console serial'
|
||||
grub_set GRUB_TERMINAL_OUTPUT 'gfxterm serial'
|
||||
# Remove GRUB_TERMINAL if present (replaced by INPUT/OUTPUT above)
|
||||
sed -i '/^\(#\|\)GRUB_TERMINAL=/d' /etc/default/grub
|
||||
# Serial console settings
|
||||
if grep '^GRUB_SERIAL_COMMAND=' /etc/default/grub > /dev/null; then
|
||||
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
|
||||
grub_set GRUB_SERIAL_COMMAND 'serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1'
|
||||
# Graphics mode and splash background
|
||||
sed -i '/\(^\|#\)GRUB_GFXMODE=/c\GRUB_GFXMODE=800x600' /etc/default/grub
|
||||
sed -i '/\(^\|#\)GRUB_GFXPAYLOAD_LINUX=/c\GRUB_GFXPAYLOAD_LINUX=keep' /etc/default/grub
|
||||
sed -i '/\(^\|#\)GRUB_BACKGROUND=/c\GRUB_BACKGROUND="/boot/grub/splash.png"' /etc/default/grub
|
||||
sed -i '/\(^\|#\)GRUB_THEME=/c\GRUB_THEME="/boot/grub/startos-theme/theme.txt"' /etc/default/grub
|
||||
grub_set GRUB_GFXMODE 800x600
|
||||
grub_set GRUB_GFXPAYLOAD_LINUX keep
|
||||
grub_set GRUB_BACKGROUND '/boot/grub/splash.png'
|
||||
grub_set GRUB_THEME '/boot/grub/startos-theme/theme.txt'
|
||||
# Copy splash image and theme to boot partition
|
||||
if [ -f /usr/lib/startos/splash.png ]; then
|
||||
mkdir -p /boot/grub
|
||||
|
||||
Reference in New Issue
Block a user