Take the reboot at the end of this process. Once back you should have the signage login screen with “Welcome to PIXEL” graphic on the screen. Lets continue……

Since my workstation is on the same network as the Pi I can do the following, if you’re not, you can always login (remember the password) using keyboard and issue the command “sudo ifconfig” to find the IP address of your Pi.

Use “ssh pi@signage.local” to login to the Pi from your workstation (on windows you need a program like putty to facilitate ssh connections).

Disable swap and filesystem check and make the system read-only. Edit /boot/cmdline.txt and add “fastboot noswap ro” to the end of the line (see below) to disable filesystem check at boot, turn off swap file usage and make the system read-only.

A small annoyance is the fact that sshd needs to read the logs and print out the Last Login information. We can disable that by modifying the file /etc/ssh/sshd_config and changing “PrintLastLog yes” to “PrintLastLog no”.

We also need to fix the DHCP startup script. Edit /etc/systemd/system/dhcpcd5 and change “PIDFile=/run/dhcpcd.pid” to “PIDFile=/var/run/dhcpcd.pid”. It should look like this when done:

Now you need to fix the systemd service file to kickstart the random-seed service. For this we need to add the line ExecStartPre=/bin/echo "" >/tmp/random-seed to the service section of /lib/systemd/system/systemd-random-seed.service. The file will look like this once this is done:

# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=Load/Save Random Seed
Documentation=man:systemd-random-seed.service(8) man:random(4)
DefaultDependencies=no
RequiresMountsFor=/var/lib/systemd/random-seed
Conflicts=shutdown.target
After=systemd-readahead-collect.service systemd-readahead-replay.service systemd-remount-fs.service
Before=sysinit.target shutdown.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStartPre=/bin/echo "" >/tmp/random-seed
ExecStart=/lib/systemd/systemd-random-seed load
ExecStop=/lib/systemd/systemd-random-seed save

Run “systemctl daemon-reload” to reload and finalize the changes we just made.

Remove some of the startup scripts using “insserv -r bootlogs; insserv -r console-setup” and change the file /etc/fstab to reflect these changes. Mine looked like this to start with:

At this point you can reboot, BUT you’ll come back in read-only mode. You could continue and take the reboot later. To change the filesystem between read-only (ro) and read-write (rw) you can use “mount -o remount,rw /” and “mount -o remount,ro /” commands.

To make life simpler we add the following to the end of /etc/bash.bashrc to introduce the “rw” and “ro” aliases and add filesystem mode indication to the shell prompt:

Okay so if you’ve made it this far you should be able to reboot and get a stable read-only system up and running after the reboot. Remember that “rw” and “ro” commands will allow you to toggle between read-only and read-write mode. I will not be mentioning this anymore after this point. You WILL need to be in read-write mode to perform the rest of these tutorial.

The main script that will run the show is below. Copy and paste it into /root/signage.sh (Yes, the name and location is very important as the script recursively calls itself. You can change this, but you need to edit the contents of the file aswell……you’ve been warned):

Note that you can change the stream links above to whatever you want. Also the main if…elif…else…fi loop should be changed if you decide to use other command line parameters. But assuming you’re here and want to do a quick check, save the file (remember I’m assuming you’re in rw mode from here on), change it’s permissions via “chmod 700 signage.sh” and run it “./signage.sh”. Hopefully you have 5Mb/s bandwidth and in a few seconds can see the default signage from my school. If not stop here and troubleshoot the script. Use omxplayer from command line to see what’s going on.

Next we need to “teach” our FLIRC USB dongle what buttons do what. Grab the remote control you have and plugin the FLIRC dongle into a Mac or PC. Download the software to configure it from FLIRC’s website. Now use the software to configure the following correspondence:

F1 to 1 (on remote)

F2 to 2 (on remote)

……

F10 to 0 (on remote)

You Can add more commands to the dongle later, this is just to get us started.

Take the dongle and plug it into the Pi. Run “thd –dump /dev/input/event0” and start pressing buttons on your remote. Did you get output like below (If yes continue, otherwise unplug all USB devices from the Pi and replug JUST the FLIRC into USB, this should force it to become “event0” input device)? Good……onwards……

Triggerhappy (thd) runs under nobody in raspbian, so we need to give nobody some special sudo privileges. There might be other ways to do this, but I found this simple enough. Create a new file “/etc/sudoers.d/020_nobody-nopasswd” with the following line in it:

Now we need to tell thd what to do when we press buttons on our remote. Remember FLIRC turns IR commands to keyboard presses (F1-F10), so here we configure Triggerhappy to run commands based on buttons pushed (incidentally the commands in this file are the ones we specified above to allow nobody group to sudo. Anyways, edit /etc/triggerhappy/triggers.d/signage.conf” file and add the following contents to it:

At this point if you want to auto start the signage at boot (with option to change the stream using remote) add the following line to your /etc/rc.local file:

We can take a reboot now and make sure things are working. Your default channel (from last step) should autoload now. You should also be able to switch channels using remote. If you disconnect the ethernet cable and reconnect it again later the same stream should continue playing.

You’re done……Congratulations. Might want to make a image of this microsd card and then run “rpi-update” to update to the latest firmware/kernel. This is sometimes risky hence why I said make a image first.