This is an exercise in creating a debian package to setup a kiosk system - basically a computer that will only run a web browser e.g. for use as a terminal to use web applications, or as a plublic internet computer.
To build this "web terminal" kiosk system, we need a .deb installer package that will, on a minimal debian (stable) system,
We will not build any software from source, but instead
We split these packages in "dependencies" and "pre-dependencies". By using pre-dependencies for eg. xserver-xfree86 and x-window-system, we make sure that these are installed and configured before the other packages are added. This is not strictly necessary in this case, but gives some control over the order in which packages are installed.
create a working directory, in which you create a 'debian' directory, which in turn has a 'DEBIAN' subdirectory. Refer to "creating a debian package" for details.
As the package will create a user account, and we will want some configuration files in that user's home directory, this account and its home directory will need to exists before we install packages. These will be created in a pre-install script (preinst).
Although Debian no doubt (and for valid reasons) maintains clear and strict rules about how to create and use preinst (and other maintainer scripts), the preinst script is basically a shell script that sits in the DEBIAN directory and lists the actions to be executed before the package installs. The file itself is called preinst.
#!/bin/sh -e # quick and dirty pre-install script for webterm package # # # create a user account 'bibi' echo "creating user account for web kiosk user (bibi)" useradd -m -s /bin/false bibi exit 0
The package may include some customized configuration files, so we'll add those in the appropriate subdirectory of 'debian', and add references to them in DEBIAN/conffiles. Refer to "creating a debian package" for details. This is the place where you would add a bastille configuration or a customized fvwm configuration (re. the multimedia kiosk) or stuff like that.
As a proof-of-concept, we'll add a .xscreensaver configuration file to the user home directory. The easiest way is to run xscreensaver-demo, and then copy the .xscreensaver file from the user home directory. This file can then be included in the package we're building. Likewise, you can create a custom firefox configuration and include the configuration files in the package.
/home/bibi/.xscreensaver
After the installation, we will modify the startup scrips in the rc directories, and change the default runlevel in inittab to make the system boot to the KIOSK (X windows) environment by default, but leave a text mode runlevel for maintenance. This needs to be done after the x-windows-server package has added its startup scripts, so it's a post-install task.
We also did not modify Debian's x-server setup, because that would require modification of the x-server installer package. But we can, afterwards, run knoppix's mkxf86config script and replace the original xfree configuration file. We therefore add those actions to a postinst script.
Like the preinst script, the postinst script is a shell script that lists the actions that we want to execute after the installation of the package(s). The file is called postinst and needs to be added to the DEBIAN directory.
#!/bin/sh -e # quick and dirty post-install script for webterm package # # change xwindows environment # quick&dirty : replace 99xfree86-common_start completely mv /etc/X11/Xsession.d/99xfree86-common_start /etc/X11/Xsession.d/99xfree86-common_start.rmwebterm (echo "xscreensaver&" echo "exec firefox" )> /etc/X11/Xsession.d/99xfree86-common_start echo "no GUI in runlevel 2" mv /etc/rc2.d/S99xdm /etc/rc2.d/s99xdm mv /etc/rc2.d/S20xfs /etc/rc2.d/s20xfs mv /etc/rc2.d/S20xprint /etc/rc2.d/s20xprint` ln -s /etc/init.d/xdm /etc/rc2.d/K01xdm # changing default runlevel cp /etc/inittab /etc/inittab.rmwebterm sed -i -e 's/id:2:initdefault:/id:3:initdefault:/' /etc/inittab # reconfigure xfree server with knoppix utilities #TODO: get user input for these KEYB_MODEL="pc102" KEYB_LAYOUT="be" pushd /etc/X11 for i in $(find XF86Config*); do cp /etc/X11/$i /etc/X11/$i.movedbyKnoppix done echo "detecting hardware " hwsetup -p mkxf86config echo "editing free conf : keyboard model, ...." XWINCONF="XF86Config-4" sed -i 's/"XkbModel".*$/"XkbModel" "$KEYB_MODEL"/' /etc/X11/$XWINCONF sed -i 's/"XkbLayout".*$/"XkbLayout" "$KEYB_LAYOUT"/' /etc/X11/$XWINCONF popd exit 0
This as a very quick and dirty script, and only meant as a first exercise in building packages. Debian has a policy on how maintainer scripts should handle existing files that need to be modified. Debian also expects installer scripts to use specific mechanisms to handle user input and so on. The scripts shown here lack error handling, and if a preinst or postinst script fails, tre installation of the package is aborted. You should also provide 'remove' scripts that undo your changes when the package is removed by the user. These are just a few of the caveats about package maintanance that are totally disregarded in these examples.
the scripts need to be executable, i.e. they need permissions >=0555 and <=0775.
chmod 0775 preinst chmod 0775 postinst
Package: kn-webterm Version: 0.0.1 Section: extra Priority: optional Architecture: i386 Depends: xf86config-knoppix, ddcxinfo-knoppix (<= 0.6-6), hwsetup (<=1.1-1), hwdata-knoppix, xscreensaver, mozilla-firefox Pre-Depends: xserver-xfree86, x-window-system, twm, whois, xterm Installed-Size: 1 Maintainer: Koen NoensDescription: unofficial package -- exercise This package creates a minimal GUI with a web browser to create a web kiosk system. . should be installed on a minimal system (base files only)
.../
|- debian/
|- DEBIAN/
|- control
|- conffiles
|- preinst
|- postinst
|- home/
|- bibi/
|- .xscreensaver
[- etc/
|- (config files would go here - eg)
|- Bastille/
|- config
|- init.d/
|- my_additional_startup_script
]
build the package and publish it as explained in "creating a debian package". You may also want to provide the additional knoppix packages from your private web server, as described here.
To include a preconfigured firefox profile, we might try to add a /etc/mozilla-firefox directory with default custom configuration to the configuration of the package, or include the 'chrome' directory of a model firefox configuration, either as 'config files', by adding them to the $SKEL directory before creating the user account (preinst), or by adding them to the user home directory afterwards (post-install) - see this overview of some Firefox lockdown methods