Skip to content

Commit

Permalink
Update to work with systemd, switch over to use debuild and release b…
Browse files Browse the repository at this point in the history
…uilding

Includes now Vagrantfile to test on Ubuntu and Debian.
  • Loading branch information
Schlomo Schapiro committed May 22, 2017
1 parent 58690cd commit b0608e0
Show file tree
Hide file tree
Showing 25 changed files with 153 additions and 47 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
build/
out/
*.log
debian/kiosk-browser
debian/*debhelper*
debian/*substvars
debian/files
.deps
.vagrant


File renamed without changes.
1 change: 0 additions & 1 deletion DEBIAN/conffiles

This file was deleted.

17 changes: 0 additions & 17 deletions DEBIAN/control

This file was deleted.

78 changes: 54 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,28 +1,58 @@
.PHONY: info repo clean
.PHONY: all build test install clean commit-release release deb repo
PACKAGE=kiosk-browser
SHELL=bash
VERSION := $(shell git rev-list HEAD --count --no-merges)
GIT_STATUS := $(shell git status --porcelain)

*.deb: check_status clean
rm -Rf build
mkdir -p out
cp -r src build
cp -r DEBIAN build
V=$$(git rev-list HEAD | wc -l) ; sed -i -e "s/Version:.*/Version: $$V/" build/DEBIAN/control
git log | gzip -n9 >build/usr/share/doc/kiosk-browser/changelog.gz
chmod -R g-w build
chmod 0440 build/etc/sudoers.d/kiosk-browser
/usr/sbin/visudo -c -f build/etc/sudoers.d/kiosk-browser
fakeroot dpkg -b build out
rm -Rf build
lintian --suppress-tags postrm-contains-additional-updaterc.d-calls -i out/*.deb

info: out/*.deb
dpkg-deb -I out/*.deb
dpkg-deb -c out/*.deb

repo: out/*.deb
../putinrepo.sh out/*.deb

all: build

build:
@echo No build required

commit-release:
ifneq ($(GIT_STATUS),)
$(error Please commit all changes before releasing. $(shell git status 1>&2))
endif
gbp dch --full --release --new-version=$(VERSION) --distribution stable --auto --git-author --commit
git push

release: commit-release deb
@latest_tag=$$(git describe --tags `git rev-list --tags --max-count=1`); \
comparison="$$latest_tag..HEAD"; \
if [ -z "$$latest_tag" ]; then comparison=""; fi; \
changelog=$$(git log $$comparison --oneline --no-merges --reverse); \
github-release schlomo/$(PACKAGE) v$(VERSION) "$$(git rev-parse --abbrev-ref HEAD)" "**Changelog**<br/>$$changelog" 'out/*.deb'; \
git pull
dput ppa:sschapiro/ubuntu/ppa/xenial out/$(PACKAGE)_*_source.changes

test:
./runtests.sh

install:
install -m 0644 00-disable-inputs.conf -D -t $(DESTDIR)/usr/share/X11/xorg.conf.d
install -m 0755 kiosk-browser-control -D -t $(DESTDIR)/usr/bin
install -m 0644 openbox-rc.xml -D -t $(DESTDIR)/usr/share/$(PACKAGE)
install -m 0644 sudoers -D $(DESTDIR)/etc/sudoers.d/$(PACKAGE)
install -m 0644 XOsview -D -t $(DESTDIR)/usr/lib/X11/app-defaults
install -m 0755 xsession.sh -D -t $(DESTDIR)/usr/share/$(PACKAGE)

clean:
rm -fr out build
rm -Rf debian/$(PACKAGE) debian/*debhelper* debian/*substvars debian/files out/*

deb: clean
ifneq ($(MAKECMDGOALS), release)
$(eval DEBUILD_ARGS := -us -uc)
endif
debuild $(DEBUILD_ARGS) -i -b --lintian-opts --profile debian
debuild $(DEBUILD_ARGS) -i -S --lintian-opts --profile debian
mkdir -p out
mv ../$(PACKAGE)*.{xz,dsc,deb,build,changes} out/
cd out ; apt-ftparchive packages . >Packages
dpkg -I out/*.deb
dpkg -c out/*.deb

repo:
../putinrepo.sh out/*.deb

check_status:
@git diff-index --quiet HEAD -- || { echo ; git status -s ; echo -e "\nERROR: All changes must be comitted!\n" ; false ; }
# vim: set ts=4 sw=4 tw=0 noet :
44 changes: 44 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# workaround for vagrant-share error: vagrant plugin install vagrant-share --plugin-version 1.1.8 (from https://github.com/mitchellh/vagrant/issues/8519)
#
# you need the reload plugin: vagrant plugin install vagrant-reload
#
# then vagrant up
#

nodes = [
{ :hostname => 'debian', :box => 'debian/contrib-jessie64', :ram => 1024 },
{ :hostname => 'ubuntu', :box => 'ubuntu/xenial64', :ram => 1024 },
]

$script = <<SCRIPT
set -ex
mount | grep vbox
echo "deb [ trusted=yes ] copy:/packages /" >/etc/apt/sources.list.d/vagrant.list
apt-get update
apt-get -y install kiosk-browser
SCRIPT

Vagrant.configure(2) do |config|
nodes.each do |node|
config.vm.define node[:hostname] do |nodeconfig|
nodeconfig.vm.box = node[:box]
nodeconfig.vm.provider "virtualbox"
nodeconfig.vm.hostname = node[:hostname] + ".box"
# nodeconfig.ssh.insert_key = false
nodeconfig.vm.synced_folder "./", "/vagrant", disabled: true
nodeconfig.vm.synced_folder "out/", "/packages", owner: "root", group: "root", mount_options: ["dmode=777,fmode=666"]
nodeconfig.vm.synced_folder ".deps/apt_archives/", "/var/cache/apt/archives/", create: true, owner: "root", group: "root", mount_options: ["dmode=775,fmode=664"]
nodeconfig.vm.provider :virtualbox do |prov|
prov.gui = true unless ENV['NO_GUI']
prov.customize ["modifyvm", :id, "--boot1", "DVD", "--boot2", "disk",
"--boot3", "none", "--boot4", "none"]

end
nodeconfig.vm.provision "shell", inline: $script
nodeconfig.vm.provision :reload
end
end
end

# -*- mode: ruby -*-
# vi: set ft=ruby
File renamed without changes.
5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
kiosk-browser (100) stable; urgency=medium

* Resume development, see GitHub for older changes

-- Schlomo Schapiro <[email protected]> Mon, 22 May 2017 10:10:10 +0200
1 change: 1 addition & 0 deletions debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9
File renamed without changes.
20 changes: 20 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Source: kiosk-browser
Maintainer: Schlomo Schapiro <[email protected]>
Section: web
Priority: optional
Standards-Version: 3.9.8
Homepage: https://github.com/schlomo/kiosk-browser
Build-Depends: debhelper (>= 9), git-buildpackage, libxml2-utils, sudo, bash (>= 4)

Package: kiosk-browser
Architecture: all
Pre-Depends: nodm
Depends: ${misc:Depends}, xserver-xorg, chromium | chromium-browser, epiphany-browser, uzbl, x11-xserver-utils, xdotool, x11-apps, sudo, imagemagick, debconf, xtightvncviewer, xosd-bin, xosview, openbox
Description: Web Browser for non-interactive use like a web kiosk
Setup system to work as a kiosk browser, showing only a full-screen browser.
.
Configuration options in /etc/default/kiosk-browser
KIOSK_BROWSER_START_PAGE sets the start page
Also add your own customization to that file, e.g. xrandr calls.
.
See project homepage for full list of config options.
File renamed without changes.
2 changes: 2 additions & 0 deletions debian/kiosk-browser.lintian-overrides
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
kiosk-browser: binary-without-manpage usr/bin/kiosk-browser-control
kiosk-browser: postrm-contains-additional-updaterc.d-calls etc/init.d/nodm
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/make -f
%:
dh $@
1 change: 1 addition & 0 deletions debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (native)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions runtests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
function die() { echo 1>&2 ERROR: "$@" ; exit 1 ; }

for s in xsession.sh kiosk-browser-control ; do
bash -n $s || die "$s syntax error"
done

visudo -c -s -f sudoers || die "sudoers syntax error"

xmllint -noout openbox-rc.xml || die "openbox-rc.xml syntax error"
1 change: 0 additions & 1 deletion src/usr/share/lintian/overrides/kiosk-browser

This file was deleted.

File renamed without changes.
8 changes: 4 additions & 4 deletions src/usr/share/kiosk-browser/xsession.sh → xsession.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ done

# show debug info for 60 seconds as overlay
{
echo "Welcome to the Kiosk Browser (http://github.com/ImmobilienScout24/kiosk-browser)"
echo "Welcome to the Kiosk Browser (http://github.com/schlomo/kiosk-browser)"
echo
echo "This is $(uname -n)"
ip a
Expand Down Expand Up @@ -73,7 +73,7 @@ fi

if [[ ! "$KIOSK_BROWSER_START_PAGE" ]] ; then
# point to our github page as built-in default
KIOSK_BROWSER_START_PAGE=https://github.com/ImmobilienScout24/kiosk-browser
KIOSK_BROWSER_START_PAGE=https://github.com/schlomo/kiosk-browser
fi

KIOSK_BROWSER_WATCHDOG_CHECK_INTERVAL="${KIOSK_BROWSER_WATCHDOG_CHECK_INTERVAL:-313}"
Expand Down Expand Up @@ -124,10 +124,10 @@ if (( KIOSK_BROWSER_WATCHDOG_TIMEOUT > 0 )) ; then

LASTHASH=""
LASTCHANGED="$SECONDS"
while sleep $KIOSK_BROWSER_WATCHDOG_CHECK_INTERVAL & wait $! ; do
while sleep $KIOSK_BROWSER_WATCHDOG_CHECK_INTERVAL & wait $! ; do
HASH=$(nice import -display :0 -window root -monochrome jpg:- | nice identify -format '%#' -)
#declare -p HASH LASTHASH LASTCHANGED SECONDS
if [[ "$HASH" = "$LASTHASH" ]] ; then
if [[ "$HASH" = "$LASTHASH" ]] ; then
if (( SECONDS > LASTCHANGED + KIOSK_BROWSER_WATCHDOG_TIMEOUT )) ; then
sudo /sbin/reboot
break
Expand Down

0 comments on commit b0608e0

Please sign in to comment.