Skip to content

Commit

Permalink
Add Kiosk containers from home:atgracey:wallboardos
Browse files Browse the repository at this point in the history
  • Loading branch information
dcermak committed Jan 17, 2025
1 parent d411741 commit b4e784a
Show file tree
Hide file tree
Showing 4 changed files with 176 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/bci_build/package/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1474,6 +1474,9 @@ def generate_disk_size_constraints(size_gb: int) -> str:
from .golang import GOLANG_CONTAINERS # noqa: E402
from .helm import HELM_CONTAINERS # noqa: E402
from .kea import KEA_DHCP_CONTAINERS # noqa: E402
from .kiosk import FIREFOX_CONTAINERS # noqa: E402
from .kiosk import PULSEAUDIO_CONTAINERS # noqa: E402
from .kiosk import X11_APP_BASE_CONTAINERS # noqa: E402
from .kiwi import KIWI_CONTAINERS # noqa: E402
from .kubectl import KUBECTL_CONTAINERS # noqa: E402
from .mariadb import MARIADB_CLIENT_CONTAINERS # noqa: E402
Expand Down Expand Up @@ -1545,6 +1548,9 @@ def generate_disk_size_constraints(size_gb: int) -> str:
*KEA_DHCP_CONTAINERS,
*KUBECTL_CONTAINERS,
*STUNNEL_CONTAINERS,
*X11_APP_BASE_CONTAINERS,
*FIREFOX_CONTAINERS,
*PULSEAUDIO_CONTAINERS,
)
}

Expand Down
125 changes: 125 additions & 0 deletions src/bci_build/package/kiosk.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
"""Build descriptions for the containerized kiosk containers (X11+auxiliary
apps).
"""

from pathlib import Path

from bci_build.os_version import ALL_NONBASE_OS_VERSIONS
from bci_build.os_version import CAN_BE_LATEST_OS_VERSION
from bci_build.package import ApplicationStackContainer
from bci_build.package import DevelopmentContainer
from bci_build.package import ParseVersion
from bci_build.package import Replacement
from bci_build.package.helpers import generate_package_version_check
from bci_build.package.versions import get_pkg_version

X11_APP_BASE_CONTAINERS = [
DevelopmentContainer(
name="x11app-base",
os_version=os_version,
tag_version=(tag_ver := "21"),
is_latest=os_version in CAN_BE_LATEST_OS_VERSION,
version=(xorg_server_re := "%%xorg_server_ver%%"),
pretty_name="X11 App Base Development",
package_list=[
"xorg-x11-fonts",
"libX11-xcb1",
"libgtk-3-0",
"libpulse0",
"libasound2",
"mozilla-nss",
"libxshmfence1libdrm",
"libgdm1npm-default",
"nodejs-default",
],
replacements_via_service=[
Replacement(
xorg_server_re,
package_name="xorg-x11-server",
parse_version=ParseVersion.MINOR,
)
],
custom_end=generate_package_version_check(
"xorg-x11-server", tag_ver, ParseVersion.MINOR
)
+ """
RUN useradd -m user -u 1000
ENV DISPLAY=":0"
""",
)
for os_version in ALL_NONBASE_OS_VERSIONS
]


_PULSE_FILES = {
"client.conf": """autospawn = no
auto-connect-localhost = yes
""",
"daemon.conf": """daemonize = no
fail = no
; allow-module-loading = yes
allow-exit = no
use-pid-file = no
system-instance = yes
""",
"system.pa": (Path(__file__).parent / "pulseaudio" / "system.pa").read_text(),
}

PULSEAUDIO_CONTAINERS = [
ApplicationStackContainer(
name="pulseaudio",
os_version=os_version,
tag_version=(tag_ver := "17"),
is_latest=os_version in CAN_BE_LATEST_OS_VERSION,
version=(pulseaudio_ver_re := "%%pulseaudio_ver%%"),
pretty_name="Pulseaudio",
package_list=["pulseaudio", "pulseaudio-utils"],
replacements_via_service=[
Replacement(
pulseaudio_ver_re,
package_name="pulseaudio",
parse_version=ParseVersion.MINOR,
)
],
extra_files=_PULSE_FILES,
custom_end=generate_package_version_check(
"pulseaudio", tag_ver, ParseVersion.MINOR
)
+ """
COPY daemon.conf /etc/pulse/
COPY client.conf /etc/pulse/
COPY system.pa /etc/pulse/
""",
)
for os_version in ALL_NONBASE_OS_VERSIONS
]


FIREFOX_CONTAINERS = [
DevelopmentContainer(
name="Firefox",
os_version=os_version,
tag_version=(ff_ver := get_pkg_version("MozillaFirefox", os_version)),
is_latest=os_version in CAN_BE_LATEST_OS_VERSION,
version=(ff_ver_re := "%%ff_ver%%"),
pretty_name="Mozilla Firefox",
package_list=["MozillaFirefox"],
replacements_via_service=[
Replacement(
ff_ver_re,
package_name="MozillaFirefox",
parse_version=ParseVersion.MINOR,
)
],
cmd=["/bin/bash", "-c", "firefox --kiosk $URL"],
custom_end=generate_package_version_check(
"MozillaFirefox", ff_ver, ParseVersion.MINOR
)
+ """
RUN useradd -m user -u 1000
ENV DISPLAY=":0"
""",
)
for os_version in ALL_NONBASE_OS_VERSIONS
]
6 changes: 6 additions & 0 deletions src/bci_build/package/package_versions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"MozillaFirefox": {
"6": "128.6",
"7": "128.6",
"Tumbleweed": "134.0",
"version_format": "minor"
},
"cosign": {
"5": "2.4",
"6": "2.4",
Expand Down
39 changes: 39 additions & 0 deletions src/bci_build/package/pulseaudio/system.pa
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/pulseaudio -nF
.fail

### Automatically restore the volume of streams and devices
load-module module-device-restore
load-module module-stream-restore
load-module module-card-restore

load-module module-udev-detect

### Load several protocols
.ifexists module-esound-protocol-unix.so
load-module module-esound-protocol-unix
.endif
load-module module-native-protocol-unix auth-anonymous=1

load-module module-native-protocol-tcp auth-anonymous=1 auth-ip-acl=127.0.0.1

load-module module-default-device-restore

### Make sure we always have a sink around, even if it is a null sink.
load-module module-always-sink

### Automatically suspend sinks/sources that become idle for too long
load-module module-suspend-on-idle

### Enable positioned event sounds
load-module module-position-event-sounds

.nofail

### Set the default sink
#set-default-sink alsa_output.pci-0000_00_1b.0.analog-stereo

### Set default sink volume to 100%
set-sink-volume @DEFAULT_SINK@ 0x10000

### Unmute default sink
set-sink-mute @DEFAULT_SINK@ 0

0 comments on commit b4e784a

Please sign in to comment.