Operating System

Traditionally arcade machines run games but we call them Projects, because software written in Snap! does not necesarily need to be a game.

Snap projects run inside a browser. We use Chromium for that.

Arcade machine users need a way to select and run the projects. We use another, lesser known browser, Midori to display the Main Menu.

The Main Menu works like this. Projects are listed on the left and are navigated Up and Down with either of the joysticks. Details of the highlighted project are displayed on the right. Any of the 'Fire' buttons start the highlighted project (in the Chromium browser). The center button stops (pkill) the project.

This is achieved by running a lightweight http server locally on the machine. When the machine boots, the server is started. It servers index.html (the Main Menu) to the Midori browser and exposes two endpoints, http://localhost/listProjects and http://localhost/start, that are called via javascript in index.html

Installation

The Arcade machine runs Debian version 9 operating system. Download it here. Burn the ISO to a USB device and install.

During the installation create a user called arcade The path /home/arcade is hard-wired into the software.

Software selection

When selecting pakages, install "Standard system" only.

Do not install a Desktop environment such as Gnome, KDE, or any other.

After the Debian installation has finished, reboot and install these packages.

apt-get update && apt-get -y upgrade 
apt-get -y install sudo ssh xinit openbox lxterminal git curl python-pip python-virtualenv midori chromium
apt-get clean

Gunicorn listens on ip4. Unfortunatley Midori calls locahost on ip6. No problem, let's disable ip6

echo net.ipv6.conf.all.disable_ipv6=1 > /etc/sysctl.d/disableipv6.conf

Install the HTTP server

We use a simple HTTP server written in Flask to create an interface that lists, selects, and runs Snap! projects.

Login as the user 'arcade'

cd /home/arcade
virtualenv venv
source /home/arcade/venv/bin/activate
pip install flask lxml gunicorn

Clone the software

cd /home/arcade
git clone https://gitlab.com/Arcade-DIWO/project-manager.git arcade
git clone https://gitlab.com/Arcade-DIWO/common-projects.git arcade/projects/common
mkdir /home/arcade/arcade/projects/local
ln -s /home/arcade/arcade/projects/ /home/arcade/arcade/server/static/

git clone https://github.com/jmoenig/Snap--Build-Your-Own-Blocks arcade/snap
ln -s /home/arcade/arcade/snap/ /home/arcade/arcade/server/static/
cp /home/arcade/arcade/server/static/raleway/Raleway-Light.ttf /home/arcade/.fonts/
cp /home/arcade/arcade/server/config.cfg.example /home/arcade/arcade/server/config.cfg

Edit /home/arcade/arcade/server/config.cfg

Configure openbox

mkdir -p /home/arcade/.config/openbox
cp -r /etc/xdg/openbox/* /home/arcade/.config/openbox/

Edit /home/arcade/.config/openbox/rc.xml and add a to the section

<openbox_config xmlns="http://openbox.org/3.4/rc" xmlns:xi="http://www.w3.org/2001/XInclude">
   <keyboard>
      .....
      <keybind key="b">
      <action name="Execute"><command>pkill chromium</command></action>
      </keybind>
      .....
   </keyboard>
</openbox_config>

Now the Key 'b' will kill the Chromium browser running the Snap! projects. This efectively takes the user back to the Main menu.

Autostart gunicorn and midori

Edit /home/arcade/.config/openbox/autostart and add..

/home/arcade/arcade/bash/start-server &
sleep 2
/usr/bin/midori -e Fullscreen -a http://localhost:8000 &

Autologin and hide mouse

Login as root and install and configure.

apt-get install lightdm

Edit /etc/lightdm/lightdm.conf

[Seat:*]
xserver-command =X -nocursor
autologin-user= arcade

Update the server software and snap project repos

30 seconds after booting (when we have a network), we run a script to update server software and Snap! projects.

Edit /etc/systemd/system/arcade-update.service

[Unit]
Description=Update Arcade
Wants=network-online.target
After=network.target network-online.target

[Service]
ExecStart=/home/arcade/arcade/bash/update.sh

[Install]
WantedBy=multi-user.target

Save that file and now enable it

systemctl enable arcade-update.service