mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
fix install over 0.3.5.1
This commit is contained in:
@@ -154,9 +154,12 @@ prompt 0
|
||||
timeout 50
|
||||
EOF
|
||||
|
||||
cp $SOURCE_DIR/splash.png config/bootloaders/syslinux_common/splash.png
|
||||
cp $SOURCE_DIR/splash.png config/bootloaders/isolinux/splash.png
|
||||
cp $SOURCE_DIR/splash.png config/bootloaders/grub-pc/splash.png
|
||||
# Extract splash.png from the deb package
|
||||
dpkg-deb --fsys-tarfile $DEB_PATH | tar --to-stdout -xf - ./usr/lib/startos/splash.png > /tmp/splash.png
|
||||
cp /tmp/splash.png config/bootloaders/syslinux_common/splash.png
|
||||
cp /tmp/splash.png config/bootloaders/isolinux/splash.png
|
||||
cp /tmp/splash.png config/bootloaders/grub-pc/splash.png
|
||||
rm /tmp/splash.png
|
||||
|
||||
sed -i -e '2i set timeout=5' config/bootloaders/grub-pc/config.cfg
|
||||
|
||||
|
||||
51
build/lib/grub-theme/theme.txt
Normal file
51
build/lib/grub-theme/theme.txt
Normal file
@@ -0,0 +1,51 @@
|
||||
desktop-image: "/boot/grub/splash.png"
|
||||
title-color: "#ffffff"
|
||||
title-font: "Unifont Regular 16"
|
||||
title-text: ""
|
||||
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"
|
||||
}
|
||||
|
||||
#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
|
||||
}
|
||||
|
||||
#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."
|
||||
}
|
||||
|
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 9.6 KiB |
@@ -2,10 +2,12 @@ use std::path::{Path, PathBuf};
|
||||
|
||||
use gpt::GptConfig;
|
||||
use gpt::disk::LogicalBlockSize;
|
||||
use tokio::process::Command;
|
||||
|
||||
use crate::disk::OsPartitionInfo;
|
||||
use crate::os_install::partition_for;
|
||||
use crate::prelude::*;
|
||||
use crate::util::Invoke;
|
||||
|
||||
pub async fn partition(
|
||||
disk_path: &Path,
|
||||
@@ -113,11 +115,8 @@ pub async fn partition(
|
||||
// Check if protected partition would be overwritten by OS partitions
|
||||
if let Some((first_lba, _, ref path)) = protected_partition_info {
|
||||
// Get the actual end sector of the last OS partition (root = partition 3)
|
||||
let os_partitions_end_sector = gpt
|
||||
.partitions()
|
||||
.get(&3)
|
||||
.map(|p| p.last_lba)
|
||||
.unwrap_or(0);
|
||||
let os_partitions_end_sector =
|
||||
gpt.partitions().get(&3).map(|p| p.last_lba).unwrap_or(0);
|
||||
if first_lba <= os_partitions_end_sector {
|
||||
return Err(Error::new(
|
||||
eyre!(
|
||||
@@ -176,6 +175,28 @@ pub async fn partition(
|
||||
.await
|
||||
.unwrap()?;
|
||||
|
||||
// Re-read partition table and wait for udev to create device nodes
|
||||
Command::new("vgchange")
|
||||
.arg("-an")
|
||||
.invoke(crate::ErrorKind::DiskManagement)
|
||||
.await
|
||||
.ok();
|
||||
Command::new("dmsetup")
|
||||
.arg("remove_all")
|
||||
.arg("--force")
|
||||
.invoke(crate::ErrorKind::DiskManagement)
|
||||
.await
|
||||
.ok();
|
||||
Command::new("blockdev")
|
||||
.arg("--rereadpt")
|
||||
.arg(&disk_path)
|
||||
.invoke(crate::ErrorKind::DiskManagement)
|
||||
.await?;
|
||||
Command::new("udevadm")
|
||||
.arg("settle")
|
||||
.invoke(crate::ErrorKind::DiskManagement)
|
||||
.await?;
|
||||
|
||||
Ok(OsPartitionInfo {
|
||||
efi: efi.then(|| partition_for(&disk_path, 1)),
|
||||
bios: (!efi).then(|| partition_for(&disk_path, 1)),
|
||||
|
||||
@@ -2,10 +2,12 @@ use std::path::{Path, PathBuf};
|
||||
|
||||
use color_eyre::eyre::eyre;
|
||||
use mbrman::{CHS, MBR, MBRPartitionEntry};
|
||||
use tokio::process::Command;
|
||||
|
||||
use crate::disk::OsPartitionInfo;
|
||||
use crate::os_install::partition_for;
|
||||
use crate::prelude::*;
|
||||
use crate::util::Invoke;
|
||||
|
||||
pub async fn partition(
|
||||
disk_path: &Path,
|
||||
@@ -139,6 +141,28 @@ pub async fn partition(
|
||||
.await
|
||||
.unwrap()?;
|
||||
|
||||
// Re-read partition table and wait for udev to create device nodes
|
||||
Command::new("vgchange")
|
||||
.arg("-an")
|
||||
.invoke(crate::ErrorKind::DiskManagement)
|
||||
.await
|
||||
.ok();
|
||||
Command::new("dmsetup")
|
||||
.arg("remove_all")
|
||||
.arg("--force")
|
||||
.invoke(crate::ErrorKind::DiskManagement)
|
||||
.await
|
||||
.ok();
|
||||
Command::new("blockdev")
|
||||
.arg("--rereadpt")
|
||||
.arg(&disk_path)
|
||||
.invoke(crate::ErrorKind::DiskManagement)
|
||||
.await?;
|
||||
Command::new("udevadm")
|
||||
.arg("settle")
|
||||
.invoke(crate::ErrorKind::DiskManagement)
|
||||
.await?;
|
||||
|
||||
Ok(OsPartitionInfo {
|
||||
efi: None,
|
||||
bios: None,
|
||||
|
||||
@@ -490,7 +490,10 @@ pub async fn exit(ctx: SetupContext) -> Result<(), Error> {
|
||||
None
|
||||
};
|
||||
|
||||
ctx.shutdown.send(shutdown).expect("failed to shutdown");
|
||||
ctx.shutdown
|
||||
.send(shutdown)
|
||||
.map_err(|e| eyre!("failed to shutdown: {e}"))
|
||||
.log_err();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -505,7 +508,8 @@ pub async fn restart(ctx: SetupContext) -> Result<(), Error> {
|
||||
disk_guid: ctx.disk_guid.get().cloned(),
|
||||
restart: true,
|
||||
}))
|
||||
.expect("failed to shutdown");
|
||||
.map_err(|e| eyre!("failed to shutdown: {e}"))
|
||||
.log_err();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -520,7 +524,8 @@ pub async fn shutdown(ctx: SetupContext) -> Result<(), Error> {
|
||||
disk_guid: ctx.disk_guid.get().cloned(),
|
||||
restart: false,
|
||||
}))
|
||||
.expect("failed to shutdown");
|
||||
.map_err(|e| eyre!("failed to shutdown: {e}"))
|
||||
.log_err();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -168,6 +168,12 @@ impl VersionT for Version {
|
||||
|
||||
let tor_keys = previous_tor_keys(&pg).await?;
|
||||
|
||||
Command::new("systemctl")
|
||||
.arg("stop")
|
||||
.arg("postgresql@*.service")
|
||||
.invoke(crate::ErrorKind::Database)
|
||||
.await?;
|
||||
|
||||
Ok((account, ssh_keys, cifs, tor_keys))
|
||||
}
|
||||
fn up(
|
||||
|
||||
21
debian/startos/postinst
vendored
21
debian/startos/postinst
vendored
@@ -23,12 +23,31 @@ 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
|
||||
sed -i '/\(^\|#\)GRUB_TERMINAL=/c\GRUB_TERMINAL="serial"\nGRUB_SERIAL_COMMAND="serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1"' /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
|
||||
# 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
|
||||
# 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
|
||||
# Copy splash image and theme to boot partition
|
||||
if [ -f /usr/lib/startos/splash.png ]; then
|
||||
mkdir -p /boot/grub
|
||||
cp /usr/lib/startos/splash.png /boot/grub/splash.png
|
||||
fi
|
||||
if [ -d /usr/lib/startos/grub-theme ]; then
|
||||
mkdir -p /boot/grub/startos-theme
|
||||
cp -r /usr/lib/startos/grub-theme/* /boot/grub/startos-theme/
|
||||
fi
|
||||
fi
|
||||
|
||||
VERSION="$(cat /usr/lib/startos/VERSION.txt)"
|
||||
|
||||
Reference in New Issue
Block a user