forked from msrd0/mkalpiimg
make kiosk optional; use firefox
This commit is contained in:
parent
c88b1e2187
commit
9672d0cb55
2 changed files with 32 additions and 32 deletions
|
@ -3,7 +3,7 @@ use serde::Deserialize;
|
|||
#[derive(Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct Autostart {
|
||||
pub kiosk: Kiosk
|
||||
pub kiosk: Option<Kiosk>
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
|
|
|
@ -16,37 +16,37 @@ pub fn install_packages(img: &Image, setup: &Setup) -> anyhow::Result<()> {
|
|||
}
|
||||
|
||||
pub fn install_autostart(img: &Image, setup: &Setup) -> anyhow::Result<()> {
|
||||
// TODO make the kiosk optional maybe?
|
||||
let kiosk = &setup.autostart.kiosk;
|
||||
eprintln!("Installing kiosk ...");
|
||||
run_chroot(img, "root", [
|
||||
"apk",
|
||||
"add",
|
||||
"cage",
|
||||
"firefox-esr",
|
||||
"font-noto",
|
||||
"mesa-dri-gallium",
|
||||
"polkit",
|
||||
"polkit-elogind"
|
||||
])?;
|
||||
run_chroot(img, "root", [
|
||||
"sed",
|
||||
"-E",
|
||||
"-i",
|
||||
"-e",
|
||||
&format!("/tty1/s,agetty,agetty --autologin {},", kiosk.user),
|
||||
"/etc/inittab"
|
||||
])?;
|
||||
run_chroot(img, &kiosk.user, "[ -e ~/.profile ] || echo '#!/bin/busybox ash' >~/.profile")?;
|
||||
run_chroot(
|
||||
img,
|
||||
&kiosk.user,
|
||||
format!(
|
||||
r#"echo 'if [ "$(tty)" == "/dev/tty1" ]; then dbus-run-session cage firefox-esr --kiosk "{}"; fi' >>~/.profile"#,
|
||||
kiosk.page
|
||||
)
|
||||
.as_str()
|
||||
)?;
|
||||
if let Some(kiosk) = &setup.autostart.kiosk {
|
||||
eprintln!("Installing kiosk ...");
|
||||
run_chroot(img, "root", [
|
||||
"apk",
|
||||
"add",
|
||||
"cage",
|
||||
"firefox",
|
||||
"font-noto",
|
||||
"mesa-dri-gallium",
|
||||
"polkit",
|
||||
"polkit-elogind"
|
||||
])?;
|
||||
run_chroot(img, "root", [
|
||||
"sed",
|
||||
"-E",
|
||||
"-i",
|
||||
"-e",
|
||||
&format!("/tty1/s,agetty,agetty --autologin {},", kiosk.user),
|
||||
"/etc/inittab"
|
||||
])?;
|
||||
run_chroot(img, &kiosk.user, "[ -e ~/.profile ] || echo '#!/bin/busybox ash' >~/.profile")?;
|
||||
run_chroot(
|
||||
img,
|
||||
&kiosk.user,
|
||||
format!(
|
||||
r#"echo 'if [ "$(tty)" == "/dev/tty1" ]; then dbus-run-session cage firefox --kiosk "{}"; fi' >>~/.profile"#,
|
||||
kiosk.page
|
||||
)
|
||||
.as_str()
|
||||
)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue