Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Kiosk containers from home:atgracey:wallboardos #2210

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/bci_build/package/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1469,6 +1469,7 @@ def generate_disk_size_constraints(size_gb: int) -> str:
from .basecontainers import MICRO_CONTAINERS # noqa: E402
from .basecontainers import MINIMAL_CONTAINERS # noqa: E402
from .cosign import COSIGN_CONTAINERS # noqa: E402
from .firefox import FIREFOX_CONTAINERS # noqa: E402
from .gcc import GCC_CONTAINERS # noqa: E402
from .git import GIT_CONTAINERS # noqa: E402
from .golang import GOLANG_CONTAINERS # noqa: E402
Expand All @@ -1483,6 +1484,7 @@ def generate_disk_size_constraints(size_gb: int) -> str:
from .php import PHP_CONTAINERS # noqa: E402
from .postfix import POSTFIX_CONTAINERS # noqa: E402
from .postgres import POSTGRES_CONTAINERS # noqa: E402
from .pulseaudio import PULSEAUDIO_CONTAINERS # noqa: E402
from .python import PYTHON_3_6_CONTAINERS # noqa: E402
from .python import PYTHON_3_11_CONTAINERS # noqa: E402
from .python import PYTHON_3_12_CONTAINERS # noqa: E402
Expand Down Expand Up @@ -1547,6 +1549,8 @@ def generate_disk_size_constraints(size_gb: int) -> str:
*KUBECTL_CONTAINERS,
*STUNNEL_CONTAINERS,
*XORG_CONTAINERS,
*FIREFOX_CONTAINERS,
*PULSEAUDIO_CONTAINERS,
)
}

Expand Down
52 changes: 52 additions & 0 deletions src/bci_build/package/firefox.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
"""Build description for the Firefox container for the containerized kiosk
containers.

"""

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 ParseVersion
from bci_build.package import Replacement
from bci_build.package.kiosk import KIOSK_EXCLUSIVE_ARCH

FIREFOX_CONTAINERS = [
ApplicationStackContainer(
name=("kiosk-firefox" if os_version.is_tumbleweed else "kiosk-firefox-esr"),
os_version=os_version,
is_latest=os_version in CAN_BE_LATEST_OS_VERSION,
exclusive_arch=KIOSK_EXCLUSIVE_ARCH,
version=(ff_ver_re := "%%ff_ver%%"),
version_in_uid=False,
pretty_name="Mozilla Firefox",
package_list=(
[
"MozillaFirefox",
# for fonts to actually display
"xorg-x11-fonts",
]
+ (
["MozillaFirefox-branding-openSUSE"]
if os_version.is_tumbleweed
else [
"MozillaFirefox-branding-SLE",
# required by Firefox via /usr/bin/gconftool-2
# to be fixed via FileProvides
"gconf2",
]
)
),
replacements_via_service=[
Replacement(
ff_ver_re,
package_name="MozillaFirefox",
parse_version=ParseVersion.MINOR,
)
],
cmd=["/bin/bash", "-c", "firefox --kiosk $URL"],
custom_end="""RUN useradd -m user -u 1000
ENV DISPLAY=":0"
""",
)
for os_version in ALL_NONBASE_OS_VERSIONS
]
54 changes: 54 additions & 0 deletions src/bci_build/package/pulseaudio.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
"""Build description of the pulseaudio container, which is part of the
containerized kiosk

"""

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 ParseVersion
from bci_build.package import Replacement
from bci_build.package.helpers import generate_package_version_check
from bci_build.package.kiosk import KIOSK_EXCLUSIVE_ARCH

_PULSE_FILES = {
"client.conf": (
(_pa_dir := (Path(__file__).parent) / "pulseaudio") / "client.conf"
).read_text(),
"daemon.conf": (_pa_dir / "daemon.conf").read_text(),
"system.pa": (_pa_dir / "system.pa").read_text(),
}

PULSEAUDIO_CONTAINERS = [
ApplicationStackContainer(
name="pulseaudio",
os_version=os_version,
tag_version=(tag_ver := "17"),
version_in_uid=False,
exclusive_arch=KIOSK_EXCLUSIVE_ARCH,
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,
cmd=["/usr/bin/pulseaudio"],
custom_end=generate_package_version_check(
"pulseaudio", tag_ver, ParseVersion.MAJOR
)
+ """
COPY daemon.conf /etc/pulse/
COPY client.conf /etc/pulse/
COPY system.pa /etc/pulse/
""",
)
for os_version in ALL_NONBASE_OS_VERSIONS
]
2 changes: 2 additions & 0 deletions src/bci_build/package/pulseaudio/client.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
autospawn = no
auto-connect-localhost = yes
6 changes: 6 additions & 0 deletions src/bci_build/package/pulseaudio/daemon.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
daemonize = no
fail = no
; allow-module-loading = yes
allow-exit = no
use-pid-file = no
system-instance = yes
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