Install Playwright to control Firefox
[Playwright] is a cross-browser automation framework, intended for automating browser-based GUI application tests. It also works as a general remote-control tool for automating basically anything having to do with a browser. Playwright requires a special Firefox binary that it manages itself. To avoid downloading and installing Playwright and Firefox, and thus storing them in memory, we need them to be already available in the rootfs image. Since I want the control software to be updated easily, without rebooting the machine, I decided to separate it into its own project, [Voonex]. A short shell script to install/update and run it is launched by the systemd user instance. [Playwright]: https://playwright.dev/ [Voonex]: https://git.pyrocufflink.blue/dustin/voonexpull/1/head
parent
4ec3117b3c
commit
a3c2afc3fa
|
@ -10,6 +10,7 @@ RUN dnf install -y \
|
||||||
findutils \
|
findutils \
|
||||||
make \
|
make \
|
||||||
openssh-clients \
|
openssh-clients \
|
||||||
|
python3-pip \
|
||||||
rsync \
|
rsync \
|
||||||
squashfs-tools \
|
squashfs-tools \
|
||||||
tar \
|
tar \
|
||||||
|
|
16
mkrootfs.sh
16
mkrootfs.sh
|
@ -19,7 +19,6 @@ echo install_weak_deps=False >> "${destdir}"/etc/dnf/dnf.conf
|
||||||
dnf --installroot "${destdir}" install -y \
|
dnf --installroot "${destdir}" install -y \
|
||||||
bcm2711-firmware \
|
bcm2711-firmware \
|
||||||
dracut-network \
|
dracut-network \
|
||||||
firefox \
|
|
||||||
hostname \
|
hostname \
|
||||||
kmod \
|
kmod \
|
||||||
mesa-dri-drivers \
|
mesa-dri-drivers \
|
||||||
|
@ -65,6 +64,21 @@ chroot "${destdir}" systemctl enable \
|
||||||
systemd-timesyncd \
|
systemd-timesyncd \
|
||||||
xinit@user
|
xinit@user
|
||||||
|
|
||||||
|
if ! [ -f "${destdir}"/usr/local/bin/playwright ]; then
|
||||||
|
python3 -m pip \
|
||||||
|
install \
|
||||||
|
--prefix "${destdir}"/usr/local \
|
||||||
|
playwright
|
||||||
|
fi
|
||||||
|
if ! [ -d "${destdir}"/usr/local/ms-playwright ]; then
|
||||||
|
py_site_dir=$(
|
||||||
|
"${destdir}"/usr/bin/python3 -c 'import site;print(site.getsitepackages()[0])'
|
||||||
|
)
|
||||||
|
PLAYWRIGHT_BROWSERS_PATH="${destdir}"/usr/local/ms-playwright \
|
||||||
|
PYTHONPATH="${destdir}${py_site_dir}" \
|
||||||
|
python3 -m playwright install firefox
|
||||||
|
fi
|
||||||
|
|
||||||
umask 0022
|
umask 0022
|
||||||
mksquashfs "${destdir}" "${destdir}/boot/${dest}" \
|
mksquashfs "${destdir}" "${destdir}/boot/${dest}" \
|
||||||
-comp lz4 \
|
-comp lz4 \
|
||||||
|
|
|
@ -14,7 +14,7 @@ TTYPath=/dev/tty7
|
||||||
StandardInput=tty
|
StandardInput=tty
|
||||||
StandardOutput=journal
|
StandardOutput=journal
|
||||||
StandardError=journal
|
StandardError=journal
|
||||||
ExecStart=/usr/bin/startx
|
ExecStart=/usr/bin/startx -- -nocursor
|
||||||
Restart=always
|
Restart=always
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Basement HUD
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
Environment=PLAYWRIGHT_BROWSERS_PATH=/usr/local/ms-playwright
|
||||||
|
ExecStart=/usr/local/bin/basementhud
|
|
@ -1,9 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=Firefox web browser
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
ExecStart=/usr/bin/firefox
|
|
||||||
Restart=always
|
|
||||||
StandardInput=null
|
|
||||||
StandardOutput=journal
|
|
|
@ -1,4 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=Graphical Interface
|
|
||||||
After=default.target
|
|
||||||
AllowIsolate=yes
|
|
|
@ -1 +0,0 @@
|
||||||
../firefox.service
|
|
|
@ -3,5 +3,5 @@
|
||||||
xset s off
|
xset s off
|
||||||
xset -dpms
|
xset -dpms
|
||||||
systemctl --user import-environment DISPLAY
|
systemctl --user import-environment DISPLAY
|
||||||
systemctl --user start graphical.target
|
systemctl --user start basementhud.service
|
||||||
exec openbox
|
exec openbox
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
python3 -m ensurepip
|
||||||
|
python3 -m pip install -U pip
|
||||||
|
python3 -m pip install \
|
||||||
|
--user \
|
||||||
|
--find-links https://files.pyrocufflink.blue/wheels/voonex \
|
||||||
|
--upgrade \
|
||||||
|
voonex
|
||||||
|
exec python3 -m voonex
|
Loading…
Reference in New Issue