make kiosk optional; use firefox

This commit is contained in:
Dominic 2023-04-21 14:15:43 +02:00
parent c88b1e2187
commit 9672d0cb55
Signed by: msrd0
GPG key ID: DCC8C247452E98F9
2 changed files with 32 additions and 32 deletions

View file

@ -3,7 +3,7 @@ use serde::Deserialize;
#[derive(Deserialize)] #[derive(Deserialize)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
pub struct Autostart { pub struct Autostart {
pub kiosk: Kiosk pub kiosk: Option<Kiosk>
} }
#[derive(Deserialize)] #[derive(Deserialize)]

View file

@ -16,14 +16,13 @@ pub fn install_packages(img: &Image, setup: &Setup) -> anyhow::Result<()> {
} }
pub fn install_autostart(img: &Image, setup: &Setup) -> anyhow::Result<()> { pub fn install_autostart(img: &Image, setup: &Setup) -> anyhow::Result<()> {
// TODO make the kiosk optional maybe? if let Some(kiosk) = &setup.autostart.kiosk {
let kiosk = &setup.autostart.kiosk;
eprintln!("Installing kiosk ..."); eprintln!("Installing kiosk ...");
run_chroot(img, "root", [ run_chroot(img, "root", [
"apk", "apk",
"add", "add",
"cage", "cage",
"firefox-esr", "firefox",
"font-noto", "font-noto",
"mesa-dri-gallium", "mesa-dri-gallium",
"polkit", "polkit",
@ -42,11 +41,12 @@ pub fn install_autostart(img: &Image, setup: &Setup) -> anyhow::Result<()> {
img, img,
&kiosk.user, &kiosk.user,
format!( format!(
r#"echo 'if [ "$(tty)" == "/dev/tty1" ]; then dbus-run-session cage firefox-esr --kiosk "{}"; fi' >>~/.profile"#, r#"echo 'if [ "$(tty)" == "/dev/tty1" ]; then dbus-run-session cage firefox --kiosk "{}"; fi' >>~/.profile"#,
kiosk.page kiosk.page
) )
.as_str() .as_str()
)?; )?;
}
Ok(()) Ok(())
} }