summaryrefslogtreecommitdiff
path: root/internet-kiosk-management/sbin
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2012-08-20 15:41:45 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2012-08-20 15:41:45 +0200
commitf9c4beddd50d7fd38f6adfb339df6f26538715f5 (patch)
tree876052eee86fa4b1fdf14020d6e8c3af785d560d /internet-kiosk-management/sbin
downloadinternet-kiosk-f9c4beddd50d7fd38f6adfb339df6f26538715f5.tar.gz
internet-kiosk-f9c4beddd50d7fd38f6adfb339df6f26538715f5.tar.bz2
internet-kiosk-f9c4beddd50d7fd38f6adfb339df6f26538715f5.zip
initial commit, adapted from x2gothinclient 1.0.1.8
Diffstat (limited to 'internet-kiosk-management/sbin')
-rwxr-xr-xinternet-kiosk-management/sbin/ik_cleanup74
-rwxr-xr-xinternet-kiosk-management/sbin/ik_create174
-rwxr-xr-xinternet-kiosk-management/sbin/ik_preptftpboot103
-rwxr-xr-xinternet-kiosk-management/sbin/ik_shell87
-rwxr-xr-xinternet-kiosk-management/sbin/ik_update74
-rwxr-xr-xinternet-kiosk-management/sbin/ik_upgrade85
6 files changed, 597 insertions, 0 deletions
diff --git a/internet-kiosk-management/sbin/ik_cleanup b/internet-kiosk-management/sbin/ik_cleanup
new file mode 100755
index 0000000..8be800b
--- /dev/null
+++ b/internet-kiosk-management/sbin/ik_cleanup
@@ -0,0 +1,74 @@
+#!/bin/bash
+
+# Copyright (C) 2012 by Debian Edu project, http://wiki.debian.org/DebianEdu
+# Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
+
+# Internet Kiosk is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# Internet Kiosk is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the
+# Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+
+set -e
+
+if echo $0 | egrep "^./bin/.*$" >/dev/null; then
+ ETCDIR="etc/"
+elif echo $0 | egrep "^./ik_.*$" >/dev/null; then
+ ETCDIR="../etc"
+else
+ ETCDIR=/etc/internet-kiosk
+fi
+
+source $ETCDIR/ik_settings
+
+IK_BASE="${IK_BASE:-/opt/internet-kiosk}"
+IK_CHROOT="${IK_CHROOT:-$IK_BASE/chroot}"
+IK_CONFIG="${IK_CONFIG:-$IK_BASE/etc}"
+IK_TFTP_BOOT="${IK_TFTP_BOOT:-/srv/tftp}"
+
+[ "x$USER" == "xroot" ] || {
+ echo "ERROR: Internet Kiosk Diskless Terminal management scripts have to run as super-user root."
+ exit -2
+}
+
+echo "Internet Kiosk Diskless Terminal cleanup..."
+echo "-------------------------------------------"
+
+echo "Hit <RETURN> to purge all Internet Kiosk Diskless Terminal related files (chroot, config, PXE boot env)..."
+echo "Alternatively, hit STRG-C to cancel the operation now!!!"
+read
+
+# CHROOT + DTE config
+test -e "$IK_CHROOT" && {
+ echo "Removing $IK_CHROOT..."
+ rm -Rf "${IK_CHROOT}"
+} || {
+ echo "WARNING: Internet Kiosk Diskless Terminal chroot does not exist at $IK_CHROOT. No cleanup necessary..."
+}
+test -e "$IK_CONFIG" && {
+ echo "Removing $IK_CONFIG..."
+ rm -Rf "${IK_CONFIG}"
+} || {
+ echo "WARNING: Internet Kiosk Diskless Terminal config does not exist at $IK_CONFIG. No cleanup necessary..."
+}
+
+### PXE/Syslinux
+test -e "$IK_TFTP_BOOT/pxelinux.cfg" && {
+ echo "Emptying $IK_TFTP_BOOT..."
+ rm -Rf "${IK_TFTP_BOOT}"/*
+} || {
+ echo "WARNING: Internet Kiosk PXE/Syslinux boot environment does not exist at $IK_TFTP_BOOT. No cleanup necessary..."
+}
+
+echo
+echo "Internet Kiosk Diskless Terminal cleanup is DONE."
+echo
diff --git a/internet-kiosk-management/sbin/ik_create b/internet-kiosk-management/sbin/ik_create
new file mode 100755
index 0000000..3546228
--- /dev/null
+++ b/internet-kiosk-management/sbin/ik_create
@@ -0,0 +1,174 @@
+#!/bin/bash
+
+# Copyright (C) 2012 by Debian Edu project, http://wiki.debian.org/DebianEdu
+# Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
+
+# Internet Kiosk is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# Internet Kiosk is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the
+# Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+
+set -e
+
+if echo $0 | egrep "^./bin/.*$" >/dev/null; then
+ ETCDIR="etc/"
+ SHAREDIR="share/"
+elif echo $0 | egrep "^./ik_.*$" >/dev/null; then
+ ETCDIR="../etc"
+ SHAREDIR="../share/"
+else
+ ETCDIR=/etc/internet-kiosk
+ SHAREDIR="/usr/share/internet-kiosk/"
+fi
+
+source $ETCDIR/ik_settings
+
+IK_BASE="${IK_BASE:-/opt/internet-kiosk}"
+IK_CHROOT="${IK_CHROOT:-$IK_BASE/chroot}"
+IK_CONFIG="${IK_CONFIG:-$IK_BASE/etc}"
+IK_DEBMIRROR_URL="${IK_DEBMIRROR_URL:-'http://ftp.debian.org/debian'}"
+IK_EXTRA_DEBURL="${IK_EXTRA_DEBURL:-'deb http://packages.it-zukunft-schule.de squeeze main'}"
+IK_MODULE_BLACKLIST="${IK_MODULE_BLACKLIST:-'pcspkr'}"
+
+test -e "$IK_CHROOT" && {
+ echo "ERROR: Internet Kiosk Terminal chroot already exists at $IK_CHROOT."
+ echo "Clear $IK_BASE/ and then run $(basename $0) again..."
+ exit -1
+}
+
+[ "x$USER" == "xroot" ] || {
+ echo "ERROR: Internet Kiosk Diskless Terminal management scripts have to run as super-user root."
+ exit -2
+}
+
+echo "Hit <RETURN> to continue with the Internet Kiosk Terminal's chroot creation using the above parameters..."
+echo "Alternatively, hit STRG-C to cancel the operation now!!!"
+read
+
+export LANG=C
+
+mkdir -p $IK_CONFIG
+test -f $IK_CONFIG/ik_init || cp $SHAREDIR/ik_init $IK_CONFIG
+test -f $IK_CONFIG/ik_start || cp $SHAREDIR/ik_start $IK_CONFIG
+
+apt-get install debootstrap
+mkdir -p $IK_CHROOT
+
+# use a proxy server for APT (if any is configured)
+export http_proxy="$IK_HTTP_PROXY"
+export https_proxy="$IK_HTTPS_PROXY"
+export ftp_proxy="$IK_FTP_PROXY"
+
+debootstrap --arch i386 stable $IK_CHROOT/ $IK_DEBMIRROR_URL
+cp /etc/resolv.conf $IK_CHROOT/etc/resolv.conf
+echo "auto lo" >> $IK_CHROOT/etc/network/interfaces
+echo "iface lo inet loopback" >> $IK_CHROOT/etc/network/interfaces
+echo "localhost" > $IK_CHROOT/etc/hostname
+echo "127.0.0.1 localhost" >> $IK_CHROOT/etc/hosts
+cat > $IK_CHROOT/etc/fstab <<EOF
+#proc /proc proc defaults 0 0
+none /dev/pts devpts gid=5,mode=620 0 0
+none /tmp tmpfs size=50M,mode=1777 0 0
+none /root tmpfs size=100M,mode=700 0 0
+none /etc/udev/rules.d tmpfs size=50M 0 0
+none /var/run tmpfs size=50M 0 0
+none /var/log tmpfs size=50M 0 0
+none /var/lock tmpfs size=50M 0 0
+none /home tmpfs size=50M 0 0
+none /media tmpfs size=50M 0 0
+none /var/lib/nfs tmpfs size=50M 0 0
+none /var/lib/xkb tmpfs size=50M 0 0
+none /var/lib/dbus tmpfs size=50M 0 0
+none /var/lib/alsa tmpfs size=50M 0 0
+EOF
+
+
+cat > $IK_CHROOT/ikdt_install.sh <<EOF
+#!/bin/bash
+
+export LANG=C
+mount /proc
+mount /dev/pts
+export HOME=/root
+export http_proxy=$IK_HTTP_PROXY
+export https_proxy=$IK_HTTPS_PROXY
+export ftp_proxy=$IK_FTP_PROXY
+
+mkdir -p /tmp/user/0
+mkdir -p /var/lib/xkb
+mkdir -p /var/lib/nfs
+mkdir -p /var/lib/dbus
+mkdir -p /etc/network
+ln -sf /dev/shm /etc/network/run
+
+# disable service restarts
+test -e /sbin/start-stop-daemon.keep || mv /sbin/start-stop-daemon /sbin/start-stop-daemon.keep
+echo '#!/bin/sh' > /sbin/start-stop-daemon
+echo 'exit 0' >> /sbin/start-stop-daemon
+chmod +x /sbin/start-stop-daemon
+
+[ \$? -eq 0 ] && test -n "$IK_EXTRA_DEBURL" && echo "$IK_EXTRA_DEBURL" > /etc/apt/sources.list.d/itzks.list
+[ \$? -eq 0 ] && test -n "$IK_EXTRA_DEBURL" && apt-get update
+[ \$? -eq 0 ] && test -n "$IK_EXTRA_DEBURL" && apt-get install itzks-keyring -y --force-yes
+[ \$? -eq 0 ] && apt-get update
+[ \$? -eq 0 ] && apt-get install $IK_SHELL -y
+[ \$? -eq 0 ] && apt-get install syslinux locales -y
+[ \$? -eq 0 ] && dpkg-reconfigure locales
+[ \$? -eq 0 ] && apt-get install linux-image-486 -y
+[ \$? -eq 0 ] && mv /vmlinuz /vmlinuz.486
+[ \$? -eq 0 ] && mv /initrd.img /initrd.img.486
+[ \$? -eq 0 ] && apt-get install linux-image-686 -y
+[ \$? -eq 0 ] && mv /vmlinuz /vmlinuz.686
+[ \$? -eq 0 ] && mv /initrd.img /initrd.img.686
+[ \$? -eq 0 ] && apt-get install internet-kiosk -y
+
+# blacklist kernel modules
+[ \$? -eq 0 ] && echo && echo "# modules blacklisted on Internet Kiosk Diskless Terminals..." >> /etc/modprobe.d/blacklist.conf
+[ \$? -eq 0 ] && for mod in $IK_MODULE_BLACKLIST; do echo "blacklist \$mod" >> /etc/modprobe.d/blacklist.conf; done
+
+# Pulsaudio must come afterwards
+[ \$? -eq 0 ] && apt-get install alsa-base pulseaudio -y
+[ \$? -eq 0 ] && apt-get install patch -y
+[ \$? -eq 0 ] && patch /etc/initramfs-tools/initramfs.conf <<PATCH
+39c39
+< BOOT=local
+---
+> BOOT=nfs
+PATCH
+[ \$? -eq 0 ] && rm -f /etc/udev/rules.d/*-persistent-*.rules
+[ \$? -eq 0 ] && useradd internet-kiosk
+[ \$? -eq 0 ] && adduser internet-kiosk audio
+[ \$? -eq 0 ] && adduser internet-kiosk pulse
+[ \$? -eq 0 ] && adduser pulse audio
+[ \$? -eq 0 ] && update-initramfs -u -v
+[ \$? -eq 0 ] && passwd -l root
+
+# tweak mtab diversion
+[ \$? -eq 0 ] && rm -f /etc/mtab
+[ \$? -eq 0 ] && ln -sf /proc/mounts /etc/mtab
+
+# restore start-stop-daemon
+[ \$(stat --format '%s' /sbin/start-stop-daemon) -lt 200 ] && mv /sbin/start-stop-daemon.keep /sbin/start-stop-daemon
+
+umount -l /proc &>/dev/null
+umount -l /dev/pts &>/dev/null
+EOF
+chmod u+x $IK_CHROOT/ikdt_install.sh
+chroot $IK_CHROOT /ikdt_install.sh
+
+rm -f $IK_CHROOT/etc/udev/rules.d/*-persistent-*.rules
+
+ik_update
+
+echo "Internet Kiosk Diskless Terminal creation has finished successfully."
+echo
diff --git a/internet-kiosk-management/sbin/ik_preptftpboot b/internet-kiosk-management/sbin/ik_preptftpboot
new file mode 100755
index 0000000..db0c28a
--- /dev/null
+++ b/internet-kiosk-management/sbin/ik_preptftpboot
@@ -0,0 +1,103 @@
+#!/bin/bash
+
+# Copyright (C) 2012 by Debian Edu project, http://wiki.debian.org/DebianEdu
+# Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
+
+# Internet Kiosk is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# Internet Kiosk is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the
+# Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+
+set -e
+
+if echo $0 | egrep "^./bin/.*$" >/dev/null; then
+ ETCDIR="etc/"
+ SHAREDIR="share/"
+elif echo $0 | egrep "^./ik_.*$" >/dev/null; then
+ ETCDIR="../etc"
+ SHAREDIR="../share/"
+else
+ ETCDIR=/etc/internet-kiosk
+ SHAREDIR="/usr/share/internet-kiosk"
+fi
+
+source $ETCDIR/ik_settings
+
+IK_BASE="${IK_BASE:-/opt/internet-kiosk}"
+IK_CHROOT="${IK_CHROOT:-$IK_BASE/chroot}"
+IK_TFTP_FILES="${IK_TFTP_FILES:-$SHAREDIR/tftpboot}"
+IK_TFTP_BOOT="${IK_TFTP_BOOT:-/srv/tftp}"
+
+mkdir -p "$IK_TFTP_BOOT"
+
+test -e "$IK_TFTP_BOOT/pxelinux.cfg" && {
+ echo "PXE boot files already found at $IK_TFTP_BOOT."
+ echo "Clear $IK_TFTP_BOOT/ and then run $(basename $0) again..."
+ exit -1
+}
+
+[ "x$USER" == "xroot" ] || {
+ echo "ERROR: Internet Kiosk Diskless Terminal management scripts have to run as super-user root."
+ exit -2
+}
+
+echo "Preparing PXE boot configuration for Internet Kiosk Terminals..."
+echo "----------------------------------------------------------------"
+echo
+
+echo "Copying the Internet Kiosk Terminal's TFTP (syslinux) template files..."
+cp -av "$IK_TFTP_FILES"/* "$IK_TFTP_BOOT"
+echo
+
+echo "Linking files for the Internet Kiosk Terminal's TFTP (syslinux) boot environment..."
+cd "$IK_TFTP_BOOT"
+
+# 486 kernel image
+ln -sfv "$IK_CHROOT/vmlinuz.486" "$IK_TFTP_BOOT/vmlinuz.486"
+ln -sfv "$IK_CHROOT/initrd.img.486" "$IK_TFTP_BOOT/initrd.img.486"
+# 686 kernel image
+ln -sfv "$IK_CHROOT/vmlinuz.686" "$IK_TFTP_BOOT/vmlinuz.686"
+ln -sfv "$IK_CHROOT/initrd.img.686" "$IK_TFTP_BOOT/initrd.img.686"
+# memtest86+
+ln -sfv "$IK_CHROOT/boot/memtest86+.bin" "$IK_TFTP_BOOT/memtest86+.bin"
+# syslinux components
+ln -sfv "/usr/lib/syslinux/pxelinux.0" "$IK_TFTP_BOOT/pxelinux.0"
+ln -sfv "/usr/lib/syslinux/vesamenu.c32" "$IK_TFTP_BOOT/vesamenu.c32"
+
+cd - > /dev/null
+
+echo
+echo "DONE with Internet Kiosk Terminal PXE/Syslinux environment setup."
+echo "However, 2-3 manual steps are still needed..."
+
+echo
+echo "1. Make sure your DHCP server's configuration points to:"
+echo
+echo " next-server <IP-or-hostname-of-this-server>;"
+echo " filename '/pxelinux.0';"
+echo
+echo "2. Export the Internet Kiosk Terminal's chroot environment via NFSv3:"
+echo
+echo " Add this line to /etc/exports..."
+echo " $IK_CHROOT <your-network>/<netmask>(ro,async,no_root_squash,no_subtree_check)"
+echo
+echo " ... and then restart your NFS server with:"
+echo " /etc/init.d/nfs-kernel-server restart"
+echo
+echo "3. Customize PXE/Syslinux files in $IK_TFTP_BOOT/ (optional):"
+echo
+echo " - customize PXE boot menu, take a look at $IK_TFTP_BOOT/default.cfg"
+echo " and proceed from there on..."
+echo " - use your own boot loader background image: 640x480px, 16bit colour depth,"
+echo " file: $IK_TFTP_BOOT/ik-dte.png"
+echo
diff --git a/internet-kiosk-management/sbin/ik_shell b/internet-kiosk-management/sbin/ik_shell
new file mode 100755
index 0000000..270a7f1
--- /dev/null
+++ b/internet-kiosk-management/sbin/ik_shell
@@ -0,0 +1,87 @@
+#!/bin/bash
+
+# Copyright (C) 2012 by Debian Edu project, http://wiki.debian.org/DebianEdu
+# Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
+
+# Internet Kiosk is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# Internet Kiosk is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the
+# Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+
+set -e
+
+if echo $0 | egrep "^./bin/.*$" >/dev/null; then
+ ETCDIR="etc/"
+elif echo $0 | egrep "^./ik_.*$" >/dev/null; then
+ ETCDIR="../etc/"
+else
+ ETCDIR=/etc/internet-kiosk/
+fi
+
+source $ETCDIR/ik_settings
+
+IK_SHELL="${IK_SHELL:-bash}"
+IK_CHROOT="${IK_CHROOT:-/opt/internet-kiosk}"
+
+test -e "$IK_CHROOT" || {
+ echo "ERROR: Internet Kiosk Terminal chroot does not exist at $IK_CHROOT."
+ echo "Run ik_create to create it..."
+ exit -1
+}
+
+[ "x$USER" == "xroot" ] || {
+ echo "ERROR: Internet Kiosk Diskless Terminal management scripts have to run as super-user root."
+ exit -2
+}
+
+cat > "$IK_CHROOT/ik_dte_shell.sh" <<EOF
+#!/bin/bash
+mount /proc &> /dev/null
+mount /dev/pts &> /dev/null
+export HOME=/root
+
+# export the proxy server (if any) to the shell.
+export http_proxy=$IK_HTTP_PROXY
+export https_proxy=$IK_HTTPS_PROXY
+export ftp_proxy=$IK_FTP_PROXY
+
+echo 'This shell has been started in your Internet Kiosk Terminal's chroot environment.'
+echo 'All changes performed here will take effect on your Internet Kiosk Terminals'
+echo 'after their next (re)boot. So be careful!!!'
+echo
+echo "To return from this chroot shell hit STRG+D or type ,,exit'' on the"
+echo 'command line...'
+echo
+echo 'Note: Service restarts have been disabled in the Internet Kiosk Terminal's chroot.'
+echo
+
+# disable service restarts
+test -e /sbin/start-stop-daemon.keep || mv /sbin/start-stop-daemon /sbin/start-stop-daemon.keep
+echo '#!/bin/sh' > /sbin/start-stop-daemon
+echo 'exit 0' >> /sbin/start-stop-daemon
+chmod +x /sbin/start-stop-daemon
+
+/bin/$IK_SHELL
+
+# restore start-stop-daemon
+[ \$(stat --format '%s' /sbin/start-stop-daemon) -lt 200 ] && mv /sbin/start-stop-daemon.keep /sbin/start-stop-daemon
+
+umount -l /proc &> /dev/null
+umount -l /dev/pts &> /dev/null
+
+echo
+echo "Internet Kiosk Terminal Shell has exited."
+echo
+EOF
+chmod u+x "$IK_CHROOT/ik_dte_shell.sh"
+chroot "$IK_CHROOT" /ik_dte_shell.sh
diff --git a/internet-kiosk-management/sbin/ik_update b/internet-kiosk-management/sbin/ik_update
new file mode 100755
index 0000000..0a3eac6
--- /dev/null
+++ b/internet-kiosk-management/sbin/ik_update
@@ -0,0 +1,74 @@
+#!/bin/bash
+
+# Copyright (C) 2012 by Debian Edu project, http://wiki.debian.org/DebianEdu
+# Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
+
+# Internet Kiosk is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# Internet Kiosk is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the
+# Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+
+set -e
+
+if echo $0 | egrep "^./bin/.*$" >/dev/null; then
+ ETCDIR="etc/"
+elif echo $0 | egrep "^./ik_.*$" >/dev/null; then
+ ETCDIR="../etc"
+else
+ ETCDIR=/etc/internet-kiosk
+fi
+
+source $ETCDIR/ik_settings
+
+IK_BASE="${IK_BASE:-/opt/internet-kiosk}"
+IK_CHROOT="${IK_CHROOT:-$IK_BASE/chroot}"
+IK_CONFIG="${IK_CONFIG:-$IK_BASE/etc}"
+
+test -e "$IK_CHROOT" || {
+ echo "ERROR: Internet Kiosk Diskless Terminal chroot does not exist at $IK_CHROOT."
+ echo "Run ik_create to create it..."
+ exit -1
+}
+
+test -e "$IK_CONFIG" || {
+ echo "ERROR: No Internet Kiosk Diskless Terminal configuration found at $IK_CONFIG. Please check..."
+ exit -1
+}
+
+[ "x$USER" == "xroot" ] || {
+ echo "ERROR: Internet Kiosk Diskless Terminal management scripts have to run as super-user root."
+ exit -2
+}
+
+mkdir -p "$IK_CHROOT/etc/internet-kiosk"
+
+echo "Installing Internet Kiosk configuration into chroot environment..."
+echo "------------------------------------------------------------------"
+
+if test -f $IK_CONFIG/ik_init; then
+ cp -v "$IK_CONFIG/ik_init" "$IK_CHROOT/etc/internet-kiosk/ik_init"
+ chmod a+rx $IK_CHROOT/etc/internet-kiosk/ik_init
+fi
+
+if test -f $IK_CONFIG/ik_start; then
+ cp -v "$IK_CONFIG/ik_start" "$IK_CHROOT/etc/internet-kiosk/ik_start"
+ chmod a+rx "$IK_CHROOT/etc/internet-kiosk/ik_start"
+fi
+
+if test -f $IK_CONFIG/ik_sessions; then
+ cp -v "$IK_CONFIG/ik_sessions" "$IK_CHROOT/etc/internet-kiosk/ik_sessions"
+ chmod a+rx "$IK_CHROOT/etc/internet-kiosk/ik_sessions"
+fi
+
+echo
+
diff --git a/internet-kiosk-management/sbin/ik_upgrade b/internet-kiosk-management/sbin/ik_upgrade
new file mode 100755
index 0000000..e203ca0
--- /dev/null
+++ b/internet-kiosk-management/sbin/ik_upgrade
@@ -0,0 +1,85 @@
+#!/bin/bash
+
+# Copyright (C) 2012 by Debian Edu project, http://wiki.debian.org/DebianEdu
+# Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
+
+# Internet Kiosk is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# Internet Kiosk is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the
+# Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+
+set -e
+
+if echo $0 | egrep "^./bin/.*$" >/dev/null; then
+ ETCDIR="etc/"
+elif echo $0 | egrep "^./ik_.*$" >/dev/null; then
+ ETCDIR="../etc"
+else
+ ETCDIR=/etc/internet-kiosk
+fi
+
+source $ETCDIR/ik_settings
+
+IK_CHROOT="${IK_CHROOT:-/opt/internet-kiosk}"
+
+test -e "$IK_CHROOT" || {
+ echo "ERROR: Internet Kiosk Diskless Terminal chroot does not exist at $IK_CHROOT."
+ echo "Run ik_create to create it..."
+ exit -1
+}
+
+[ "x$USER" == "xroot" ] || {
+ echo "ERROR: Internet Kiosk Diskless Terminal management scripts have to run as super-user root."
+ exit -2
+}
+
+cat > "$IK_CHROOT/ik_dte_upgrade.sh" <<EOF
+#!/bin/bash
+mount /proc &> /dev/null
+mount /dev/pts &> /dev/null
+export HOME=/root
+
+export http_proxy=$IK_HTTP_PROXY
+export https_proxy=$IK_HTTPS_PROXY
+export ftp_proxy=$IK_FTP_PROXY
+
+# disable service restarts
+test -e /sbin/start-stop-daemon.keep || mv /sbin/start-stop-daemon /sbin/start-stop-daemon.keep
+echo '#!/bin/sh' > /sbin/start-stop-daemon
+echo 'exit 0' >> /sbin/start-stop-daemon
+chmod +x /sbin/start-stop-daemon
+
+[ \$? -eq 0 ] && apt-get update
+[ \$? -eq 0 ] && apt-get upgrade
+
+# check for kernel upgrades
+for symlink in /vmlinuz /vmlinuz.old /initrd.img /initrd.img.old; do
+ if [ -h \$symlink ]; then
+ symlink_target=\$(ls -l "\$symlink" | awk '{print \$11}')
+ echo \$symlink_target | egrep ".*-486$" >/dev/null && mv \$symlink \${symlink/.old/}.486
+ echo \$symlink_target | egrep ".*-686$" >/dev/null && mv \$symlink \${symlink/.old/}.686
+ fi
+done
+
+# restore start-stop-daemon
+[ \$(stat --format '%s' /sbin/start-stop-daemon) -lt 200 ] && mv /sbin/start-stop-daemon.keep /sbin/start-stop-daemon
+
+umount -l /proc &> /dev/null
+umount -l /dev/pts &> /dev/null
+
+echo
+echo "Internet Kiosk Diskless Terminal upgrade has finished."
+echo
+EOF
+chmod u+x "$IK_CHROOT/ik_dte_upgrade.sh"
+chroot "$IK_CHROOT" /ik_dte_upgrade.sh