Skip to content
This repository has been archived by the owner on Mar 12, 2019. It is now read-only.

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
robbi5 committed Sep 30, 2012
0 parents commit 13e27c4
Show file tree
Hide file tree
Showing 10 changed files with 334 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
@@ -0,0 +1,6 @@
# OS generated files
.DS_Store
.DS_Store?
._*
Icon?
Thumbs.db
72 changes: 72 additions & 0 deletions README.md
@@ -0,0 +1,72 @@
# About piscreen

*piscreen* is a small, Chromium based, Kiosk/Digital Signage solution for the [Raspberry Pi](http://raspberrypi.org).


The difference to other signage-software like [Screeny OSE](https://github.com/wireload/screenly-ose) is that it supports just one static URL that it displays - but it provides nice error screens when your network/the internet is not reachable.

# Installation
## 1. Preparing the SD card

1. Get the latest [MoebiusLinux](http://moebiuslinux.sourceforge.net/) for your Raspberry Pi and write it to the SD card with dd (on Linux & Mac):

tar -zxvf moebius.minimal.image.1.0.1.tar.gz
dd bs=1M if=moebius.minimal.image of=/dev/sdX

You can also write to the SD card with [Win32DiskImager](https://wiki.ubuntu.com/Win32DiskImager) if you are using Windows.

2. Insert the SD in the Raspberry Pi and power it on

## 2. Basic (manual) Updating & Configuration

1. Log in as *root* with the Password: *raspi*. If the password doesn't work look in the [Moebius FAQ](http://moebiuslinux.sourceforge.net/documentation/faq/).

2. A basic auto-configuration tool should appear (if not, start `raspi-config`).

Set your keyboard-layout, timezone, overscan-settings (if you see black borders on your screen), overclock (tip: use Medium) and resize the root partition. A reboot should happen. After the resizing login again.

3. Update the System

apt-get update
apt-get -y dist-upgrade

If a conflict happens for `/etc/skel.d/bashrc` press `Y`.

4. Change the password of root: `passwd`

5. Reboot the Pi: `reboot`

## 3. Setup the automatic installation

1. Login again as *root* with your new password.

2. Install Git: `apt-get install git-core`

3. Checkout the files of this repo: `git clone https://github.com/robbi5/piscreen.git ./`

4. Run the automatic installer: `bash setup.sh`

## 4. Fill your piscreen configuration

Insert the SD card in your regular computer and edit the `piscreen.txt` in the root folder of the SD card.
Attention: You must not use spaces between the key, the = and the value.

## 5. Test and run

Insert the SD card back into the Raspberry Pi and power it on. It should now boot, open chrome in fullscreen with your desired URL.

To shutdown it nicely, press `ALT+F4`, rightclick, choose *Terminal* and enter `sudo poweroff`.

# Todo

* Read the hostname from `piscreen.txt` and set it on boot.
* Add a wallpaper, overlay start-time, hostname and current ip
* Support proxies

# Thanks

[Screeny OSE](https://github.com/wireload/screenly-ose) and the [Raspberry Pi forums](http://www.raspberrypi.org/forum) for the inspiration.

[hexxeh](http://hexxeh.net) for the [RPi Binaries of Chromium](http://hexxeh.net/?p=328117859).

ben for [Moebius Linux](http://moebiuslinux.sourceforge.net), a minimal installation of [Raspbian](http://raspbian.org).
8 changes: 8 additions & 0 deletions piscreen.example.txt
@@ -0,0 +1,8 @@
# piscreen config file
# syntax: key=value. NO SPACE BETWETEEN key/value and =

# Hostname of this screen. You can reach it via <hostname>.local
hostname=piscreen-1

# URL to open
url=http://time.is
7 changes: 7 additions & 0 deletions piscreen/autostart
@@ -0,0 +1,7 @@
xset s off # don't activate screensaver
xset -dpms # disable DPMS (Energy Star) features.
xset s noblank # don't blank the video device

hsetroot -fill ~/wallpaper.jpg &
unclutter &
~/piscreen/start-browser.sh &
29 changes: 29 additions & 0 deletions piscreen/no-config-file.html
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>No configuration found</title>
<style>
html,body { margin:0; padding:0; }
html {
background: #191919 -webkit-linear-gradient(top, #000 0%, #191919 100%) no-repeat;
background: #191919 linear-gradient(to bottom, #000 0%, #191919 100%) no-repeat;
}
body {
font-family: sans-serif;
color: #FFF;
text-align: center;
font-size: 150%;
}
h1, h2 { font-weight: normal; }
h1 { margin: 0 auto; padding: 0.15em; font-size: 10em; text-shadow: 0 2px 2px #000; }
h2 { margin-bottom: 2em; }
</style>
</head>
<body>
<h1></h1>
<h2>No configuration found</h2>
<p>This Display is missing the configuration file.</p>
<p class="desc">Please shut down the device, insert the SD-Card into your computer and create a <code>piscreen.txt</code> in the root folder of the card.</p>
</body>
</html>
29 changes: 29 additions & 0 deletions piscreen/no-internet-connection.html
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>No connection to the internet</title>
<style>
html,body { margin:0; padding:0; }
html {
background: #191919 -webkit-linear-gradient(top, #000 0%, #191919 100%) no-repeat;
background: #191919 linear-gradient(to bottom, #000 0%, #191919 100%) no-repeat;
}
body {
font-family: sans-serif;
color: #FFF;
text-align: center;
font-size: 150%;
}
h1, h2 { font-weight: normal; }
h1 { margin: 0 auto; padding: 0.15em; font-size: 10em; text-shadow: 0 2px 2px #000; }
h2 { margin-bottom: 2em; }
</style>
</head>
<body>
<h1></h1>
<h2>No connection to the internet</h2>
<p>This Display has a connection to your network but no connection to the internet.</p>
<p class="desc">The connection to the outside world is needed for updates and keeping the time.</p>
</body>
</html>
29 changes: 29 additions & 0 deletions piscreen/no-network-connection.html
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>No connection to your network</title>
<style>
html,body { margin:0; padding:0; }
html {
background: #191919 -webkit-linear-gradient(top, #000 0%, #191919 100%) no-repeat;
background: #191919 linear-gradient(to bottom, #000 0%, #191919 100%) no-repeat;
}
body {
font-family: sans-serif;
color: #FFF;
text-align: center;
font-size: 150%;
}
h1, h2 { font-weight: normal; }
h1 { margin: 0 auto; padding: 0.15em; font-size: 10em; text-shadow: 0 2px 2px #000; }
h2 { margin-bottom: 2em; }
</style>
</head>
<body>
<h1></h1>
<h2>No connection to your network</h2>
<p>This Display has no connection to your network because it got no ip-address.</p>
<p class="desc">Please verify the cable is properly seated or give this computer an static ip-address.</p>
</body>
</html>
29 changes: 29 additions & 0 deletions piscreen/no-url-in-config.html
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>No start URL found</title>
<style>
html,body { margin:0; padding:0; }
html {
background: #191919 -webkit-linear-gradient(top, #000 0%, #191919 100%) no-repeat;
background: #191919 linear-gradient(to bottom, #000 0%, #191919 100%) no-repeat;
}
body {
font-family: sans-serif;
color: #FFF;
text-align: center;
font-size: 150%;
}
h1, h2 { font-weight: normal; }
h1 { margin: 0 auto; padding: 0.15em; font-size: 10em; text-shadow: 0 2px 2px #000; }
h2 { margin-bottom: 2em; }
</style>
</head>
<body>
<h1></h1>
<h2>No start URL found</h2>
<p>This display is missing the URL to the website it should display.</p>
<p class="desc">Please add the start URL to the <code>piscreen.txt</code> in the root folder of the SD-card like this: <code>url=http://google.com</code></p>
</body>
</html>
61 changes: 61 additions & 0 deletions piscreen/start-browser.sh
@@ -0,0 +1,61 @@
#!/bin/bash

echo "piscreen: start browser"
cd "$( dirname "${BASH_SOURCE[0]}" )"

HOSTNAME=`hostname`
IPV4=`ip addr | sed -e's/^.*inet \([^ ]*\)\/.*$/\1/;t;d' | grep -v "127.0.0.1"`
IPV6=`ip addr | sed -e's/^.*inet6 \([^ ]*\)\/.*$/\1/;t;d' | grep -v "::1" | tr '\n' ' '`

HAS_NETWORK_CONNECTIFITY=0
HAS_INTERNET_CONNECTIFITY=0
if [ -n "$IPV4" ] || [ -n "$IPV6" ]; then
HAS_NETWORK_CONNECTIFITY=1
fi

ping -c1 8.8.8.8 > /dev/null
if [ "$?" -eq 0 ]; then
HAS_INTERNET_CONNECTIFITY=1
fi

echo "IPv4: $IPV4"
echo "IPv6: $IPV6"
echo "NET: $HAS_NETWORK_CONNECTIFITY"
echo "WWW: $HAS_INTERNET_CONNECTIFITY"

# todo: create wallpaper, write connection details, set wallpaper

URLTOOPEN=""
if [ "$HAS_NETWORK_CONNECTIFITY" -eq "0" ]; then
URLTOOPEN="no-network-connection.html"
fi
if [ -z "$URLTOOPEN" ] && [ "$HAS_INTERNET_CONNECTIFITY" -eq "0" ]; then
URLTOOPEN="no-internet-connection.html"
fi
if [ -z "$URLTOOPEN" ]; then
if [ ! mountpoint -q /boot ] || [ ! -e /boot/piscreen.txt ]; then
URLTOOPEN="no-config-file.html"
fi
fi
if [ -e /boot/piscreen.txt ]; then
while read propline ; do
# ignore comment lines
echo "$propline" | grep "^#" >/dev/null 2>&1 && continue
# if not empty, set the property using declare
[ ! -z "$propline" ] && declare $propline
done < /boot/piscreen.txt

if [ -z "$URLTOOPEN" ]; then
if [ -z "$url" ]; then
URLTOOPEN="no-url-in-config.html"
else
URLTOOPEN="$url"
fi
fi
fi

echo "Starting Chrome..."
echo "URL: $URLTOOPEN"

# using --incognito for ignoring session restore after a power loss
chrome --noerrdialogs --disable-translate --disable-sync --incognito --kiosk "$URLTOOPEN" &
64 changes: 64 additions & 0 deletions setup.sh
@@ -0,0 +1,64 @@
#!/bin/bash

echo "Installing piscreen"

if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi

echo "Checking for IPv6..."
if [ `lsmod | grep -o ^ipv6` ]; then
echo "IPv6 is already enabled. Good!"
else
rm /etc/sysctl.d/disableipv6.conf
modprobe ipv6
echo "ipv6" >> /etc/modules
fi

echo "Installing dependencies"
apt-get -y install openbox evilvte hsetroot x11-xserver-utils unclutter avahi-daemon imagemagick chkconfig xinit nodm watchdog

echo "Creating screen user"
useradd -m screen

echo "Installing nodm auto login"
sed -e 's/NODM_ENABLED=.*$/NODM_ENABLED=true/g' -i /etc/default/nodm
sed -e "s/NODM_USER=.*$/NODM_USER=screen/" -i /etc/default/nodm

echo "Enabling Watchdog"
modprobe bcm2708_wdog
cp /etc/modules /etc/modules.bak
sed '$ i\bcm2708_wdog' -i /etc/modules
chkconfig watchdog on
cp /etc/watchdog.conf /etc/watchdog.conf.bak
sed -e 's/#watchdog-device/watchdog-device/g' -i /etc/watchdog.conf
/etc/init.d/watchdog start

echo "Adding piscreen config-file"
cp ./piscreen.example.txt /boot/piscreen.txt
chmod ugo+r /boot/piscreen.txt

echo "Installing Google Chrome"
bash <(curl -sL http://goo.gl/5vuJI)
update-alternatives --install /usr/bin/x-www-browser x-www-browser /usr/bin/chrome 100

echo "Creating openbox autostart"
mkdir /home/screen/.config
mkdir /home/screen/.config/openbox
touch /home/screen/.config/openbox/autostart
echo "~/piscreen/autostart &" >> /home/screen/.config/openbox/autostart
chown -R screen /home/screen/.config

echo "Copying piscreen files"
cp -r ./piscreen /home/screen/
chown -R screen /home/screen/piscreen
chmod +x /home/screen/piscreen/start-browser.sh

echo "Allowing screen shutdown"
echo "screen ALL=(ALL) NOPASSWD: /sbin/shutdown, /sbin/poweroff, /sbin/reboot" >> /etc/sudoers

# echo "Adding shutdown-menu entries"
# FIXME: add openbox menu.xml with entries for shutdown & restart

echo "Assuming no errors were encountered, go ahead and restart the pi."

0 comments on commit 13e27c4

Please sign in to comment.