arm
All checks were successful
ci/woodpecker/push/build Pipeline was successful

This commit is contained in:
JMARyA 2025-04-08 22:01:02 +02:00
parent 5d23197394
commit 1ae8c47392
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
6 changed files with 97 additions and 14 deletions

View file

@ -1,12 +1,13 @@
# Maintainer: JMARyA <jmarya@hydrar.de> # Maintainer: JMARyA <jmarya@hydrar.de>
pkgname=navinstall pkgname=navinstall
pkgver=main pkgver=2025.04.08_5d23197
pkgrel=1 pkgrel=1
pkgdesc="navOS Installer" pkgdesc="navOS Installer"
arch=('x86_64') arch=('x86_64' 'aarch64')
url="https://git.hydrar.de/navos/navinstall" url="https://git.hydrar.de/navos/navinstall"
license=("MIT") license=("MIT")
depends=("arch-install-scripts" "archiso" "sbctl" "sbsigntools" "git") depends=("arch-install-scripts" "archiso" "git")
optdepends=('sbctl' 'sbsigntools')
makedepends=("rustup" "git") makedepends=("rustup" "git")
source=("${pkgname}::git+https://git.hydrar.de/navos/navinstall.git") source=("${pkgname}::git+https://git.hydrar.de/navos/navinstall.git")
sha256sums=("SKIP") sha256sums=("SKIP")

View file

@ -8,12 +8,15 @@ use crate::{
/// Setup initramfs /// Setup initramfs
pub fn setup_mkinitcpio(conf: &DriveConfig) { pub fn setup_mkinitcpio(conf: &DriveConfig) {
print_status("Writing /etc/mkinitcpio.d/linux.preset"); #[cfg(target_arch = "x86_64")]
install_file( {
"/mnt/etc/mkinitcpio.d/linux.preset", print_status("Writing /etc/mkinitcpio.d/linux.preset");
include_str!("../root/mkinitcpio/linux.preset"), install_file(
0o644, "/mnt/etc/mkinitcpio.d/linux.preset",
); include_str!("../root/mkinitcpio/linux.preset"),
0o644,
);
}
// Set kernel cmdline // Set kernel cmdline
std::fs::create_dir_all("/mnt/etc/kernel").unwrap(); std::fs::create_dir_all("/mnt/etc/kernel").unwrap();

View file

@ -51,7 +51,7 @@ pub mod zram;
use crate::{ use crate::{
config::InstallConfig, config::InstallConfig,
pkg::{install_pkgs, pacstrap}, pkg::{self, install_pkgs, pacstrap},
}; };
/// Uncomment the first occurrence of a specified value in a file. /// Uncomment the first occurrence of a specified value in a file.
@ -127,6 +127,11 @@ pub fn install_mnt(conf: InstallConfig, bare: bool) {
// Configuration // Configuration
first_boot_values(&conf.general); first_boot_values(&conf.general);
if !matches!(conf.general.mode, crate::config::InstallMode::Base) {
setup_navos();
}
setup_skel(&conf.general); setup_skel(&conf.general);
setup_users(&conf.user.as_ref().unwrap_or(&Vec::new())); setup_users(&conf.user.as_ref().unwrap_or(&Vec::new()));
setup_ssh(&conf.ssh); setup_ssh(&conf.ssh);
@ -138,8 +143,7 @@ pub fn install_mnt(conf: InstallConfig, bare: bool) {
setup_desktop(&conf); setup_desktop(&conf);
} }
crate::config::InstallMode::Server => { crate::config::InstallMode::Server => {
setup_navos(); install_pkgs(&pkg::SERVER_PKG);
install_pkgs(&["navos_server"]);
} }
crate::config::InstallMode::Kiosk => { crate::config::InstallMode::Kiosk => {
// TODO // TODO

View file

@ -1,6 +1,6 @@
use crate::{ use crate::{
config::{InstallConfig, InstallMode}, config::{InstallConfig, InstallMode},
linux::{arch_chroot, run_command, systemd_service_enable}, linux::{arch_chroot, run_command_noerr, systemd_service_enable},
pkg::install_pkgs, pkg::install_pkgs,
print_status, print_status,
}; };
@ -33,7 +33,7 @@ pub fn setup_virtualization(conf: &InstallConfig) {
/// Setup guest utils if running inside a VM /// Setup guest utils if running inside a VM
pub fn setup_vm() { pub fn setup_vm() {
let res = run_command(&["systemd-detect-virt", "--vm"], None, false); let res = run_command_noerr(&["systemd-detect-virt", "--vm"], None, false);
let is_vm = res.0.trim(); let is_vm = res.0.trim();
match is_vm { match is_vm {

View file

@ -7,6 +7,49 @@ pub fn is_root() -> bool {
getuid() == Uid::from_raw(0) getuid() == Uid::from_raw(0)
} }
pub fn run_command_noerr(cmd: &[&str], input: Option<&str>, inherit: bool) -> (String, String) {
print_status(&cmd.join(" "));
let mut cmd_setup = std::process::Command::new(cmd[0]);
let mut cmd_setup = cmd_setup.args(cmd.iter().skip(1).collect::<Vec<_>>());
if inherit {
assert!(input.is_none());
cmd_setup = cmd_setup
.stdout(std::process::Stdio::inherit())
.stdin(std::process::Stdio::inherit());
} else {
cmd_setup = cmd_setup.stdout(std::process::Stdio::piped());
}
if input.is_some() {
cmd_setup = cmd_setup.stdin(std::process::Stdio::piped());
}
let mut child = cmd_setup.spawn().unwrap();
if let Some(input) = input {
let stdin = child.stdin.as_mut().unwrap();
stdin.write_all(input.as_bytes()).unwrap();
stdin.flush().unwrap();
}
let status = child.wait_with_output().unwrap();
let output = String::from_utf8(status.stdout).unwrap();
let stderr = String::from_utf8(status.stderr).unwrap();
if !stderr.trim().is_empty() && !inherit {
eprintln!("{stderr}");
}
if !inherit {
println!("{output}");
}
(output, stderr)
}
pub fn run_command(cmd: &[&str], input: Option<&str>, inherit: bool) -> (String, String) { pub fn run_command(cmd: &[&str], input: Option<&str>, inherit: bool) -> (String, String) {
print_status(&cmd.join(" ")); print_status(&cmd.join(" "));

View file

@ -3,6 +3,32 @@ use crate::{
linux::{arch_chroot, run_command}, linux::{arch_chroot, run_command},
}; };
pub const DESKTOP_PKG: [&str; 17] = [
// Desktop
"plasma",
"sddm",
// Sound
"pipewire",
"pipewire-alsa",
"pipewire-pulse",
"pipewire-jack",
"wireplumber",
// Applications
"konsole",
"dolphin",
"ffmpegthumbs",
"kate",
"okular",
"gwenview",
"ark",
"flatpak",
// Misc
"navos/navos",
"man",
];
pub const SERVER_PKG: [&str; 2] = ["tmux", "navos/navos"];
/// Install packages to the chroot environment at `/mnt` /// Install packages to the chroot environment at `/mnt`
pub fn install_pkgs(pkg: &[&str]) { pub fn install_pkgs(pkg: &[&str]) {
let mut cmd = vec!["pacman", "-Syu"]; let mut cmd = vec!["pacman", "-Syu"];
@ -32,8 +58,14 @@ pub fn pacstrap(conf: &PackageConfig) {
"zsh", "zsh",
"zsh-completions", "zsh-completions",
"zsh-autosuggestions", "zsh-autosuggestions",
"plymouth",
]; ];
#[cfg(target_arch = "aarch64")]
{
cmd.extend(&["archlinuxarm-keyring"]);
}
cmd.extend( cmd.extend(
&conf &conf
.pkg .pkg