summaryrefslogtreecommitdiff
path: root/internet-kiosk-management/sbin/ik_shell
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/ik_shell
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/ik_shell')
-rwxr-xr-xinternet-kiosk-management/sbin/ik_shell87
1 files changed, 87 insertions, 0 deletions
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